Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a5c19427
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看板
提交
a5c19427
编写于
7月 08, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream): send correct rsp to mnode.
上级
9c30abf9
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
139 addition
and
80 deletion
+139
-80
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+13
-9
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+16
-9
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+3
-0
source/libs/stream/inc/streamInt.h
source/libs/stream/inc/streamInt.h
+2
-2
source/libs/stream/src/streamCheckpoint.c
source/libs/stream/src/streamCheckpoint.c
+8
-6
source/libs/stream/src/streamDispatch.c
source/libs/stream/src/streamDispatch.c
+96
-53
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+1
-1
未找到文件。
include/libs/stream/tstream.h
浏览文件 @
a5c19427
...
...
@@ -474,6 +474,7 @@ typedef struct {
int64_t
checkpointId
;
int32_t
taskId
;
int32_t
nodeId
;
int32_t
mnodeId
;
int64_t
expireTime
;
}
SStreamCheckpointSourceReq
;
...
...
@@ -482,6 +483,7 @@ typedef struct {
int64_t
checkpointId
;
int32_t
taskId
;
int32_t
nodeId
;
int32_t
mnodeId
;
int64_t
expireTime
;
}
SStreamCheckpointSourceRsp
;
...
...
@@ -500,7 +502,7 @@ typedef struct {
int32_t
upstreamTaskId
;
int32_t
upstreamNodeId
;
int32_t
childId
;
}
SStream
Task
CheckpointReq
;
}
SStreamCheckpointReq
;
typedef
struct
{
SMsgHead
msgHead
;
...
...
@@ -511,13 +513,13 @@ typedef struct {
int32_t
upstreamTaskId
;
int32_t
upstreamNodeId
;
int32_t
childId
;
}
SStream
Task
CheckpointRsp
;
}
SStreamCheckpointRsp
;
int32_t
tEncodeStreamCheckpointReq
(
SEncoder
*
pEncoder
,
const
SStream
Task
CheckpointReq
*
pReq
);
int32_t
tDecodeStreamCheckpointReq
(
SDecoder
*
pDecoder
,
SStream
Task
CheckpointReq
*
pReq
);
int32_t
tEncodeStreamCheckpointReq
(
SEncoder
*
pEncoder
,
const
SStreamCheckpointReq
*
pReq
);
int32_t
tDecodeStreamCheckpointReq
(
SDecoder
*
pDecoder
,
SStreamCheckpointReq
*
pReq
);
int32_t
tEncodeStreamCheckpointRsp
(
SEncoder
*
pEncoder
,
const
SStream
Task
CheckpointRsp
*
pRsp
);
int32_t
tDecodeStreamCheckpointRsp
(
SDecoder
*
pDecoder
,
SStream
Task
CheckpointRsp
*
pRsp
);
int32_t
tEncodeStreamCheckpointRsp
(
SEncoder
*
pEncoder
,
const
SStreamCheckpointRsp
*
pRsp
);
int32_t
tDecodeStreamCheckpointRsp
(
SDecoder
*
pDecoder
,
SStreamCheckpointRsp
*
pRsp
);
typedef
struct
{
int64_t
streamId
;
...
...
@@ -613,20 +615,22 @@ SStreamTask* streamMetaAcquireTask(SStreamMeta* pMeta, int32_t taskId);
void
streamMetaReleaseTask
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
);
void
streamMetaRemoveTask
(
SStreamMeta
*
pMeta
,
int32_t
taskId
);
int32_t
streamDoCheckpoint
(
SStreamMeta
*
streamMeta
);
int32_t
streamMetaBegin
(
SStreamMeta
*
pMeta
);
int32_t
streamMetaCommit
(
SStreamMeta
*
pMeta
);
int32_t
streamLoadTasks
(
SStreamMeta
*
pMeta
,
int64_t
ver
);
// checkpoint
int32_t
streamProcessCheckpointSourceReq
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
,
SStreamCheckpointSourceReq
*
pReq
);
int32_t
streamProcessCheckpointReq
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
,
SStream
Task
CheckpointReq
*
pReq
);
int32_t
streamProcessCheckpointReq
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
,
SStreamCheckpointReq
*
pReq
);
int32_t
streamProcessCheckpointRsp
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
);
int32_t
streamTaskReleaseState
(
SStreamTask
*
pTask
);
int32_t
streamTaskReloadState
(
SStreamTask
*
pTask
);
int32_t
streamAddCheckpointSourceRspMsg
(
SStreamCheckpointSourceReq
*
pReq
,
SRpcHandleInfo
*
pRpcInfo
,
SStreamTask
*
pTask
);
int32_t
streamAddCheckpointRspMsg
(
SStreamCheckpointReq
*
pReq
,
SRpcHandleInfo
*
pRpcInfo
,
SStreamTask
*
pTask
);
#ifdef __cplusplus
}
#endif
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
a5c19427
...
...
@@ -819,7 +819,7 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
qSetTaskId
(
pTask
->
exec
.
pExecutor
,
pTask
->
id
.
taskId
,
pTask
->
id
.
streamId
);
}
pTask
->
pRpcMsgList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
pTask
->
pRpcMsgList
=
taosArrayInit
(
4
,
sizeof
(
SRpcMsg
)
);
// sink
if
(
pTask
->
outputType
==
TASK_OUTPUT__SMA
)
{
...
...
@@ -1516,16 +1516,18 @@ int32_t tqProcessStreamCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg) {
// todo handle this bug: task not in ready state.
SStreamTask
*
pTask
=
streamMetaAcquireTask
(
pMeta
,
req
.
taskId
);
if
(
pTask
==
NULL
)
{
tqError
(
"vgId:%d failed to find s-task:0x%x, ignore checkpoint msg. it may have been destroyed already"
,
vgId
,
req
.
taskId
);
tqError
(
"vgId:%d failed to find s-task:0x%x, ignore checkpoint msg. it may have been destroyed already"
,
vgId
,
req
.
taskId
);
goto
FAIL
;
}
// backup the rpchandle for rsp
SRpcMsg
*
pRpcMsg
=
taosMemoryCalloc
(
1
,
sizeof
(
SRpcMsg
));
memcpy
(
pRpcMsg
,
(
SRpcMsg
*
)
pMsg
,
sizeof
(
SRpcMsg
))
;
taosArrayPush
(
pTask
->
pRpcMsgList
,
&
pRpcMsg
);
code
=
streamAddCheckpointSourceRspMsg
(
&
req
,
&
pMsg
->
info
,
pTask
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
FAIL
;
}
// todo: when generating checkpoint, no new tasks are allowed to add into current Vnode
// todo: when generating checkpoint, leader of mnode has transfer to other DNode?
// set the initial value for generating check point
int32_t
total
=
0
;
...
...
@@ -1544,7 +1546,7 @@ int32_t tqProcessStreamCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg) {
streamMetaReleaseTask
(
pMeta
,
pTask
);
return
code
;
FAIL:
FAIL:
return
code
;
}
...
...
@@ -1555,7 +1557,7 @@ int32_t tqProcessStreamCheckPointReq(STQ* pTq, SRpcMsg* pMsg) {
int32_t
vgId
=
TD_VID
(
pTq
->
pVnode
);
SStreamMeta
*
pMeta
=
pTq
->
pStreamMeta
;
SStream
Task
CheckpointReq
req
=
{
0
};
SStreamCheckpointReq
req
=
{
0
};
SDecoder
decoder
;
tDecoderInit
(
&
decoder
,
(
uint8_t
*
)
msg
,
len
);
...
...
@@ -1572,6 +1574,11 @@ int32_t tqProcessStreamCheckPointReq(STQ* pTq, SRpcMsg* pMsg) {
goto
FAIL
;
}
code
=
streamAddCheckpointRspMsg
(
&
req
,
&
pMsg
->
info
,
pTask
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
FAIL
;
}
streamProcessCheckpointReq
(
pMeta
,
pTask
,
&
req
);
streamMetaReleaseTask
(
pMeta
,
pTask
);
return
code
;
...
...
@@ -1591,7 +1598,7 @@ int32_t tqProcessStreamCheckPointRsp(STQ* pTq, SRpcMsg* pMsg) {
int32_t
len
=
pMsg
->
contLen
-
sizeof
(
SMsgHead
);
int32_t
code
=
0
;
SStream
Task
CheckpointRsp
req
=
{
0
};
SStreamCheckpointRsp
req
=
{
0
};
SDecoder
decoder
;
tDecoderInit
(
&
decoder
,
(
uint8_t
*
)
msg
,
len
);
...
...
source/libs/executor/src/executor.c
浏览文件 @
a5c19427
...
...
@@ -165,6 +165,9 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
}
pInfo
->
blockType
=
STREAM_INPUT__DATA_BLOCK
;
}
else
if
(
type
==
STREAM_INPUT__CHECKPOINT
)
{
taosArrayPush
(
pInfo
->
pBlockLists
,
input
);
pInfo
->
blockType
=
STREAM_INPUT__CHECKPOINT
;
}
else
{
ASSERT
(
0
);
}
...
...
source/libs/stream/inc/streamInt.h
浏览文件 @
a5c19427
...
...
@@ -50,9 +50,9 @@ int32_t tEncodeStreamRetrieveReq(SEncoder* pEncoder, const SStreamRetrieveReq* p
int32_t
streamDispatchAllBlocks
(
SStreamTask
*
pTask
,
const
SStreamDataBlock
*
pData
);
int32_t
streamDispatchCheckMsg
(
SStreamTask
*
pTask
,
const
SStreamTaskCheckReq
*
pReq
,
int32_t
nodeId
,
SEpSet
*
pEpSet
);
int32_t
streamDispatchCheckpointMsg
(
SStreamTask
*
pTask
,
const
SStream
Task
CheckpointReq
*
pReq
,
int32_t
nodeId
,
SEpSet
*
pEpSet
);
int32_t
streamDispatchCheckpointMsg
(
SStreamTask
*
pTask
,
const
SStreamCheckpointReq
*
pReq
,
int32_t
nodeId
,
SEpSet
*
pEpSet
);
int32_t
streamTaskSendCheckpointRsp
(
SStreamTask
*
pTask
,
int32_t
vgId
);
int32_t
streamTaskSendCheckpointSourceRsp
(
SStreamTask
*
pTask
,
int32_t
vgId
);
int32_t
streamTaskSendCheckpointSourceRsp
(
SStreamTask
*
pTask
);
int32_t
extractBlocksFromInputQ
(
SStreamTask
*
pTask
,
SStreamQueueItem
**
pInput
,
int32_t
*
numOfBlocks
,
const
char
*
id
);
SStreamQueueItem
*
streamMergeQueueItem
(
SStreamQueueItem
*
dst
,
SStreamQueueItem
*
pElem
);
...
...
source/libs/stream/src/streamCheckpoint.c
浏览文件 @
a5c19427
...
...
@@ -21,6 +21,7 @@ int32_t tEncodeStreamCheckpointSourceReq(SEncoder* pEncoder, const SStreamCheckp
if
(
tEncodeI64
(
pEncoder
,
pReq
->
checkpointId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pReq
->
taskId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pReq
->
nodeId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pReq
->
mnodeId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pReq
->
expireTime
)
<
0
)
return
-
1
;
tEndEncode
(
pEncoder
);
return
pEncoder
->
pos
;
...
...
@@ -32,6 +33,7 @@ int32_t tDecodeStreamCheckpointSourceReq(SDecoder* pDecoder, SStreamCheckpointSo
if
(
tDecodeI64
(
pDecoder
,
&
pReq
->
checkpointId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReq
->
taskId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReq
->
nodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReq
->
mnodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pReq
->
expireTime
)
<
0
)
return
-
1
;
tEndDecode
(
pDecoder
);
return
0
;
...
...
@@ -59,7 +61,7 @@ int32_t tDecodeStreamCheckpointSourceRsp(SDecoder* pDecoder, SStreamCheckpointSo
return
0
;
}
int32_t
tEncodeStreamCheckpointReq
(
SEncoder
*
pEncoder
,
const
SStream
Task
CheckpointReq
*
pReq
)
{
int32_t
tEncodeStreamCheckpointReq
(
SEncoder
*
pEncoder
,
const
SStreamCheckpointReq
*
pReq
)
{
if
(
tStartEncode
(
pEncoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pReq
->
streamId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pReq
->
checkpointId
)
<
0
)
return
-
1
;
...
...
@@ -72,7 +74,7 @@ int32_t tEncodeStreamCheckpointReq(SEncoder* pEncoder, const SStreamTaskCheckpoi
return
pEncoder
->
pos
;
}
int32_t
tDecodeStreamCheckpointReq
(
SDecoder
*
pDecoder
,
SStream
Task
CheckpointReq
*
pReq
)
{
int32_t
tDecodeStreamCheckpointReq
(
SDecoder
*
pDecoder
,
SStreamCheckpointReq
*
pReq
)
{
if
(
tStartDecode
(
pDecoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pReq
->
streamId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pReq
->
checkpointId
)
<
0
)
return
-
1
;
...
...
@@ -85,7 +87,7 @@ int32_t tDecodeStreamCheckpointReq(SDecoder* pDecoder, SStreamTaskCheckpointReq*
return
0
;
}
int32_t
tEncodeStreamCheckpointRsp
(
SEncoder
*
pEncoder
,
const
SStream
Task
CheckpointRsp
*
pRsp
)
{
int32_t
tEncodeStreamCheckpointRsp
(
SEncoder
*
pEncoder
,
const
SStreamCheckpointRsp
*
pRsp
)
{
if
(
tStartEncode
(
pEncoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pRsp
->
streamId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pRsp
->
checkpointId
)
<
0
)
return
-
1
;
...
...
@@ -98,7 +100,7 @@ int32_t tEncodeStreamCheckpointRsp(SEncoder* pEncoder, const SStreamTaskCheckpoi
return
pEncoder
->
pos
;
}
int32_t
tDecodeStreamCheckpointRsp
(
SDecoder
*
pDecoder
,
SStream
Task
CheckpointRsp
*
pRsp
)
{
int32_t
tDecodeStreamCheckpointRsp
(
SDecoder
*
pDecoder
,
SStreamCheckpointRsp
*
pRsp
)
{
if
(
tStartDecode
(
pDecoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pRsp
->
streamId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pRsp
->
checkpointId
)
<
0
)
return
-
1
;
...
...
@@ -124,7 +126,7 @@ static int32_t streamAlignCheckpoint(SStreamTask* pTask, int64_t checkpointId, i
}
static
int32_t
streamTaskDispatchCheckpointMsg
(
SStreamTask
*
pTask
,
uint64_t
checkpointId
)
{
SStream
Task
CheckpointReq
req
=
{
SStreamCheckpointReq
req
=
{
.
streamId
=
pTask
->
id
.
streamId
,
.
upstreamTaskId
=
pTask
->
id
.
taskId
,
.
upstreamNodeId
=
pTask
->
info
.
nodeId
,
...
...
@@ -208,7 +210,7 @@ int32_t streamProcessCheckpointSourceReq(SStreamMeta* pMeta, SStreamTask* pTask,
return
code
;
}
int32_t
streamProcessCheckpointReq
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
,
SStream
Task
CheckpointReq
*
pReq
)
{
int32_t
streamProcessCheckpointReq
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
,
SStreamCheckpointReq
*
pReq
)
{
int32_t
code
;
int64_t
checkpointId
=
pReq
->
checkpointId
;
int32_t
childId
=
pReq
->
childId
;
...
...
source/libs/stream/src/streamDispatch.c
浏览文件 @
a5c19427
...
...
@@ -415,7 +415,7 @@ int32_t streamDispatchStreamBlock(SStreamTask* pTask) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
streamDispatchCheckpointMsg
(
SStreamTask
*
pTask
,
const
SStream
Task
CheckpointReq
*
pReq
,
int32_t
nodeId
,
int32_t
streamDispatchCheckpointMsg
(
SStreamTask
*
pTask
,
const
SStreamCheckpointReq
*
pReq
,
int32_t
nodeId
,
SEpSet
*
pEpSet
)
{
void
*
buf
=
NULL
;
int32_t
code
=
-
1
;
...
...
@@ -476,70 +476,36 @@ int32_t streamDispatchScanHistoryFinishMsg(SStreamTask* pTask) {
// this function is usually invoked by sink/agg task
int32_t
streamTaskSendCheckpointRsp
(
SStreamTask
*
pTask
,
int32_t
vgId
)
{
// int32_t code = 0;
// int32_t len;
//
// // todo set upstreamTaskId Info
// const SStreamTaskCheckpointRsp rsp = {
// .streamId = pTask->id.streamId, .downstreamTaskId = pTask->id.taskId, .downstreamNodeId = vgId};
//
// SEncoder encoder;
// tEncodeSize(tEncodeStreamCheckpointRsp, &rsp, len, code);
// if (code < 0) {
// qError("vgId:%d failed to encode checkpoint rsp, task:0x%x", vgId, rsp.downstreamTaskId);
// return -1;
// }
//
// void* buf = rpcMallocCont(sizeof(SMsgHead) + len);
// ((SMsgHead*)buf)->vgId = htonl(rsp.upstreamNodeId);
//
// void* abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
// tEncoderInit(&encoder, (uint8_t*)abuf, len);
// tEncodeStreamCheckpointRsp(&encoder, &rsp);
// tEncoderClear(&encoder);
int32_t
num
=
taosArrayGetSize
(
pTask
->
pRpcMsgList
);
ASSERT
(
taosArrayGetSize
(
pTask
->
pUpstreamEpInfoList
)
==
num
);
qDebug
(
"s-task:%s level:%d checkpoint completed msg sent to %d upstream tasks"
,
pTask
->
id
.
idStr
,
pTask
->
info
.
taskLevel
,
num
);
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SRpcMsg
*
pMsg
=
taosArrayGet
P
(
pTask
->
pRpcMsgList
,
0
);
SRpcMsg
*
pMsg
=
taosArrayGet
(
pTask
->
pRpcMsgList
,
i
);
tmsgSendRsp
(
pMsg
);
}
int8_t
prev
=
pTask
->
status
.
taskStatus
;
pTask
->
status
.
taskStatus
=
TASK_STATUS__NORMAL
;
qDebug
(
"s-task:%s level:%d source checkpoint completed msg sent to upstream, set status:%s, prev:%s"
,
pTask
->
id
.
idStr
,
pTask
->
info
.
taskLevel
,
streamGetTaskStatusStr
(
pTask
->
status
.
taskStatus
),
streamGetTaskStatusStr
(
prev
));
return
TSDB_CODE_SUCCESS
;
}
// this function is only invoked by source task, and send rsp to mnode
int32_t
streamTaskSendCheckpointSourceRsp
(
SStreamTask
*
pTask
,
int32_t
vgId
)
{
ASSERT
(
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SOURCE
);
// int32_t code = 0;
// int32_t len;
// SEncoder encoder;
// SStreamMeta* pMeta = pTask->pMeta;
// const SStreamCheckpointSourceRsp rsp = {
// .streamId = pTask->id.streamId, .taskId = pTask->id.taskId, .nodeId = vgId, .checkpointId = pMeta->checkpointId};
//
// tEncodeSize(tEncodeStreamCheckpointSourceRsp, &rsp, len, code);
// if (code < 0) {
// qError("vgId:%d failed to encode source checkpoint rsp, task:0x%x", vgId, pTask->id.taskId);
// return -1;
// }
//
// void* buf = rpcMallocCont(sizeof(SMsgHead) + len);
// ((SMsgHead*)buf)->vgId = htonl(rsp.nodeId);
//
// void* abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
// tEncoderInit(&encoder, (uint8_t*)abuf, len);
// tEncodeStreamCheckpointSourceRsp(&encoder, &rsp);
// tEncoderClear(&encoder);
// SRpcMsg rspMsg = *pTask->rpcMsg;
ASSERT
(
taosArrayGetSize
(
pTask
->
pRpcMsgList
)
==
0
);
qDebug
(
"s-task:%s level:%d source checkpoint completed msg sent to mnode"
,
pTask
->
id
.
idStr
,
pTask
->
info
.
taskLevel
);
tmsgSendRsp
(
taosArrayGetP
(
pTask
->
pRpcMsgList
,
0
));
int32_t
streamTaskSendCheckpointSourceRsp
(
SStreamTask
*
pTask
)
{
ASSERT
(
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SOURCE
&&
taosArrayGetSize
(
pTask
->
pRpcMsgList
)
==
1
);
SRpcMsg
*
pMsg
=
taosArrayGet
(
pTask
->
pRpcMsgList
,
0
);
tmsgSendRsp
(
pMsg
);
int8_t
prev
=
pTask
->
status
.
taskStatus
;
pTask
->
status
.
taskStatus
=
TASK_STATUS__NORMAL
;
qDebug
(
"s-task:%s level:%d source checkpoint completed msg sent to mnode, set status:%s, prev:%s"
,
pTask
->
id
.
idStr
,
pTask
->
info
.
taskLevel
,
streamGetTaskStatusStr
(
pTask
->
status
.
taskStatus
),
streamGetTaskStatusStr
(
prev
));
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -759,3 +725,80 @@ void doRetryDispatchData(void* param, void* tmrId) {
streamRetryDispatchStreamBlock
(
pTask
,
DISPATCH_RETRY_INTERVAL_MS
);
}
}
int32_t
streamAddCheckpointSourceRspMsg
(
SStreamCheckpointSourceReq
*
pReq
,
SRpcHandleInfo
*
pRpcInfo
,
SStreamTask
*
pTask
)
{
int32_t
len
=
0
;
int32_t
code
=
0
;
SEncoder
encoder
;
SStreamCheckpointSourceRsp
rsp
=
{
.
checkpointId
=
pReq
->
checkpointId
,
.
taskId
=
pReq
->
taskId
,
.
nodeId
=
pReq
->
nodeId
,
.
streamId
=
pReq
->
streamId
,
.
expireTime
=
pReq
->
expireTime
,
.
mnodeId
=
pReq
->
mnodeId
,
};
tEncodeSize
(
tEncodeStreamCheckpointSourceRsp
,
&
rsp
,
len
,
code
);
if
(
code
<
0
)
{
return
code
;
}
void
*
pBuf
=
rpcMallocCont
(
sizeof
(
SMsgHead
)
+
len
);
if
(
pBuf
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
((
SMsgHead
*
)
pBuf
)
->
vgId
=
htonl
(
pReq
->
mnodeId
);
void
*
abuf
=
POINTER_SHIFT
(
pBuf
,
sizeof
(
SMsgHead
));
tEncoderInit
(
&
encoder
,
(
uint8_t
*
)
abuf
,
len
);
tEncodeStreamCheckpointSourceRsp
(
&
encoder
,
&
rsp
);
tEncoderClear
(
&
encoder
);
SRpcMsg
rspMsg
=
{.
code
=
0
,
.
pCont
=
pBuf
,
.
contLen
=
sizeof
(
SMsgHead
)
+
len
,
.
info
=
*
pRpcInfo
};
taosArrayPush
(
pTask
->
pRpcMsgList
,
&
rspMsg
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
streamAddCheckpointRspMsg
(
SStreamCheckpointReq
*
pReq
,
SRpcHandleInfo
*
pRpcInfo
,
SStreamTask
*
pTask
)
{
int32_t
len
=
0
;
int32_t
code
=
0
;
SEncoder
encoder
;
SStreamCheckpointRsp
rsp
=
{
.
checkpointId
=
pReq
->
checkpointId
,
.
downstreamTaskId
=
pReq
->
downstreamTaskId
,
.
downstreamNodeId
=
pReq
->
downstreamNodeId
,
.
streamId
=
pReq
->
streamId
,
.
upstreamTaskId
=
pReq
->
upstreamTaskId
,
.
upstreamNodeId
=
pReq
->
upstreamNodeId
,
};
tEncodeSize
(
tEncodeStreamCheckpointRsp
,
&
rsp
,
len
,
code
);
if
(
code
<
0
)
{
return
code
;
}
void
*
pBuf
=
rpcMallocCont
(
sizeof
(
SMsgHead
)
+
len
);
if
(
pBuf
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
((
SMsgHead
*
)
pBuf
)
->
vgId
=
htonl
(
pReq
->
upstreamTaskId
);
void
*
abuf
=
POINTER_SHIFT
(
pBuf
,
sizeof
(
SMsgHead
));
tEncoderInit
(
&
encoder
,
(
uint8_t
*
)
abuf
,
len
);
tEncodeStreamCheckpointRsp
(
&
encoder
,
&
rsp
);
tEncoderClear
(
&
encoder
);
SRpcMsg
rspMsg
=
{.
code
=
0
,
.
pCont
=
pBuf
,
.
contLen
=
sizeof
(
SMsgHead
)
+
len
,
.
info
=
*
pRpcInfo
};
taosArrayPush
(
pTask
->
pRpcMsgList
,
&
rspMsg
);
return
TSDB_CODE_SUCCESS
;
}
source/libs/stream/src/streamExec.c
浏览文件 @
a5c19427
...
...
@@ -546,7 +546,7 @@ int32_t streamTryExec(SStreamTask* pTask) {
// send check point response to upstream task
if
(
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SOURCE
)
{
streamTaskSendCheckpointSourceRsp
(
pTask
,
pMeta
->
vgId
);
streamTaskSendCheckpointSourceRsp
(
pTask
);
}
else
{
streamTaskSendCheckpointRsp
(
pTask
,
pMeta
->
vgId
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录