Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e6e9828d
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e6e9828d
编写于
3月 29, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add backend
上级
ae54e994
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
23 deletion
+25
-23
source/libs/stream/src/streamStateRocksdb.c
source/libs/stream/src/streamStateRocksdb.c
+25
-23
未找到文件。
source/libs/stream/src/streamStateRocksdb.c
浏览文件 @
e6e9828d
...
...
@@ -415,25 +415,27 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfNa
int
idx
=
streamGetInit
(
cfName
);
*
snapshot
=
(
rocksdb_snapshot_t
*
)
rocksdb_create_snapshot
(
pState
->
pTdbState
->
rocksdb
);
*
readOpt
=
(
rocksdb_readoptions_t
*
)
rocksdb_readoptions_create
();
rocksdb_readoptions_
set_snapshot
(
pState
->
pTdbState
->
readOpts
,
*
snapshot
);
rocksdb_readoptions_set_fill_cache
(
pState
->
pTdbState
->
readOpts
,
0
)
;
rocksdb_readoptions_
t
*
rOpt
=
rocksdb_readoptions_create
(
);
*
readOpt
=
rOpt
;
return
rocksdb_create_iterator_cf
(
pState
->
pTdbState
->
rocksdb
,
*
readOpt
,
pState
->
pTdbState
->
pHandle
[
idx
]);
rocksdb_readoptions_set_snapshot
(
rOpt
,
*
snapshot
);
rocksdb_readoptions_set_fill_cache
(
rOpt
,
0
);
return
rocksdb_create_iterator_cf
(
pState
->
pTdbState
->
rocksdb
,
rOpt
,
pState
->
pTdbState
->
pHandle
[
idx
]);
}
#define STREAM_STATE_PUT_ROCKSDB(pState, funcname, key, value, vLen) \
do { \
code = 0; \
char buf[
40] = {0};
\
char buf[
128] = {0};
\
char* err = NULL; \
int i = streamGetInit(funcname); \
if (i < 0) { \
qWarn("streamState failed to get cf name: %s", funcname); \
return -1; \
} \
char toString[
40] = {0};
\
char toString[
128] = {0};
\
if (qDebugFlag & DEBUG_TRACE) ginitDict[i].toStrFunc((void*)key, toString); \
ginitDict[i].enFunc((void*)key, buf); \
rocksdb_column_family_handle_t* pHandle = pState->pTdbState->pHandle[ginitDict[i].idx]; \
...
...
@@ -452,14 +454,14 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfNa
#define STREAM_STATE_GET_ROCKSDB(pState, funcname, key, pVal, vLen) \
do { \
code = 0; \
char buf[
40] = {0};
\
char buf[
128] = {0};
\
char* err = NULL; \
int i = streamGetInit(funcname); \
if (i < 0) { \
qWarn("streamState failed to get cf name: %s", funcname); \
return -1; \
} \
char toString[
40] = {0};
\
char toString[
128] = {0};
\
if (qDebugFlag & DEBUG_TRACE) ginitDict[i].toStrFunc((void*)key, toString); \
ginitDict[i].enFunc((void*)key, buf); \
rocksdb_column_family_handle_t* pHandle = pState->pTdbState->pHandle[ginitDict[i].idx]; \
...
...
@@ -487,14 +489,14 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfNa
#define STREAM_STATE_DEL_ROCKSDB(pState, funcname, key) \
do { \
code = 0; \
char buf[
40] = {0};
\
char buf[
128] = {0};
\
char* err = NULL; \
int i = streamGetInit(funcname); \
if (i < 0) { \
qWarn("streamState failed to get cf name: %s", funcname); \
return -1; \
} \
char toString[
40] = {0};
\
char toString[
128] = {0};
\
if (qDebugFlag & DEBUG_TRACE) ginitDict[i].toStrFunc((void*)key, toString); \
ginitDict[i].enFunc((void*)key, buf); \
rocksdb_column_family_handle_t* pHandle = pState->pTdbState->pHandle[ginitDict[i].idx]; \
...
...
@@ -573,14 +575,14 @@ int32_t streamStateClear_rocksdb(SStreamState* pState) {
SStateKey
sKey
=
{.
key
=
{.
ts
=
0
,
.
groupId
=
0
},
.
opNum
=
pState
->
number
};
SStateKey
eKey
=
{.
key
=
{.
ts
=
INT64_MAX
,
.
groupId
=
UINT64_MAX
},
.
opNum
=
pState
->
number
};
char
sKeyStr
[
40
]
=
{
0
};
char
eKeyStr
[
40
]
=
{
0
};
char
sKeyStr
[
128
]
=
{
0
};
char
eKeyStr
[
128
]
=
{
0
};
int
sLen
=
stateKeyEncode
(
&
sKey
,
sKeyStr
);
int
eLen
=
stateKeyEncode
(
&
eKey
,
eKeyStr
);
char
toStringStart
[
40
]
=
{
0
};
char
toStringEnd
[
40
]
=
{
0
};
char
toStringStart
[
128
]
=
{
0
};
char
toStringEnd
[
128
]
=
{
0
};
if
(
qDebugFlag
&
DEBUG_TRACE
)
{
stateKeyToString
(
&
sKey
,
toStringStart
);
stateKeyToString
(
&
eKey
,
toStringEnd
);
...
...
@@ -614,7 +616,7 @@ SStreamStateCur* streamStateSessionSeekKeyCurrentPrev_rocksdb(SStreamState* pSta
pCur
->
db
=
pState
->
pTdbState
->
rocksdb
;
pCur
->
iter
=
streamStateIterCreate
(
pState
,
"sess"
,
&
pCur
->
snapshot
,
&
pCur
->
readOpt
);
char
buf
[
40
]
=
{
0
};
char
buf
[
128
]
=
{
0
};
SStateSessionKey
sKey
=
{.
key
=
*
key
,
.
opNum
=
pState
->
number
};
int
len
=
stateSessionKeyEncode
(
&
sKey
,
buf
);
if
(
!
streamStateIterSeekAndValid
(
pCur
->
iter
,
buf
,
len
))
{
...
...
@@ -647,7 +649,7 @@ SStreamStateCur* streamStateSessionSeekKeyCurrentNext_rocksdb(SStreamState* pSta
pCur
->
iter
=
streamStateIterCreate
(
pState
,
"sess"
,
&
pCur
->
snapshot
,
&
pCur
->
readOpt
);
pCur
->
number
=
pState
->
number
;
char
buf
[
40
]
=
{
0
};
char
buf
[
128
]
=
{
0
};
SStateSessionKey
sKey
=
{.
key
=
*
key
,
.
opNum
=
pState
->
number
};
int
len
=
stateSessionKeyEncode
(
&
sKey
,
buf
);
...
...
@@ -681,7 +683,7 @@ SStreamStateCur* streamStateSessionSeekKeyNext_rocksdb(SStreamState* pState, con
SStateSessionKey
sKey
=
{.
key
=
*
key
,
.
opNum
=
pState
->
number
};
char
buf
[
40
]
=
{
0
};
char
buf
[
128
]
=
{
0
};
int
len
=
stateSessionKeyEncode
(
&
sKey
,
buf
);
if
(
!
streamStateIterSeekAndValid
(
pCur
->
iter
,
buf
,
len
))
{
streamStateFreeCur
(
pCur
);
...
...
@@ -721,7 +723,7 @@ SStreamStateCur* streamStateGetCur_rocksdb(SStreamState* pState, const SWinKey*
pCur
->
iter
=
streamStateIterCreate
(
pState
,
"default"
,
&
pCur
->
snapshot
,
&
pCur
->
readOpt
);
SStateKey
sKey
=
{.
key
=
*
key
,
.
opNum
=
pState
->
number
};
char
buf
[
40
]
=
{
0
};
char
buf
[
128
]
=
{
0
};
int
len
=
stateKeyEncode
((
void
*
)
&
sKey
,
buf
);
rocksdb_iter_seek
(
pCur
->
iter
,
buf
,
len
);
...
...
@@ -777,7 +779,7 @@ SStreamStateCur* streamStateFillGetCur_rocksdb(SStreamState* pState, const SWinK
pCur
->
db
=
pState
->
pTdbState
->
rocksdb
;
pCur
->
iter
=
streamStateIterCreate
(
pState
,
"fill"
,
&
pCur
->
snapshot
,
&
pCur
->
readOpt
);
char
buf
[
40
]
=
{
0
};
char
buf
[
128
]
=
{
0
};
int
len
=
winKeyEncode
((
void
*
)
key
,
buf
);
if
(
!
streamStateIterSeekAndValid
(
pCur
->
iter
,
buf
,
len
))
{
streamStateFreeCur
(
pCur
);
...
...
@@ -890,7 +892,7 @@ SStreamStateCur* streamStateSeekKeyNext_rocksdb(SStreamState* pState, const SWin
pCur
->
iter
=
streamStateIterCreate
(
pState
,
"default"
,
&
pCur
->
snapshot
,
&
pCur
->
readOpt
);
SStateKey
sKey
=
{.
key
=
*
key
,
.
opNum
=
pState
->
number
};
char
buf
[
40
]
=
{
0
};
char
buf
[
128
]
=
{
0
};
int
len
=
stateKeyEncode
((
void
*
)
&
sKey
,
buf
);
if
(
!
streamStateIterSeekAndValid
(
pCur
->
iter
,
buf
,
len
))
{
streamStateFreeCur
(
pCur
);
...
...
@@ -921,7 +923,7 @@ SStreamStateCur* streamStateFillSeekKeyNext_rocksdb(SStreamState* pState, const
pCur
->
db
=
pState
->
pTdbState
->
rocksdb
;
pCur
->
iter
=
streamStateIterCreate
(
pState
,
"fill"
,
&
pCur
->
snapshot
,
&
pCur
->
readOpt
);
char
buf
[
32
]
=
{
0
};
char
buf
[
128
]
=
{
0
};
int
len
=
winKeyEncode
((
void
*
)
key
,
buf
);
if
(
!
streamStateIterSeekAndValid
(
pCur
->
iter
,
buf
,
len
))
{
streamStateFreeCur
(
pCur
);
...
...
@@ -952,7 +954,7 @@ SStreamStateCur* streamStateFillSeekKeyPrev_rocksdb(SStreamState* pState, const
pCur
->
db
=
pState
->
pTdbState
->
rocksdb
;
pCur
->
iter
=
streamStateIterCreate
(
pState
,
"fill"
,
&
pCur
->
snapshot
,
&
pCur
->
readOpt
);
char
buf
[
24
]
=
{
0
};
char
buf
[
128
]
=
{
0
};
int
len
=
winKeyEncode
((
void
*
)
key
,
buf
);
if
(
!
streamStateIterSeekAndValid
(
pCur
->
iter
,
buf
,
len
))
{
streamStateFreeCur
(
pCur
);
...
...
@@ -999,7 +1001,7 @@ int32_t streamStateSessionGetKeyByRange_rocksdb(SStreamState* pState, const SSes
SStateSessionKey
sKey
=
{.
key
=
*
key
,
.
opNum
=
pState
->
number
};
int32_t
c
=
0
;
char
buf
[
64
]
=
{
0
};
char
buf
[
128
]
=
{
0
};
int
len
=
stateSessionKeyEncode
(
&
sKey
,
buf
);
if
(
!
streamStateIterSeekAndValid
(
pCur
->
iter
,
buf
,
len
))
{
streamStateFreeCur
(
pCur
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录