Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0e189f70
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看板
提交
0e189f70
编写于
8月 12, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor
上级
03c26a9d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
66 addition
and
65 deletion
+66
-65
source/libs/stream/src/stream.c
source/libs/stream/src/stream.c
+0
-65
source/libs/stream/src/streamDispatch.c
source/libs/stream/src/streamDispatch.c
+66
-0
未找到文件。
source/libs/stream/src/stream.c
浏览文件 @
0e189f70
...
...
@@ -306,71 +306,6 @@ int32_t streamProcessDispatchMsg(SStreamTask* pTask, SStreamDispatchReq* pReq, S
// return 0;
//}
// todo record the idle time for dispatch data
int32_t
streamProcessDispatchRsp
(
SStreamTask
*
pTask
,
SStreamDispatchRsp
*
pRsp
,
int32_t
code
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// dispatch message failed: network error, or node not available.
// in case of the input queue is full, the code will be TSDB_CODE_SUCCESS, the and pRsp>inputStatus will be set
// flag. here we need to retry dispatch this message to downstream task immediately. handle the case the failure
// happened too fast. todo handle the shuffle dispatch failure
if
(
code
==
TSDB_CODE_STREAM_TASK_NOT_EXIST
)
{
qError
(
"s-task:%s failed to dispatch msg to task:0x%x, code:%s, no-retry"
,
pTask
->
id
.
idStr
,
pRsp
->
downstreamTaskId
,
tstrerror
(
code
));
return
code
;
}
else
{
qError
(
"s-task:%s failed to dispatch msg to task:0x%x, code:%s, retry cnt:%d"
,
pTask
->
id
.
idStr
,
pRsp
->
downstreamTaskId
,
tstrerror
(
code
),
++
pTask
->
msgInfo
.
retryCount
);
return
doDispatchAllBlocks
(
pTask
,
pTask
->
msgInfo
.
pData
);
}
}
qDebug
(
"s-task:%s receive dispatch rsp, output status:%d code:%d"
,
pTask
->
id
.
idStr
,
pRsp
->
inputStatus
,
code
);
// there are other dispatch message not response yet
if
(
pTask
->
outputInfo
.
type
==
TASK_OUTPUT__SHUFFLE_DISPATCH
)
{
int32_t
leftRsp
=
atomic_sub_fetch_32
(
&
pTask
->
shuffleDispatcher
.
waitingRspCnt
,
1
);
qDebug
(
"s-task:%s is shuffle, left waiting rsp %d"
,
pTask
->
id
.
idStr
,
leftRsp
);
if
(
leftRsp
>
0
)
{
return
0
;
}
}
pTask
->
msgInfo
.
retryCount
=
0
;
ASSERT
(
pTask
->
outputInfo
.
status
==
TASK_OUTPUT_STATUS__WAIT
);
qDebug
(
"s-task:%s output status is set to:%d"
,
pTask
->
id
.
idStr
,
pTask
->
outputInfo
.
status
);
// the input queue of the (down stream) task that receive the output data is full,
// so the TASK_INPUT_STATUS_BLOCKED is rsp
// todo blocking the output status
if
(
pRsp
->
inputStatus
==
TASK_INPUT_STATUS__BLOCKED
)
{
pTask
->
msgInfo
.
blockingTs
=
taosGetTimestampMs
();
// record the blocking start time
int32_t
waitDuration
=
300
;
// 300 ms
qError
(
"s-task:%s inputQ of downstream task:0x%x is full, time:%"
PRId64
"wait for %dms and retry dispatch data"
,
pTask
->
id
.
idStr
,
pRsp
->
downstreamTaskId
,
pTask
->
msgInfo
.
blockingTs
,
waitDuration
);
streamRetryDispatchStreamBlock
(
pTask
,
waitDuration
);
}
else
{
// pipeline send data in output queue
// this message has been sent successfully, let's try next one.
destroyStreamDataBlock
(
pTask
->
msgInfo
.
pData
);
pTask
->
msgInfo
.
pData
=
NULL
;
if
(
pTask
->
msgInfo
.
blockingTs
!=
0
)
{
int64_t
el
=
taosGetTimestampMs
()
-
pTask
->
msgInfo
.
blockingTs
;
qDebug
(
"s-task:%s resume to normal from inputQ blocking, idle time:%"
PRId64
"ms"
,
pTask
->
id
.
idStr
,
el
);
pTask
->
msgInfo
.
blockingTs
=
0
;
}
// now ready for next data output
atomic_store_8
(
&
pTask
->
outputInfo
.
status
,
TASK_OUTPUT_STATUS__NORMAL
);
// otherwise, continue dispatch the first block to down stream task in pipeline
streamDispatchStreamBlock
(
pTask
);
}
return
0
;
}
int32_t
streamProcessRunReq
(
SStreamTask
*
pTask
)
{
if
(
streamTryExec
(
pTask
)
<
0
)
{
return
-
1
;
...
...
source/libs/stream/src/streamDispatch.c
浏览文件 @
0e189f70
...
...
@@ -718,3 +718,69 @@ int32_t streamNotifyUpstreamContinue(SStreamTask* pTask) {
num
);
return
0
;
}
int32_t
streamProcessDispatchRsp
(
SStreamTask
*
pTask
,
SStreamDispatchRsp
*
pRsp
,
int32_t
code
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// dispatch message failed: network error, or node not available.
// in case of the input queue is full, the code will be TSDB_CODE_SUCCESS, the and pRsp>inputStatus will be set
// flag. here we need to retry dispatch this message to downstream task immediately. handle the case the failure
// happened too fast.
// todo handle the shuffle dispatch failure
qError
(
"s-task:%s failed to dispatch msg to task:0x%x, code:%s, retry cnt:%d"
,
pTask
->
id
.
idStr
,
pRsp
->
downstreamTaskId
,
tstrerror
(
code
),
++
pTask
->
msgInfo
.
retryCount
);
int32_t
ret
=
doDispatchAllBlocks
(
pTask
,
pTask
->
msgInfo
.
pData
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
}
return
TSDB_CODE_SUCCESS
;
}
qDebug
(
"s-task:%s recv dispatch rsp, downstream task input status:%d code:%d"
,
pTask
->
id
.
idStr
,
pRsp
->
inputStatus
,
code
);
// there are other dispatch message not response yet
if
(
pTask
->
outputInfo
.
type
==
TASK_OUTPUT__SHUFFLE_DISPATCH
)
{
int32_t
leftRsp
=
atomic_sub_fetch_32
(
&
pTask
->
shuffleDispatcher
.
waitingRspCnt
,
1
);
qDebug
(
"s-task:%s is shuffle, left waiting rsp %d"
,
pTask
->
id
.
idStr
,
leftRsp
);
if
(
leftRsp
>
0
)
{
return
0
;
}
}
pTask
->
msgInfo
.
retryCount
=
0
;
ASSERT
(
pTask
->
outputInfo
.
status
==
TASK_OUTPUT_STATUS__WAIT
);
qDebug
(
"s-task:%s output status is set to:%d"
,
pTask
->
id
.
idStr
,
pTask
->
outputInfo
.
status
);
// the input queue of the (down stream) task that receive the output data is full,
// so the TASK_INPUT_STATUS_BLOCKED is rsp
if
(
pRsp
->
inputStatus
==
TASK_INPUT_STATUS__BLOCKED
)
{
pTask
->
inputStatus
=
TASK_INPUT_STATUS__BLOCKED
;
// block the input of current task, to push pressure to upstream
pTask
->
msgInfo
.
blockingTs
=
taosGetTimestampMs
();
// record the blocking start time
qError
(
"s-task:%s inputQ of downstream task:0x%x is full, time:%"
PRId64
"wait for %dms and retry dispatch data"
,
pTask
->
id
.
idStr
,
pRsp
->
downstreamTaskId
,
pTask
->
msgInfo
.
blockingTs
,
DISPATCH_RETRY_INTERVAL_MS
);
streamRetryDispatchStreamBlock
(
pTask
,
DISPATCH_RETRY_INTERVAL_MS
);
}
else
{
// pipeline send data in output queue
// this message has been sent successfully, let's try next one.
destroyStreamDataBlock
(
pTask
->
msgInfo
.
pData
);
pTask
->
msgInfo
.
pData
=
NULL
;
if
(
pTask
->
msgInfo
.
blockingTs
!=
0
)
{
int64_t
el
=
taosGetTimestampMs
()
-
pTask
->
msgInfo
.
blockingTs
;
qDebug
(
"s-task:%s downstream task:0x%x resume to normal from inputQ blocking, blocking time:%"
PRId64
"ms"
,
pTask
->
id
.
idStr
,
pRsp
->
downstreamTaskId
,
el
);
pTask
->
msgInfo
.
blockingTs
=
0
;
// put data into inputQ of current task is also allowed
pTask
->
inputStatus
=
TASK_INPUT_STATUS__NORMAL
;
}
// now ready for next data output
atomic_store_8
(
&
pTask
->
outputInfo
.
status
,
TASK_OUTPUT_STATUS__NORMAL
);
// otherwise, continue dispatch the first block to down stream task in pipeline
streamDispatchStreamBlock
(
pTask
);
}
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录