Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
15af111f
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
15af111f
编写于
8月 18, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'enh/triggerCheckPoint2' of github.com:taosdata/tdengine into enh/triggerCheckPoint2
上级
b8101afb
8e4411c1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
46 addition
and
26 deletion
+46
-26
source/libs/executor/src/executorInt.c
source/libs/executor/src/executorInt.c
+1
-1
source/libs/stream/src/streamBackendRocksdb.c
source/libs/stream/src/streamBackendRocksdb.c
+21
-9
source/libs/stream/src/streamMeta.c
source/libs/stream/src/streamMeta.c
+2
-2
source/libs/stream/src/streamState.c
source/libs/stream/src/streamState.c
+12
-8
source/libs/stream/src/streamTask.c
source/libs/stream/src/streamTask.c
+10
-6
未找到文件。
source/libs/executor/src/executorInt.c
浏览文件 @
15af111f
...
...
@@ -990,7 +990,7 @@ int32_t buildSessionResultDataBlock(SOperatorInfo* pOperator, void* pState, SSDa
// ASSERT(code == 0);
if
(
code
==
-
1
)
{
// for history
qWarn
(
"===stream===not found session result key:%"
PRId64
", ekey:%"
PRId64
", groupId:%"
PRIu64
"
, opNum:%d
"
,
qWarn
(
"===stream===not found session result key:%"
PRId64
", ekey:%"
PRId64
", groupId:%"
PRIu64
""
,
pKey
->
win
.
skey
,
pKey
->
win
.
ekey
,
pKey
->
groupId
);
pGroupResInfo
->
index
+=
1
;
continue
;
...
...
source/libs/stream/src/streamBackendRocksdb.c
浏览文件 @
15af111f
...
...
@@ -437,7 +437,7 @@ int32_t rebuildDirFromCheckpoint(const char* path, int64_t chkpId, char** dst) {
taosMkDir
(
state
);
code
=
copyFiles
(
chkp
,
state
);
if
(
code
!=
0
)
{
qError
(
"failed to restart stream backend from
%s, reason: %s"
,
chkp
,
tstrerror
(
TAOS_SYSTEM_ERROR
(
errno
)));
qError
(
"failed to restart stream backend from %s, reason: %s"
,
chkp
,
tstrerror
(
TAOS_SYSTEM_ERROR
(
errno
)));
}
else
{
qInfo
(
"succ to restart stream backend at checkpoint path: %s"
,
chkp
);
}
...
...
@@ -457,7 +457,7 @@ void* streamBackendInit(const char* streamPath, int64_t chkpId) {
char
*
backendPath
=
NULL
;
int32_t
code
=
rebuildDirFromCheckpoint
(
streamPath
,
chkpId
,
&
backendPath
);
qDebug
(
"start to init stream backend at %s
"
,
backendPath
);
qDebug
(
"start to init stream backend at %s
, checkpointid: %"
PRId64
""
,
backendPath
,
chkpId
);
uint32_t
dbMemLimit
=
nextPow2
(
tsMaxStreamBackendCache
)
<<
20
;
SBackendWrapper
*
pHandle
=
taosMemoryCalloc
(
1
,
sizeof
(
SBackendWrapper
));
...
...
@@ -481,7 +481,7 @@ void* streamBackendInit(const char* streamPath, int64_t chkpId) {
rocksdb_options_set_max_total_wal_size
(
opts
,
dbMemLimit
);
rocksdb_options_set_recycle_log_file_num
(
opts
,
6
);
rocksdb_options_set_max_write_buffer_number
(
opts
,
3
);
rocksdb_options_set_info_log_level
(
opts
,
0
);
rocksdb_options_set_info_log_level
(
opts
,
1
);
rocksdb_options_set_db_write_buffer_size
(
opts
,
dbMemLimit
);
rocksdb_options_set_write_buffer_size
(
opts
,
dbMemLimit
/
2
);
...
...
@@ -789,9 +789,19 @@ int32_t streamBackendDoCheckpoint(void* arg, uint64_t checkpointId) {
return
-
1
;
}
qDebug
(
"stream backend:%p start to do checkpoint at:%s "
,
pHandle
,
path
);
qDebug
(
"stream backend:%p start to do checkpoint at:%s "
,
pHandle
,
checkpointDir
);
if
(
pHandle
->
db
!=
NULL
)
{
char
*
err
=
NULL
;
char
*
err
=
NULL
;
rocksdb_flushoptions_t
*
flushOpt
=
rocksdb_flushoptions_create
();
rocksdb_flush
(
pHandle
->
db
,
flushOpt
,
&
err
);
if
(
err
!=
NULL
)
{
qError
(
"failed to flush db before streamBackend clean up, reason:%s"
,
err
);
taosMemoryFree
(
err
);
}
rocksdb_flushoptions_destroy
(
flushOpt
);
rocksdb_checkpoint_t
*
cp
=
rocksdb_checkpoint_object_create
(
pHandle
->
db
,
&
err
);
if
(
cp
==
NULL
||
err
!=
NULL
)
{
qError
(
"stream backend:%p failed to do checkpoint at:%s, reason:%s"
,
pHandle
,
path
,
err
);
...
...
@@ -1361,7 +1371,7 @@ int32_t streamStateOpenBackendCf(void* backend, char* name, char** cfs, int32_t
inst
->
pCompares
=
taosMemoryCalloc
(
cfLen
,
sizeof
(
rocksdb_comparator_t
*
));
inst
->
dbOpt
=
handle
->
dbOpt
;
rocksdb_writeoptions_disable_WAL
(
inst
->
wOpt
,
1
);
//
rocksdb_writeoptions_disable_WAL(inst->wOpt, 1);
taosHashPut
(
handle
->
cfInst
,
idstr
,
strlen
(
idstr
)
+
1
,
&
inst
,
sizeof
(
void
*
));
}
else
{
inst
=
*
pInst
;
...
...
@@ -1482,7 +1492,7 @@ int streamStateOpenBackend(void* backend, SStreamState* pState) {
taosThreadRwlockInit
(
&
pBackendCfWrapper
->
rwLock
,
NULL
);
SCfComparator
compare
=
{.
comp
=
pCompare
,
.
numOfComp
=
cfLen
};
pBackendCfWrapper
->
pComparNode
=
streamBackendAddCompare
(
handle
,
&
compare
);
rocksdb_writeoptions_disable_WAL
(
pBackendCfWrapper
->
writeOpts
,
1
);
//
rocksdb_writeoptions_disable_WAL(pBackendCfWrapper->writeOpts, 1);
memcpy
(
pBackendCfWrapper
->
idstr
,
pState
->
pTdbState
->
idstr
,
sizeof
(
pState
->
pTdbState
->
idstr
));
int64_t
id
=
taosAddRef
(
streamBackendCfWrapperId
,
pBackendCfWrapper
);
...
...
@@ -1655,7 +1665,6 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfKe
taosMemoryFree(val); \
if (vLen != NULL) *vLen = tlen; \
} \
if (code == 0) qDebug("streamState str: %s succ to read from %s_%s", toString, wrapper->idstr, funcname); \
} while (0);
#define STREAM_STATE_DEL_ROCKSDB(pState, funcname, key) \
...
...
@@ -1987,6 +1996,7 @@ int32_t streamStateSessionGet_rocksdb(SStreamState* pState, SSessionKey* key, vo
}
taosMemoryFree
(
tmp
);
streamStateFreeCur
(
pCur
);
return
code
;
}
...
...
@@ -2658,7 +2668,7 @@ int32_t streamStatePutBatch(SStreamState* pState, const char* cfKeyName, rocksdb
{
char
tbuf
[
256
]
=
{
0
};
ginitDict
[
i
].
toStrFunc
((
void
*
)
key
,
tbuf
);
qDebug
(
"streamState str: %s succ to write to %s_%s
"
,
tbuf
,
wrapper
->
idstr
,
ginitDict
[
i
].
key
);
qDebug
(
"streamState str: %s succ to write to %s_%s
, len: %d"
,
tbuf
,
wrapper
->
idstr
,
ginitDict
[
i
].
key
,
vlen
);
}
return
0
;
}
...
...
@@ -2693,6 +2703,8 @@ int32_t streamStatePutBatch_rocksdb(SStreamState* pState, void* pBatch) {
qError
(
"streamState failed to write batch, err:%s"
,
err
);
taosMemoryFree
(
err
);
return
-
1
;
}
else
{
qDebug
(
"write batch to backend opt: %p"
,
wrapper
->
pBackend
);
}
return
0
;
}
...
...
source/libs/stream/src/streamMeta.c
浏览文件 @
15af111f
...
...
@@ -446,7 +446,7 @@ int64_t streamGetLatestCheckpointId(SStreamMeta* pMeta) {
tdbTbcMoveToFirst
(
pCur
);
while
(
tdbTbcNext
(
pCur
,
&
pKey
,
&
kLen
,
&
pVal
,
&
vLen
)
==
0
)
{
if
(
pVal
!=
NULL
&&
vLen
!
=
0
)
{
if
(
pVal
==
NULL
||
vLen
=
=
0
)
{
break
;
}
SCheckpointInfo
info
;
...
...
@@ -458,7 +458,7 @@ int64_t streamGetLatestCheckpointId(SStreamMeta* pMeta) {
chkpId
=
TMAX
(
chkpId
,
info
.
checkpointId
);
}
qDebug
(
"get max chkp id: %"
PRId64
""
,
chkpId
);
tdbFree
(
pKey
);
tdbFree
(
pVal
);
tdbTbcClose
(
pCur
);
...
...
source/libs/stream/src/streamState.c
浏览文件 @
15af111f
...
...
@@ -422,14 +422,18 @@ void streamStateSetNumber(SStreamState* pState, int32_t number) { pState->number
int32_t
streamStateSaveInfo
(
SStreamState
*
pState
,
void
*
pKey
,
int32_t
keyLen
,
void
*
pVal
,
int32_t
vLen
)
{
#ifdef USE_ROCKSDB
int32_t
code
=
0
;
void
*
batch
=
streamStateCreateBatch
();
code
=
streamStatePutBatch
(
pState
,
"default"
,
batch
,
pKey
,
pVal
,
vLen
,
0
);
if
(
code
!=
0
)
{
return
code
;
}
code
=
streamStatePutBatch_rocksdb
(
pState
,
batch
);
streamStateDestroyBatch
(
batch
);
// void* batch = streamStateCreateBatch();
// code = streamStatePutBatch(pState, "default", batch, pKey, pVal, vLen, 0);
// if (code != 0) {
// return code;
// }
// code = streamStatePutBatch_rocksdb(pState, batch);
// streamStateDestroyBatch(batch);
code
=
streamDefaultPut_rocksdb
(
pState
,
pKey
,
pVal
,
vLen
);
char
*
Val
=
NULL
;
int32_t
len
=
0
;
code
=
streamDefaultGet_rocksdb
(
pState
,
pKey
,
(
void
**
)
&
Val
,
&
len
);
return
code
;
#else
return
0
;
...
...
source/libs/stream/src/streamTask.c
浏览文件 @
15af111f
...
...
@@ -13,7 +13,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tstream.h"
#include "executor.h"
#include "streamInt.h"
#include "tmisce.h"
...
...
@@ -140,6 +139,7 @@ int32_t tEncodeStreamTask(SEncoder* pEncoder, const SStreamTask* pTask) {
}
int32_t
tDecodeStreamTaskChkInfo
(
SDecoder
*
pDecoder
,
SCheckpointInfo
*
pChkpInfo
)
{
int64_t
ver
;
int64_t
skip64
;
int8_t
skip8
;
int32_t
skip32
;
...
...
@@ -147,6 +147,10 @@ int32_t tDecodeStreamTaskChkInfo(SDecoder* pDecoder, SCheckpointInfo* pChkpInfo)
SEpSet
epSet
;
if
(
tStartDecode
(
pDecoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
ver
)
<
0
)
return
-
1
;
if
(
ver
!=
SSTREAM_TASK_VER
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
skip64
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
skip32
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
skip32
)
<
0
)
return
-
1
;
...
...
@@ -259,7 +263,7 @@ void tFreeStreamTask(SStreamTask* pTask) {
qDebug
(
"free s-task:0x%x, %p, state:%p"
,
taskId
,
pTask
,
pTask
->
pState
);
// remove the ref by timer
while
(
pTask
->
status
.
timerActive
>
0
)
{
while
(
pTask
->
status
.
timerActive
>
0
)
{
qDebug
(
"s-task:%s wait for task stop timer activities"
,
pTask
->
id
.
idStr
);
taosMsleep
(
10
);
}
...
...
@@ -414,7 +418,7 @@ void streamTaskUpdateUpstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpS
EPSET_TO_STR
(
pEpSet
,
buf
);
int32_t
numOfUpstream
=
taosArrayGetSize
(
pTask
->
pUpstreamInfoList
);
for
(
int32_t
i
=
0
;
i
<
numOfUpstream
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfUpstream
;
++
i
)
{
SStreamChildEpInfo
*
pInfo
=
taosArrayGet
(
pTask
->
pUpstreamInfoList
,
i
);
if
(
pInfo
->
nodeId
==
nodeId
)
{
epsetAssign
(
&
pInfo
->
epSet
,
pEpSet
);
...
...
@@ -486,7 +490,7 @@ int32_t streamTaskRestart(SStreamTask* pTask, const char* pDir, bool startTask)
int64_t
stage
=
pTask
->
pMeta
->
stage
;
int32_t
vgId
=
pTask
->
pMeta
->
vgId
;
qDebug
(
"s-task:%s vgId:%d restart current task, stage:%"
PRId64
", status:%s, sched-status:%d"
,
id
,
vgId
,
stage
,
qDebug
(
"s-task:%s vgId:%d restart current task, stage:%"
PRId64
", status:%s, sched-status:%d"
,
id
,
vgId
,
stage
,
streamGetTaskStatusStr
(
pTask
->
status
.
taskStatus
),
pTask
->
status
.
schedStatus
);
// 1. stop task
...
...
@@ -544,7 +548,7 @@ int32_t doUpdateTaskEpset(SStreamTask* pTask, int32_t nodeId, SEpSet* pEpSet) {
}
int32_t
streamTaskUpdateEpsetInfo
(
SStreamTask
*
pTask
,
SArray
*
pNodeList
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pNodeList
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pNodeList
);
++
i
)
{
SNodeUpdateInfo
*
pInfo
=
taosArrayGet
(
pNodeList
,
i
);
doUpdateTaskEpset
(
pTask
,
pInfo
->
nodeId
,
&
pInfo
->
newEp
);
}
...
...
@@ -557,7 +561,7 @@ void streamTaskResetUpstreamStageInfo(SStreamTask* pTask) {
}
int32_t
size
=
taosArrayGetSize
(
pTask
->
pUpstreamInfoList
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SStreamChildEpInfo
*
pInfo
=
taosArrayGetP
(
pTask
->
pUpstreamInfoList
,
i
);
pInfo
->
stage
=
-
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录