Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9c30abf9
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
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看板
You need to sign in or sign up before continuing.
提交
9c30abf9
编写于
7月 07, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream): fix error in generating checkpoint.
上级
4e0b32cd
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
33 addition
and
29 deletion
+33
-29
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+1
-1
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+2
-2
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+17
-12
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+4
-11
source/libs/stream/src/streamCheckpoint.c
source/libs/stream/src/streamCheckpoint.c
+7
-2
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+1
-1
source/libs/stream/src/streamRecover.c
source/libs/stream/src/streamRecover.c
+1
-0
未找到文件。
include/libs/stream/tstream.h
浏览文件 @
9c30abf9
...
@@ -622,7 +622,7 @@ int32_t streamLoadTasks(SStreamMeta* pMeta, int64_t ver);
...
@@ -622,7 +622,7 @@ int32_t streamLoadTasks(SStreamMeta* pMeta, int64_t ver);
// checkpoint
// checkpoint
int32_t
streamProcessCheckpointSourceReq
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
,
SStreamCheckpointSourceReq
*
pReq
);
int32_t
streamProcessCheckpointSourceReq
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
,
SStreamCheckpointSourceReq
*
pReq
);
int32_t
streamProcessCheckpointReq
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
,
SStreamTaskCheckpointReq
*
pReq
);
int32_t
streamProcessCheckpointReq
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
,
SStreamTaskCheckpointReq
*
pReq
);
int32_t
streamProcessCheckpointRsp
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
,
SStreamTaskCheckpointRsp
*
pRsp
);
int32_t
streamProcessCheckpointRsp
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
);
int32_t
streamTaskReleaseState
(
SStreamTask
*
pTask
);
int32_t
streamTaskReleaseState
(
SStreamTask
*
pTask
);
int32_t
streamTaskReloadState
(
SStreamTask
*
pTask
);
int32_t
streamTaskReloadState
(
SStreamTask
*
pTask
);
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
9c30abf9
...
@@ -220,8 +220,8 @@ int tqRegisterPushHandle(STQ* pTq, void* handle, SRpcMsg* pMsg);
...
@@ -220,8 +220,8 @@ int tqRegisterPushHandle(STQ* pTq, void* handle, SRpcMsg* pMsg);
int
tqUnregisterPushHandle
(
STQ
*
pTq
,
void
*
pHandle
);
int
tqUnregisterPushHandle
(
STQ
*
pTq
,
void
*
pHandle
);
int
tqStartStreamTasks
(
STQ
*
pTq
);
// restore all stream tasks after vnode launching completed.
int
tqStartStreamTasks
(
STQ
*
pTq
);
// restore all stream tasks after vnode launching completed.
int32_t
tqProcessStreamCheckPointSourceReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
);
int32_t
tqProcessStreamCheckPointSourceReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
);
int32_t
tqProcessStreamCheckPointReq
(
STQ
*
pTq
,
int64_t
sversion
,
char
*
msg
,
int32_t
msgLen
);
int32_t
tqProcessStreamCheckPointReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
);
int32_t
tqProcessStreamCheckPointRsp
(
STQ
*
pTq
,
int64_t
sversion
,
char
*
msg
,
int32_t
msgLen
);
int32_t
tqProcessStreamCheckPointRsp
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
);
int32_t
tqCheckStreamStatus
(
STQ
*
pTq
);
int32_t
tqCheckStreamStatus
(
STQ
*
pTq
);
int
tqCommit
(
STQ
*
);
int
tqCommit
(
STQ
*
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
9c30abf9
...
@@ -819,6 +819,8 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
...
@@ -819,6 +819,8 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
qSetTaskId
(
pTask
->
exec
.
pExecutor
,
pTask
->
id
.
taskId
,
pTask
->
id
.
streamId
);
qSetTaskId
(
pTask
->
exec
.
pExecutor
,
pTask
->
id
.
taskId
,
pTask
->
id
.
streamId
);
}
}
pTask
->
pRpcMsgList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
// sink
// sink
if
(
pTask
->
outputType
==
TASK_OUTPUT__SMA
)
{
if
(
pTask
->
outputType
==
TASK_OUTPUT__SMA
)
{
pTask
->
smaSink
.
vnode
=
pTq
->
pVnode
;
pTask
->
smaSink
.
vnode
=
pTq
->
pVnode
;
...
@@ -1253,7 +1255,7 @@ int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -1253,7 +1255,7 @@ int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) {
// even in halt status, the data in inputQ must be processed
// even in halt status, the data in inputQ must be processed
int8_t
status
=
pTask
->
status
.
taskStatus
;
int8_t
status
=
pTask
->
status
.
taskStatus
;
if
(
status
==
TASK_STATUS__NORMAL
||
status
==
TASK_STATUS__HALT
)
{
if
(
status
==
TASK_STATUS__NORMAL
||
status
==
TASK_STATUS__HALT
||
status
==
TASK_STATUS__CK
)
{
tqDebug
(
"vgId:%d s-task:%s start to process block from inputQ, last chk point:%"
PRId64
,
vgId
,
pTask
->
id
.
idStr
,
tqDebug
(
"vgId:%d s-task:%s start to process block from inputQ, last chk point:%"
PRId64
,
vgId
,
pTask
->
id
.
idStr
,
pTask
->
chkInfo
.
version
);
pTask
->
chkInfo
.
version
);
streamProcessRunReq
(
pTask
);
streamProcessRunReq
(
pTask
);
...
@@ -1546,14 +1548,14 @@ int32_t tqProcessStreamCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -1546,14 +1548,14 @@ int32_t tqProcessStreamCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg) {
return
code
;
return
code
;
}
}
int32_t
tqProcessStreamCheckPointReq
(
STQ
*
pTq
,
int64_t
sversion
,
char
*
pMsg
,
int32_t
msgLen
)
{
int32_t
tqProcessStreamCheckPointReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
char
*
msg
=
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
));
int32_t
len
=
pMsg
->
contLen
-
sizeof
(
SMsgHead
);
int32_t
code
=
0
;
int32_t
vgId
=
TD_VID
(
pTq
->
pVnode
);
int32_t
vgId
=
TD_VID
(
pTq
->
pVnode
);
SStreamMeta
*
pMeta
=
pTq
->
pStreamMeta
;
SStreamMeta
*
pMeta
=
pTq
->
pStreamMeta
;
char
*
msg
=
POINTER_SHIFT
(
pMsg
,
sizeof
(
SMsgHead
));
int32_t
len
=
msgLen
-
sizeof
(
SMsgHead
);
int32_t
code
=
0
;
SStreamTaskCheckpointReq
req
=
{
0
};
SStreamTaskCheckpointReq
req
=
{
0
};
SDecoder
decoder
;
SDecoder
decoder
;
tDecoderInit
(
&
decoder
,
(
uint8_t
*
)
msg
,
len
);
tDecoderInit
(
&
decoder
,
(
uint8_t
*
)
msg
,
len
);
...
@@ -1574,21 +1576,22 @@ int32_t tqProcessStreamCheckPointReq(STQ* pTq, int64_t sversion, char* pMsg, int
...
@@ -1574,21 +1576,22 @@ int32_t tqProcessStreamCheckPointReq(STQ* pTq, int64_t sversion, char* pMsg, int
streamMetaReleaseTask
(
pMeta
,
pTask
);
streamMetaReleaseTask
(
pMeta
,
pTask
);
return
code
;
return
code
;
FAIL:
FAIL:
return
code
;
return
code
;
}
}
// downstream task has complete the stream task checkpoint procedure
// downstream task has complete the stream task checkpoint procedure
int32_t
tqProcessStreamCheckPointRsp
(
STQ
*
pTq
,
int64_t
sversion
,
char
*
pMsg
,
int32_t
msgLen
)
{
int32_t
tqProcessStreamCheckPointRsp
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
// if this task is an agg task, rsp this message to upstream directly.
// if this task is an agg task, rsp this message to upstream directly.
// if this task is an source task, send source rsp to mnode
// if this task is an source task, send source rsp to mnode
int32_t
vgId
=
TD_VID
(
pTq
->
pVnode
);
int32_t
vgId
=
TD_VID
(
pTq
->
pVnode
);
SStreamMeta
*
pMeta
=
pTq
->
pStreamMeta
;
SStreamMeta
*
pMeta
=
pTq
->
pStreamMeta
;
char
*
msg
=
POINTER_SHIFT
(
pMsg
,
sizeof
(
SMsgHead
));
int32_t
len
=
msgLen
-
sizeof
(
SMsgHead
);
char
*
msg
=
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
));
int32_t
len
=
pMsg
->
contLen
-
sizeof
(
SMsgHead
);
int32_t
code
=
0
;
int32_t
code
=
0
;
SStreamTaskCheckpointRsp
req
=
{
0
};
SStreamTaskCheckpointRsp
req
=
{
0
};
SDecoder
decoder
;
SDecoder
decoder
;
tDecoderInit
(
&
decoder
,
(
uint8_t
*
)
msg
,
len
);
tDecoderInit
(
&
decoder
,
(
uint8_t
*
)
msg
,
len
);
...
@@ -1605,7 +1608,9 @@ int32_t tqProcessStreamCheckPointRsp(STQ* pTq, int64_t sversion, char* pMsg, int
...
@@ -1605,7 +1608,9 @@ int32_t tqProcessStreamCheckPointRsp(STQ* pTq, int64_t sversion, char* pMsg, int
goto
FAIL
;
goto
FAIL
;
}
}
streamProcessCheckpointRsp
(
pMeta
,
pTask
,
&
req
);
tqDebug
(
"vgId:%d s-task:%s received the checkpoint rsp, handle it"
,
vgId
,
pTask
->
id
.
idStr
);
streamProcessCheckpointRsp
(
pMeta
,
pTask
);
streamMetaReleaseTask
(
pMeta
,
pTask
);
streamMetaReleaseTask
(
pMeta
,
pTask
);
return
code
;
return
code
;
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
9c30abf9
...
@@ -497,17 +497,6 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t ver, SRpcMsg
...
@@ -497,17 +497,6 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t ver, SRpcMsg
goto
_err
;
goto
_err
;
}
}
}
break
;
}
break
;
case
TDMT_STREAM_TASK_CHECKPOINT
:
{
if
(
tqProcessStreamCheckPointReq
(
pVnode
->
pTq
,
ver
,
pMsg
->
pCont
,
pMsg
->
contLen
)
<
0
)
{
goto
_err
;
}
}
break
;
case
TDMT_STREAM_TASK_CHECKPOINT_RSP
:
{
if
(
tqProcessStreamCheckPointRsp
(
pVnode
->
pTq
,
ver
,
pMsg
->
pCont
,
pMsg
->
contLen
)
<
0
)
{
goto
_err
;
}
}
break
;
case
TDMT_VND_ALTER_CONFIRM
:
case
TDMT_VND_ALTER_CONFIRM
:
needCommit
=
pVnode
->
config
.
hashChange
;
needCommit
=
pVnode
->
config
.
hashChange
;
if
(
vnodeProcessAlterConfirmReq
(
pVnode
,
ver
,
pReq
,
len
,
pRsp
)
<
0
)
{
if
(
vnodeProcessAlterConfirmReq
(
pVnode
,
ver
,
pReq
,
len
,
pRsp
)
<
0
)
{
...
@@ -684,6 +673,10 @@ int32_t vnodeProcessStreamMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo)
...
@@ -684,6 +673,10 @@ int32_t vnodeProcessStreamMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo)
return
tqProcessTaskRecoverFinishRsp
(
pVnode
->
pTq
,
pMsg
);
return
tqProcessTaskRecoverFinishRsp
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_VND_STREAM_CHECK_POINT_SOURCE
:
case
TDMT_VND_STREAM_CHECK_POINT_SOURCE
:
return
tqProcessStreamCheckPointSourceReq
(
pVnode
->
pTq
,
pMsg
);
return
tqProcessStreamCheckPointSourceReq
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_STREAM_TASK_CHECKPOINT
:
return
tqProcessStreamCheckPointReq
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_STREAM_TASK_CHECKPOINT_RSP
:
return
tqProcessStreamCheckPointRsp
(
pVnode
->
pTq
,
pMsg
);
default:
default:
vError
(
"unknown msg type:%d in stream queue"
,
pMsg
->
msgType
);
vError
(
"unknown msg type:%d in stream queue"
,
pMsg
->
msgType
);
return
TSDB_CODE_APP_ERROR
;
return
TSDB_CODE_APP_ERROR
;
...
...
source/libs/stream/src/streamCheckpoint.c
浏览文件 @
9c30abf9
...
@@ -160,6 +160,9 @@ static int32_t streamTaskDispatchCheckpointMsg(SStreamTask* pTask, uint64_t chec
...
@@ -160,6 +160,9 @@ static int32_t streamTaskDispatchCheckpointMsg(SStreamTask* pTask, uint64_t chec
pTask
->
info
.
nodeId
,
req
.
downstreamTaskId
,
req
.
downstreamNodeId
,
i
);
pTask
->
info
.
nodeId
,
req
.
downstreamTaskId
,
req
.
downstreamNodeId
,
i
);
streamDispatchCheckpointMsg
(
pTask
,
&
req
,
pVgInfo
->
vgId
,
&
pVgInfo
->
epSet
);
streamDispatchCheckpointMsg
(
pTask
,
&
req
,
pVgInfo
->
vgId
,
&
pVgInfo
->
epSet
);
}
}
}
else
{
// no need to dispatch msg to downstream task
qDebug
(
"s-task:%s no down stream task, not dispatch checkpoint msg to downstream"
,
pTask
->
id
.
idStr
);
streamProcessCheckpointRsp
(
NULL
,
pTask
);
}
}
return
0
;
return
0
;
...
@@ -215,7 +218,7 @@ int32_t streamProcessCheckpointReq(SStreamMeta* pMeta, SStreamTask* pTask, SStre
...
@@ -215,7 +218,7 @@ int32_t streamProcessCheckpointReq(SStreamMeta* pMeta, SStreamTask* pTask, SStre
ASSERT
(
pTask
->
info
.
taskLevel
==
TASK_LEVEL__AGG
||
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SINK
);
ASSERT
(
pTask
->
info
.
taskLevel
==
TASK_LEVEL__AGG
||
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SINK
);
if
(
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SINK
)
{
if
(
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SINK
)
{
qDebug
(
"s-task:%s sink task set to checkpoint ready"
,
pTask
->
id
.
idStr
);
qDebug
(
"s-task:%s sink task set to checkpoint ready
, start to send rsp to upstream
"
,
pTask
->
id
.
idStr
);
appendCheckpointIntoInputQ
(
pTask
);
appendCheckpointIntoInputQ
(
pTask
);
streamSchedExec
(
pTask
);
streamSchedExec
(
pTask
);
}
else
{
}
else
{
...
@@ -248,7 +251,7 @@ int32_t streamProcessCheckpointReq(SStreamMeta* pMeta, SStreamTask* pTask, SStre
...
@@ -248,7 +251,7 @@ int32_t streamProcessCheckpointReq(SStreamMeta* pMeta, SStreamTask* pTask, SStre
* All down stream tasks have successfully completed the check point task.
* All down stream tasks have successfully completed the check point task.
* Current stream task is allowed to start to do checkpoint things in ASYNC model.
* Current stream task is allowed to start to do checkpoint things in ASYNC model.
*/
*/
int32_t
streamProcessCheckpointRsp
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
,
SStreamTaskCheckpointRsp
*
pRsp
)
{
int32_t
streamProcessCheckpointRsp
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
)
{
ASSERT
(
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SOURCE
||
pTask
->
info
.
taskLevel
==
TASK_LEVEL__AGG
);
ASSERT
(
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SOURCE
||
pTask
->
info
.
taskLevel
==
TASK_LEVEL__AGG
);
// only when all downstream tasks are send checkpoint rsp, we can start the checkpoint procedure for the agg task
// only when all downstream tasks are send checkpoint rsp, we can start the checkpoint procedure for the agg task
...
@@ -258,6 +261,8 @@ int32_t streamProcessCheckpointRsp(SStreamMeta* pMeta, SStreamTask* pTask, SStre
...
@@ -258,6 +261,8 @@ int32_t streamProcessCheckpointRsp(SStreamMeta* pMeta, SStreamTask* pTask, SStre
pTask
->
id
.
idStr
);
pTask
->
id
.
idStr
);
appendCheckpointIntoInputQ
(
pTask
);
appendCheckpointIntoInputQ
(
pTask
);
streamSchedExec
(
pTask
);
streamSchedExec
(
pTask
);
}
else
{
qDebug
(
"s-task:%s %d downstream tasks are not ready, wait"
,
pTask
->
id
.
idStr
,
notReady
);
}
}
return
0
;
return
0
;
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
9c30abf9
...
@@ -470,7 +470,7 @@ int32_t streamExecForAll(SStreamTask* pTask) {
...
@@ -470,7 +470,7 @@ int32_t streamExecForAll(SStreamTask* pTask) {
}
else
if
(
pItem
->
type
==
STREAM_INPUT__REF_DATA_BLOCK
)
{
}
else
if
(
pItem
->
type
==
STREAM_INPUT__REF_DATA_BLOCK
)
{
const
SStreamRefDataBlock
*
pRefBlock
=
(
const
SStreamRefDataBlock
*
)
pInput
;
const
SStreamRefDataBlock
*
pRefBlock
=
(
const
SStreamRefDataBlock
*
)
pInput
;
qSetMultiStreamInput
(
pExecutor
,
pRefBlock
->
pBlock
,
1
,
STREAM_INPUT__DATA_BLOCK
);
qSetMultiStreamInput
(
pExecutor
,
pRefBlock
->
pBlock
,
1
,
STREAM_INPUT__DATA_BLOCK
);
}
else
if
(
pItem
->
type
==
STREAM_CHECKPOINT
)
{
}
else
if
(
pItem
->
type
==
STREAM_
INPUT__
CHECKPOINT
)
{
const
SStreamCheckpoint
*
pCheckpoint
=
(
const
SStreamCheckpoint
*
)
pInput
;
const
SStreamCheckpoint
*
pCheckpoint
=
(
const
SStreamCheckpoint
*
)
pInput
;
qSetMultiStreamInput
(
pExecutor
,
pCheckpoint
->
pBlock
,
1
,
STREAM_INPUT__CHECKPOINT
);
qSetMultiStreamInput
(
pExecutor
,
pCheckpoint
->
pBlock
,
1
,
STREAM_INPUT__CHECKPOINT
);
}
else
{
}
else
{
...
...
source/libs/stream/src/streamRecover.c
浏览文件 @
9c30abf9
...
@@ -45,6 +45,7 @@ const char* streamGetTaskStatusStr(int32_t status) {
...
@@ -45,6 +45,7 @@ const char* streamGetTaskStatusStr(int32_t status) {
case
TASK_STATUS__HALT
:
return
"halt"
;
case
TASK_STATUS__HALT
:
return
"halt"
;
case
TASK_STATUS__PAUSE
:
return
"paused"
;
case
TASK_STATUS__PAUSE
:
return
"paused"
;
case
TASK_STATUS__CK
:
return
"check-point"
;
case
TASK_STATUS__CK
:
return
"check-point"
;
case
TASK_STATUS__CK_READY
:
return
"check-point-ready"
;
default:
return
""
;
default:
return
""
;
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录