Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
eb3ab4fc
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看板
提交
eb3ab4fc
编写于
5月 11, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
factor code
上级
6cf1adf1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
18 deletion
+10
-18
source/libs/stream/inc/streamBackendRocksdb.h
source/libs/stream/inc/streamBackendRocksdb.h
+1
-9
source/libs/stream/src/streamBackendRocksdb.c
source/libs/stream/src/streamBackendRocksdb.c
+2
-2
source/libs/stream/src/streamState.c
source/libs/stream/src/streamState.c
+4
-4
source/libs/stream/src/tstreamFileState.c
source/libs/stream/src/tstreamFileState.c
+3
-3
未找到文件。
source/libs/stream/inc/streamBackendRocksdb.h
浏览文件 @
eb3ab4fc
...
...
@@ -110,14 +110,6 @@ int32_t streamStateGetParName_rocksdb(SStreamState* pState, int64_t groupId, voi
void
streamStateDestroy_rocksdb
(
SStreamState
*
pState
,
bool
remove
);
void
*
streamStateCreateBatch
();
int32_t
streamStateGetBatchSize
(
void
*
pBatch
);
void
streamStateClearBatch
(
void
*
pBatch
);
void
streamStateDestroyBatch
(
void
*
pBatch
);
int32_t
streamStatePutBatch
(
SStreamState
*
pState
,
const
char
*
cfName
,
rocksdb_writebatch_t
*
pBatch
,
void
*
key
,
void
*
val
,
int32_t
vlen
);
int32_t
streamStatePutBatch_rocksdb
(
SStreamState
*
pState
,
void
*
pBatch
);
// default cf
int32_t
streamDefaultPut_rocksdb
(
SStreamState
*
pState
,
const
void
*
key
,
void
*
pVal
,
int32_t
pVLen
);
int32_t
streamDefaultGet_rocksdb
(
SStreamState
*
pState
,
const
void
*
key
,
void
**
pVal
,
int32_t
*
pVLen
);
...
...
@@ -136,7 +128,7 @@ int32_t streamStateGetBatchSize(void* pBatch);
void
streamStateClearBatch
(
void
*
pBatch
);
void
streamStateDestroyBatch
(
void
*
pBatch
);
int32_t
streamStatePutBatch
(
SStreamState
*
pState
,
const
char
*
cfName
,
rocksdb_writebatch_t
*
pBatch
,
void
*
key
,
void
*
val
,
int32_t
vlen
);
void
*
val
,
int32_t
vlen
,
int64_t
ttl
);
int32_t
streamStatePutBatch_rocksdb
(
SStreamState
*
pState
,
void
*
pBatch
);
// int32_t streamDefaultIter_rocksdb(SStreamState* pState, const void* start, const void* end, SArray* result);
#endif
\ No newline at end of file
source/libs/stream/src/streamBackendRocksdb.c
浏览文件 @
eb3ab4fc
...
...
@@ -1979,7 +1979,7 @@ int32_t streamStateGetBatchSize(void* pBatch) {
void
streamStateClearBatch
(
void
*
pBatch
)
{
rocksdb_writebatch_clear
((
rocksdb_writebatch_t
*
)
pBatch
);
}
void
streamStateDestroyBatch
(
void
*
pBatch
)
{
rocksdb_writebatch_destroy
((
rocksdb_writebatch_t
*
)
pBatch
);
}
int32_t
streamStatePutBatch
(
SStreamState
*
pState
,
const
char
*
cfName
,
rocksdb_writebatch_t
*
pBatch
,
void
*
key
,
void
*
val
,
int32_t
vlen
)
{
void
*
val
,
int32_t
vlen
,
int64_t
ttl
)
{
int
i
=
streamGetInit
(
cfName
);
if
(
i
<
0
)
{
...
...
@@ -1990,7 +1990,7 @@ int32_t streamStatePutBatch(SStreamState* pState, const char* cfName, rocksdb_wr
int32_t
klen
=
ginitDict
[
i
].
enFunc
((
void
*
)
key
,
buf
);
char
*
ttlV
=
NULL
;
int32_t
ttlVLen
=
ginitDict
[
i
].
enValueFunc
(
val
,
vlen
,
0
,
&
ttlV
);
int32_t
ttlVLen
=
ginitDict
[
i
].
enValueFunc
(
val
,
vlen
,
ttl
,
&
ttlV
);
rocksdb_column_family_handle_t
*
pCf
=
pState
->
pTdbState
->
pHandle
[
ginitDict
[
i
].
idx
];
rocksdb_writebatch_put_cf
((
rocksdb_writebatch_t
*
)
pBatch
,
pCf
,
buf
,
(
size_t
)
klen
,
ttlV
,
(
size_t
)
ttlVLen
);
taosMemoryFree
(
ttlV
);
...
...
source/libs/stream/src/streamState.c
浏览文件 @
eb3ab4fc
...
...
@@ -119,7 +119,7 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int
pState
->
taskId
=
pTask
->
id
.
taskId
;
pState
->
streamId
=
pTask
->
id
.
streamId
;
#ifdef USE_ROCKSDB
qWarn
(
"open stream state1"
);
//
qWarn("open stream state1");
taosAcquireRef
(
pTask
->
pMeta
->
streamBackendId
,
pTask
->
pMeta
->
streamBackendRid
);
int
code
=
streamStateOpenBackend
(
pTask
->
pMeta
->
streamBackend
,
pState
);
if
(
code
==
-
1
)
{
...
...
@@ -127,7 +127,7 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int
taosMemoryFree
(
pState
);
pState
=
NULL
;
}
qWarn
(
"open stream state2, %s"
,
statePath
);
//
qWarn("open stream state2, %s", statePath);
pState
->
pTdbState
->
pOwner
=
pTask
;
pState
->
pFileState
=
NULL
;
_hash_fn_t
hashFn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
);
...
...
@@ -225,6 +225,7 @@ void streamStateClose(SStreamState* pState, bool remove) {
#ifdef USE_ROCKSDB
// streamStateCloseBackend(pState);
streamStateDestroy
(
pState
,
remove
);
taosReleaseRef
(
pTask
->
pMeta
->
streamBackendId
,
pTask
->
pMeta
->
streamBackendRid
);
#else
tdbCommit
(
pState
->
pTdbState
->
db
,
pState
->
pTdbState
->
txn
);
tdbPostCommit
(
pState
->
pTdbState
->
db
,
pState
->
pTdbState
->
txn
);
...
...
@@ -236,7 +237,6 @@ void streamStateClose(SStreamState* pState, bool remove) {
tdbTbClose
(
pState
->
pTdbState
->
pParTagDb
);
tdbClose
(
pState
->
pTdbState
->
db
);
#endif
taosReleaseRef
(
pTask
->
pMeta
->
streamBackendId
,
pTask
->
pMeta
->
streamBackendRid
);
}
int32_t
streamStateBegin
(
SStreamState
*
pState
)
{
...
...
@@ -404,7 +404,7 @@ int32_t streamStateSaveInfo(SStreamState* pState, void* pKey, int32_t keyLen, vo
int32_t
code
=
0
;
void
*
batch
=
streamStateCreateBatch
();
code
=
streamStatePutBatch
(
pState
,
"default"
,
batch
,
pKey
,
pVal
,
vLen
);
code
=
streamStatePutBatch
(
pState
,
"default"
,
batch
,
pKey
,
pVal
,
vLen
,
0
);
if
(
code
!=
0
)
{
return
code
;
}
...
...
source/libs/stream/src/tstreamFileState.c
浏览文件 @
eb3ab4fc
...
...
@@ -355,7 +355,7 @@ int32_t flushSnapshot(SStreamFileState* pFileState, SStreamSnapshot* pSnapshot,
}
SStateKey
sKey
=
{.
key
=
*
((
SWinKey
*
)
pPos
->
pKey
),
.
opNum
=
((
SStreamState
*
)
pFileState
->
pFileStore
)
->
number
};
code
=
streamStatePutBatch
(
pFileState
->
pFileStore
,
"state"
,
batch
,
&
sKey
,
pPos
->
pRowBuff
,
pFileState
->
rowSize
);
code
=
streamStatePutBatch
(
pFileState
->
pFileStore
,
"state"
,
batch
,
&
sKey
,
pPos
->
pRowBuff
,
pFileState
->
rowSize
,
0
);
qDebug
(
"===stream===put %"
PRId64
" to disc, res %d"
,
sKey
.
key
.
ts
,
code
);
}
if
(
streamStateGetBatchSize
(
batch
)
>
0
)
{
...
...
@@ -371,7 +371,7 @@ int32_t flushSnapshot(SStreamFileState* pFileState, SStreamSnapshot* pSnapshot,
int32_t
len
=
0
;
sprintf
(
keyBuf
,
"%s:%"
PRId64
""
,
taskKey
,
((
SStreamState
*
)
pFileState
->
pFileStore
)
->
checkPointId
);
streamFileStateEncode
(
&
pFileState
->
flushMark
,
&
valBuf
,
&
len
);
code
=
streamStatePutBatch
(
pFileState
->
pFileStore
,
"default"
,
batch
,
keyBuf
,
valBuf
,
len
);
code
=
streamStatePutBatch
(
pFileState
->
pFileStore
,
"default"
,
batch
,
keyBuf
,
valBuf
,
len
,
0
);
taosMemoryFree
(
valBuf
);
}
{
...
...
@@ -380,7 +380,7 @@ int32_t flushSnapshot(SStreamFileState* pFileState, SStreamSnapshot* pSnapshot,
int32_t
len
=
0
;
memcpy
(
keyBuf
,
taskKey
,
strlen
(
taskKey
));
len
=
sprintf
(
valBuf
,
"%"
PRId64
""
,
((
SStreamState
*
)
pFileState
->
pFileStore
)
->
checkPointId
);
code
=
streamStatePutBatch
(
pFileState
->
pFileStore
,
"default"
,
batch
,
keyBuf
,
valBuf
,
len
);
code
=
streamStatePutBatch
(
pFileState
->
pFileStore
,
"default"
,
batch
,
keyBuf
,
valBuf
,
len
,
0
);
}
streamStatePutBatch_rocksdb
(
pFileState
->
pFileStore
,
batch
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录