Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c3d7f888
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c3d7f888
编写于
3月 26, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add backend
上级
b9531fc9
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
183 addition
and
93 deletion
+183
-93
contrib/test/rocksdb/main.c
contrib/test/rocksdb/main.c
+54
-21
source/libs/stream/src/streamState.c
source/libs/stream/src/streamState.c
+2
-1
source/libs/stream/src/streamStateRocksdb.c
source/libs/stream/src/streamStateRocksdb.c
+127
-71
未找到文件。
contrib/test/rocksdb/main.c
浏览文件 @
c3d7f888
...
...
@@ -159,30 +159,63 @@ int main(int argc, char const *argv[]) {
rocksdb_write
(
db
,
wOpt
,
wBatch
,
&
err
);
}
{
char
buf
[
128
]
=
{
0
};
KV
kv
=
{.
k1
=
0
,
.
k2
=
0
};
kvSerial
(
&
kv
,
buf
);
char
*
v
=
rocksdb_get_cf
(
db
,
rOpt
,
cfHandle
[
1
],
buf
,
sizeof
(
kv
),
&
vlen
,
&
err
);
printf
(
"Get value %s, and len = %d, xxxx
\n
"
,
v
,
(
int
)
vlen
);
rocksdb_iterator_t
*
iter
=
rocksdb_create_iterator_cf
(
db
,
rOpt
,
cfHandle
[
1
]);
rocksdb_iter_seek_to_first
(
iter
);
int
i
=
0
;
while
(
rocksdb_iter_valid
(
iter
))
{
size_t
klen
,
vlen
;
const
char
*
key
=
rocksdb_iter_key
(
iter
,
&
klen
);
const
char
*
value
=
rocksdb_iter_value
(
iter
,
&
vlen
);
KV
kv
;
kvDeserial
(
&
kv
,
(
char
*
)
key
);
printf
(
"kv1: %d
\t
kv2: %d, len:%d, value = %s
\n
"
,
(
int
)(
kv
.
k1
),
(
int
)(
kv
.
k2
),
(
int
)(
klen
),
value
);
i
++
;
rocksdb_iter_next
(
iter
);
{
char
buf
[
128
]
=
{
0
};
KV
kv
=
{.
k1
=
0
,
.
k2
=
0
};
kvSerial
(
&
kv
,
buf
);
char
*
v
=
rocksdb_get_cf
(
db
,
rOpt
,
cfHandle
[
1
],
buf
,
sizeof
(
kv
),
&
vlen
,
&
err
);
printf
(
"Get value %s, and len = %d, xxxx
\n
"
,
v
,
(
int
)
vlen
);
rocksdb_iterator_t
*
iter
=
rocksdb_create_iterator_cf
(
db
,
rOpt
,
cfHandle
[
1
]);
rocksdb_iter_seek_to_first
(
iter
);
int
i
=
0
;
while
(
rocksdb_iter_valid
(
iter
))
{
size_t
klen
,
vlen
;
const
char
*
key
=
rocksdb_iter_key
(
iter
,
&
klen
);
const
char
*
value
=
rocksdb_iter_value
(
iter
,
&
vlen
);
KV
kv
;
kvDeserial
(
&
kv
,
(
char
*
)
key
);
printf
(
"kv1: %d
\t
kv2: %d, len:%d, value = %s
\n
"
,
(
int
)(
kv
.
k1
),
(
int
)(
kv
.
k2
),
(
int
)(
klen
),
value
);
i
++
;
rocksdb_iter_next
(
iter
);
}
rocksdb_iter_destroy
(
iter
);
}
{
char
buf
[
128
]
=
{
0
};
KV
kv
=
{.
k1
=
0
,
.
k2
=
0
};
int
len
=
kvSerial
(
&
kv
,
buf
);
rocksdb_iterator_t
*
iter
=
rocksdb_create_iterator_cf
(
db
,
rOpt
,
cfHandle
[
1
]);
rocksdb_iter_seek
(
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
iter
))
{
printf
(
"invalid iter"
);
}
{
char
buf
[
128
]
=
{
0
};
KV
kv
=
{.
k1
=
100
,
.
k2
=
0
};
int
len
=
kvSerial
(
&
kv
,
buf
);
rocksdb_iterator_t
*
iter
=
rocksdb_create_iterator_cf
(
db
,
rOpt
,
cfHandle
[
1
]);
rocksdb_iter_seek
(
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
iter
))
{
printf
(
"invalid iter
\n
"
);
rocksdb_iter_seek_for_prev
(
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
iter
))
{
printf
(
"stay invalid iter
\n
"
);
}
else
{
size_t
klen
=
0
,
vlen
=
0
;
const
char
*
key
=
rocksdb_iter_key
(
iter
,
&
klen
);
const
char
*
value
=
rocksdb_iter_value
(
iter
,
&
vlen
);
KV
kv
;
kvDeserial
(
&
kv
,
(
char
*
)
key
);
printf
(
"kv1: %d
\t
kv2: %d, len:%d, value = %s
\n
"
,
(
int
)(
kv
.
k1
),
(
int
)(
kv
.
k2
),
(
int
)(
klen
),
value
);
}
}
}
}
rocksdb_iter_destroy
(
iter
);
printf
(
"iterator count %d
\n
"
,
i
);
}
char
*
v
=
rocksdb_get_cf
(
db
,
rOpt
,
cfHandle
[
0
],
"key"
,
strlen
(
"key"
),
&
vlen
,
&
err
);
printf
(
"Get value %s, and len = %d
\n
"
,
v
,
(
int
)
vlen
);
//
char *v = rocksdb_get_cf(db, rOpt, cfHandle[0], "key", strlen("key"), &vlen, &err);
//
printf("Get value %s, and len = %d\n", v, (int)vlen);
rocksdb_column_family_handle_destroy
(
cfHandle
[
0
]);
rocksdb_column_family_handle_destroy
(
cfHandle
[
1
]);
...
...
source/libs/stream/src/streamState.c
浏览文件 @
c3d7f888
...
...
@@ -398,7 +398,7 @@ int32_t streamStateAddIfNotExist(SStreamState* pState, const SWinKey* key, void*
int32_t
streamStateReleaseBuf
(
SStreamState
*
pState
,
const
SWinKey
*
key
,
void
*
pVal
)
{
// todo refactor
q
Warn
(
"streamStateReleaseBuf"
);
q
Debug
(
"streamStateReleaseBuf"
);
if
(
!
pVal
)
{
return
0
;
}
...
...
@@ -667,6 +667,7 @@ void streamStateFreeCur(SStreamStateCur* pCur) {
if
(
!
pCur
)
{
return
;
}
qDebug
(
"streamStateFreeCur"
);
rocksdb_iter_destroy
(
pCur
->
iter
);
tdbTbcClose
(
pCur
->
pCur
);
taosMemoryFree
(
pCur
);
...
...
source/libs/stream/src/streamStateRocksdb.c
浏览文件 @
c3d7f888
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录