Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
13543f7d
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看板
提交
13543f7d
编写于
8月 02, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature(stream): handle task update in tq module.
上级
e1e5e9bb
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
70 addition
and
77 deletion
+70
-77
include/common/tmsg.h
include/common/tmsg.h
+0
-14
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+5
-3
source/common/src/tmsg.c
source/common/src/tmsg.c
+0
-18
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+1
-1
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+1
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+55
-39
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+2
-0
source/libs/stream/src/streamDispatch.c
source/libs/stream/src/streamDispatch.c
+6
-2
未找到文件。
include/common/tmsg.h
浏览文件 @
13543f7d
...
@@ -2965,20 +2965,6 @@ typedef struct {
...
@@ -2965,20 +2965,6 @@ typedef struct {
int8_t
reserved
;
int8_t
reserved
;
}
SVPauseStreamTaskRsp
;
}
SVPauseStreamTaskRsp
;
typedef
struct
{
SMsgHead
head
;
int32_t
taskId
;
int32_t
nodeId
;
SEpSet
epset
;
}
SVStreamTaskUpdateReq
;
typedef
struct
{
int8_t
reserved
;
}
SVStreamTaskUpdateRsp
;
int32_t
tSerializeVTaskUpdateReq
(
void
*
buf
,
int32_t
bufLen
,
const
SVStreamTaskUpdateReq
*
pReq
);
int32_t
tDeserializeVTaskUpdateReq
(
void
*
buf
,
int32_t
bufLen
,
SVStreamTaskUpdateReq
*
pReq
);
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_STREAM_FNAME_LEN
];
char
name
[
TSDB_STREAM_FNAME_LEN
];
int8_t
igNotExists
;
int8_t
igNotExists
;
...
...
include/libs/stream/tstream.h
浏览文件 @
13543f7d
...
@@ -551,12 +551,14 @@ int32_t tEncodeCompleteHistoryDataMsg(SEncoder* pEncoder, const SStreamCompleteH
...
@@ -551,12 +551,14 @@ int32_t tEncodeCompleteHistoryDataMsg(SEncoder* pEncoder, const SStreamCompleteH
int32_t
tDecodeCompleteHistoryDataMsg
(
SDecoder
*
pDecoder
,
SStreamCompleteHistoryMsg
*
pReq
);
int32_t
tDecodeCompleteHistoryDataMsg
(
SDecoder
*
pDecoder
,
SStreamCompleteHistoryMsg
*
pReq
);
typedef
struct
{
typedef
struct
{
int64_t
streamId
;
int32_t
taskId
;
int32_t
nodeId
;
int32_t
nodeId
;
SEpSet
epset
;
SEpSet
epset
;
}
SStreamTaskUpdate
Info
;
}
SStreamTaskUpdate
Msg
;
int32_t
tEncodeStreamTaskUpdateMsg
(
SEncoder
*
pEncoder
,
const
SStreamTaskUpdate
Info
*
pMsg
);
int32_t
tEncodeStreamTaskUpdateMsg
(
SEncoder
*
pEncoder
,
const
SStreamTaskUpdate
Msg
*
pMsg
);
int32_t
tDecode
TaskUpdateMsg
(
SDecoder
*
pDecoder
,
SStreamTaskUpdateInfo
*
pMsg
);
int32_t
tDecode
StreamTaskUpdateMsg
(
SDecoder
*
pDecoder
,
SStreamTaskUpdateMsg
*
pMsg
);
typedef
struct
{
typedef
struct
{
int64_t
streamId
;
int64_t
streamId
;
...
...
source/common/src/tmsg.c
浏览文件 @
13543f7d
...
@@ -7919,24 +7919,6 @@ int32_t tDeserializeSMResumeStreamReq(void *buf, int32_t bufLen, SMResumeStreamR
...
@@ -7919,24 +7919,6 @@ int32_t tDeserializeSMResumeStreamReq(void *buf, int32_t bufLen, SMResumeStreamR
return
0
;
return
0
;
}
}
int32_t
tSerializeVTaskUpdateReq
(
void
*
buf
,
int32_t
bufLen
,
const
SVStreamTaskUpdateReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
// if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
// if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
// if (tEncodeI8(&encoder, pReq->igUntreated) < 0) return -1;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeVTaskUpdateReq
(
void
*
buf
,
int32_t
bufLen
,
SVStreamTaskUpdateReq
*
pReq
)
{
return
0
;
}
int32_t
tEncodeMqSubTopicEp
(
void
**
buf
,
const
SMqSubTopicEp
*
pTopicEp
)
{
int32_t
tEncodeMqSubTopicEp
(
void
**
buf
,
const
SMqSubTopicEp
*
pTopicEp
)
{
int32_t
tlen
=
0
;
int32_t
tlen
=
0
;
tlen
+=
taosEncodeString
(
buf
,
pTopicEp
->
topic
);
tlen
+=
taosEncodeString
(
buf
,
pTopicEp
->
topic
);
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
13543f7d
...
@@ -1728,7 +1728,7 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) {
...
@@ -1728,7 +1728,7 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) {
}
}
static
int32_t
doBuildStreamTaskUpdateMsg
(
void
**
pBuf
,
int32_t
*
pLen
,
int32_t
nodeId
,
const
SEpSet
*
pEpset
)
{
static
int32_t
doBuildStreamTaskUpdateMsg
(
void
**
pBuf
,
int32_t
*
pLen
,
int32_t
nodeId
,
const
SEpSet
*
pEpset
)
{
SStreamTaskUpdate
Info
req
=
{
0
};
SStreamTaskUpdate
Msg
req
=
{
0
};
req
.
nodeId
=
nodeId
;
req
.
nodeId
=
nodeId
;
req
.
epset
=
*
pEpset
;
req
.
epset
=
*
pEpset
;
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
13543f7d
...
@@ -223,6 +223,7 @@ int tqUnregisterPushHandle(STQ* pTq, void* pHandle);
...
@@ -223,6 +223,7 @@ 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
tqProcessStreamTaskCheckpointReadyMsg
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
);
int32_t
tqProcessStreamTaskCheckpointReadyMsg
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
);
int32_t
tqProcessTaskUpdateReq
(
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
浏览文件 @
13543f7d
...
@@ -1739,7 +1739,7 @@ int32_t tqProcessStreamCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -1739,7 +1739,7 @@ int32_t tqProcessStreamCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg) {
}
}
tDecoderClear
(
&
decoder
);
tDecoderClear
(
&
decoder
);
// todo handle th
is bug: task not in ready state
.
// todo handle th
e case when the task not in ready state, and the checkpoint msg is arrived
.
SStreamTask
*
pTask
=
streamMetaAcquireTask
(
pMeta
,
req
.
taskId
);
SStreamTask
*
pTask
=
streamMetaAcquireTask
(
pMeta
,
req
.
taskId
);
if
(
pTask
==
NULL
)
{
if
(
pTask
==
NULL
)
{
tqError
(
"vgId:%d failed to find s-task:0x%x, ignore checkpoint msg. it may have been destroyed already"
,
vgId
,
tqError
(
"vgId:%d failed to find s-task:0x%x, ignore checkpoint msg. it may have been destroyed already"
,
vgId
,
...
@@ -1811,43 +1811,59 @@ int32_t tqProcessStreamTaskCheckpointReadyMsg(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -1811,43 +1811,59 @@ int32_t tqProcessStreamTaskCheckpointReadyMsg(STQ* pTq, SRpcMsg* pMsg) {
return
code
;
return
code
;
}
}
int32_t
tqProcessTaskUpdateReq
(
STQ
*
pTq
,
int64_t
sversion
,
char
*
msg
,
int32_t
msgLen
)
{
int32_t
tqProcessTaskUpdateReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
// SStreamTaskUpdateInfo* pReq = (SVPauseStreamTaskReq*)msg;
int32_t
vgId
=
TD_VID
(
pTq
->
pVnode
);
//
SStreamMeta
*
pMeta
=
pTq
->
pStreamMeta
;
// SStreamMeta* pMeta = pTq->pStreamMeta;
char
*
msg
=
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
));
// SStreamTask* pTask = streamMetaAcquireTask(pMeta, pReq->taskId);
int32_t
len
=
pMsg
->
contLen
-
sizeof
(
SMsgHead
);
// if (pTask == NULL) {
int32_t
code
=
0
;
// tqError("vgId:%d failed to acquire task:0x%x, it may have been dropped already", pMeta->vgId,
// pReq->taskId);
SStreamTaskUpdateMsg
req
=
{
0
};
//
// // since task is in [STOP|DROPPING] state, it is safe to assume the pause is active
SDecoder
decoder
;
// return TSDB_CODE_SUCCESS;
tDecoderInit
(
&
decoder
,
(
uint8_t
*
)
msg
,
len
);
// }
if
(
tDecodeStreamTaskUpdateMsg
(
&
decoder
,
&
req
)
<
0
)
{
//
code
=
TSDB_CODE_MSG_DECODE_ERROR
;
// tqDebug("s-task:%s receive pause msg from mnode", pTask->id.idStr);
tDecoderClear
(
&
decoder
);
// streamTaskPause(pTask);
tqError
(
"vgId:%d failed to decode task update msg, code:%s"
,
vgId
,
tstrerror
(
code
));
//
return
code
;
// SStreamTask* pHistoryTask = NULL;
}
// if (pTask->historyTaskId.taskId != 0) {
tDecoderClear
(
&
decoder
);
// pHistoryTask = streamMetaAcquireTask(pMeta, pTask->historyTaskId.taskId);
// if (pHistoryTask == NULL) {
SStreamTask
*
pTask
=
streamMetaAcquireTask
(
pMeta
,
req
.
taskId
);
// tqError("vgId:%d failed to acquire fill-history task:0x%x, it may have been dropped already. Pause success",
if
(
pTask
==
NULL
)
{
// pMeta->vgId, pTask->historyTaskId.taskId);
tqError
(
"vgId:%d failed to acquire task:0x%x when handling update, it may have been dropped already"
,
pMeta
->
vgId
,
//
req
.
taskId
);
// streamMetaReleaseTask(pMeta, pTask);
// since task is in [STOP|DROPPING] state, it is safe to assume the pause is active
//
return
TSDB_CODE_SUCCESS
;
// // since task is in [STOP|DROPPING] state, it is safe to assume the pause is active
}
// return TSDB_CODE_SUCCESS;
// }
tqDebug
(
"s-task:%s receive pause msg from mnode"
,
pTask
->
id
.
idStr
);
//
// streamTaskUpdateEpInfo(pTask);
// tqDebug("s-task:%s fill-history task handle paused along with related stream task", pHistoryTask->id.idStr);
// streamTaskPause(pHistoryTask);
SStreamTask
*
pHistoryTask
=
NULL
;
// }
if
(
pTask
->
historyTaskId
.
taskId
!=
0
)
{
//
pHistoryTask
=
streamMetaAcquireTask
(
pMeta
,
pTask
->
historyTaskId
.
taskId
);
// streamMetaReleaseTask(pMeta, pTask);
if
(
pHistoryTask
==
NULL
)
{
// if (pHistoryTask != NULL) {
tqError
(
// streamMetaReleaseTask(pMeta, pHistoryTask);
"vgId:%d failed to acquire fill-history task:0x%x when handling task update, it may have been dropped "
// }
"already"
,
//
pMeta
->
vgId
,
pTask
->
historyTaskId
.
taskId
);
streamMetaReleaseTask
(
pMeta
,
pTask
);
// since task is in [STOP|DROPPING] state, it is safe to assume the pause is active
return
TSDB_CODE_SUCCESS
;
}
tqDebug
(
"s-task:%s fill-history task handle task update along with related stream task"
,
pHistoryTask
->
id
.
idStr
);
// streamTaskUpdateEpInfo(pHistoryTask);
}
streamMetaReleaseTask
(
pMeta
,
pTask
);
if
(
pHistoryTask
!=
NULL
)
{
streamMetaReleaseTask
(
pMeta
,
pHistoryTask
);
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
13543f7d
...
@@ -665,6 +665,8 @@ int32_t vnodeProcessStreamMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo)
...
@@ -665,6 +665,8 @@ int32_t vnodeProcessStreamMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo)
return
tqProcessTaskScanHistoryFinishRsp
(
pVnode
->
pTq
,
pMsg
);
return
tqProcessTaskScanHistoryFinishRsp
(
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_VND_STREAM_TASK_UPDATE
:
return
tqProcessTaskUpdateReq
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_STREAM_TASK_CHECKPOINT_READY
:
case
TDMT_STREAM_TASK_CHECKPOINT_READY
:
return
tqProcessStreamTaskCheckpointReadyMsg
(
pVnode
->
pTq
,
pMsg
);
return
tqProcessStreamTaskCheckpointReadyMsg
(
pVnode
->
pTq
,
pMsg
);
default:
default:
...
...
source/libs/stream/src/streamDispatch.c
浏览文件 @
13543f7d
...
@@ -959,16 +959,20 @@ int32_t streamNotifyUpstreamContinue(SStreamTask* pTask) {
...
@@ -959,16 +959,20 @@ int32_t streamNotifyUpstreamContinue(SStreamTask* pTask) {
return
0
;
return
0
;
}
}
int32_t
tEncodeStreamTaskUpdateMsg
(
SEncoder
*
pEncoder
,
const
SStreamTaskUpdate
Info
*
pMsg
)
{
int32_t
tEncodeStreamTaskUpdateMsg
(
SEncoder
*
pEncoder
,
const
SStreamTaskUpdate
Msg
*
pMsg
)
{
if
(
tStartEncode
(
pEncoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
pEncoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pMsg
->
streamId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pMsg
->
taskId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pMsg
->
nodeId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pMsg
->
nodeId
)
<
0
)
return
-
1
;
if
(
tEncodeSEpSet
(
pEncoder
,
&
pMsg
->
epset
)
<
0
)
return
-
1
;
if
(
tEncodeSEpSet
(
pEncoder
,
&
pMsg
->
epset
)
<
0
)
return
-
1
;
tEndEncode
(
pEncoder
);
tEndEncode
(
pEncoder
);
return
pEncoder
->
pos
;
return
pEncoder
->
pos
;
}
}
int32_t
tDecode
TaskUpdateMsg
(
SDecoder
*
pDecoder
,
SStreamTaskUpdateInfo
*
pMsg
)
{
int32_t
tDecode
StreamTaskUpdateMsg
(
SDecoder
*
pDecoder
,
SStreamTaskUpdateMsg
*
pMsg
)
{
if
(
tStartDecode
(
pDecoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pDecoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pMsg
->
streamId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pMsg
->
taskId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pMsg
->
nodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pMsg
->
nodeId
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
pDecoder
,
&
pMsg
->
epset
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
pDecoder
,
&
pMsg
->
epset
)
<
0
)
return
-
1
;
tEndDecode
(
pDecoder
);
tEndDecode
(
pDecoder
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录