Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
69c9eda7
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看板
提交
69c9eda7
编写于
6月 09, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream): fix race condition.
上级
63ef0459
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
34 addition
and
9 deletion
+34
-9
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+1
-0
source/dnode/mnode/impl/src/mndScheduler.c
source/dnode/mnode/impl/src/mndScheduler.c
+4
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+25
-4
source/libs/stream/src/stream.c
source/libs/stream/src/stream.c
+2
-3
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+2
-2
未找到文件。
include/libs/stream/tstream.h
浏览文件 @
69c9eda7
...
...
@@ -309,6 +309,7 @@ struct SStreamTask {
STaskExec
exec
;
SHistDataRange
dataRange
;
SStreamId
historyTaskId
;
SStreamId
streamTaskId
;
SArray
*
pUpstreamEpInfoList
;
// SArray<SStreamChildEpInfo*>, // children info
int32_t
nextCheckId
;
SArray
*
checkpointInfo
;
// SArray<SStreamCheckpointInfo>
...
...
source/dnode/mnode/impl/src/mndScheduler.c
浏览文件 @
69c9eda7
...
...
@@ -319,6 +319,10 @@ static void setHTasksId(SArray* pTaskList, const SArray* pHTaskList) {
(
*
pStreamTask
)
->
historyTaskId
.
taskId
=
(
*
pHTask
)
->
id
.
taskId
;
(
*
pStreamTask
)
->
historyTaskId
.
streamId
=
(
*
pHTask
)
->
id
.
streamId
;
(
*
pHTask
)
->
streamTaskId
.
taskId
=
(
*
pStreamTask
)
->
id
.
taskId
;
(
*
pHTask
)
->
streamTaskId
.
streamId
=
(
*
pStreamTask
)
->
id
.
streamId
;
mDebug
(
"s-task:0x%x related history task:0x%x"
,
(
*
pStreamTask
)
->
id
.
taskId
,
(
*
pHTask
)
->
id
.
taskId
);
}
}
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
69c9eda7
...
...
@@ -1088,7 +1088,7 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) {
}
// do recovery step 1
tqDebug
(
"s-task:%s start
non-blocking recover stage(step 1) scan
"
,
pTask
->
id
.
idStr
);
tqDebug
(
"s-task:%s start
history data scan stage(step 1)
"
,
pTask
->
id
.
idStr
);
int64_t
st
=
taosGetTimestampMs
();
streamSourceRecoverScanStep1
(
pTask
);
...
...
@@ -1100,10 +1100,31 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) {
}
double
el
=
(
taosGetTimestampMs
()
-
st
)
/
1000
.
0
;
tqDebug
(
"s-task:%s history scan stage(step 1) ended, elapsed time:%.2fs"
,
pTask
->
id
.
idStr
,
el
);
tqDebug
(
"s-task:%s history
data
scan stage(step 1) ended, elapsed time:%.2fs"
,
pTask
->
id
.
idStr
,
el
);
if
(
pTask
->
info
.
fillHistory
)
{
// todo transfer the executor status, and then destroy this stream task
if
(
pTask
->
info
.
fillHistory
)
{
/*
// 1. stop the related stream task, get the current scan wal version of stream task, ver1.
SStreamTask* pStreamTask = streamMetaAcquireTask(pMeta, pTask->streamTaskId.taskId);
if (pStreamTask == NULL) {
// todo handle error
}
pStreamTask->status.taskStatus = TASK_STATUS__PAUSE;
// if it's an source task, extract the last version in wal.
// 2. wait for downstream tasks to completed
// 3. do secondary scan of the history data scan, the time window remain, and the version range is updated to [pTask->dataRange.range.maxVer, ver1]
// 4. 1) transfer the ownership of executor state, 2) update the scan data range for source task.
// 5. resume the related stream task.
*/
}
else
{
// todo update the chkInfo version for current task.
// this task has an associated history stream task, so we need to scan wal from the end version of
...
...
source/libs/stream/src/stream.c
浏览文件 @
69c9eda7
...
...
@@ -264,13 +264,12 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i
}
pTask
->
msgInfo
.
retryCount
=
0
;
int8_t
old
=
atomic_exchange_8
(
&
pTask
->
outputStatus
,
pRsp
->
inputStatus
);
ASSERT
(
old
==
TASK_OUTPUT_STATUS__WAIT
);
ASSERT
(
pTask
->
outputStatus
==
TASK_OUTPUT_STATUS__WAIT
);
qDebug
(
"s-task:%s output status is set to:%d"
,
pTask
->
id
.
idStr
,
pTask
->
outputStatus
);
// the input queue of the (down stream) task that receive the output data is full, so the TASK_INPUT_STATUS_BLOCKED is rsp
if
(
p
Task
->
out
putStatus
==
TASK_INPUT_STATUS__BLOCKED
)
{
if
(
p
Rsp
->
in
putStatus
==
TASK_INPUT_STATUS__BLOCKED
)
{
pTask
->
msgInfo
.
blockingTs
=
taosGetTimestampMs
();
// record the blocking start time
int32_t
waitDuration
=
300
;
// 300 ms
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
69c9eda7
...
...
@@ -440,8 +440,8 @@ int32_t streamExecForAll(SStreamTask* pTask) {
streamTaskExecImpl
(
pTask
,
pInput
,
&
resSize
,
&
totalBlocks
);
double
el
=
(
taosGetTimestampMs
()
-
st
)
/
1000
.
0
;
qDebug
(
"s-task:%s batch of input blocks exec end, elapsed time:%.2fs, result size:%.2fMiB, numOfBlocks:%d"
,
id
,
el
,
resSize
/
1048576
.
0
,
totalBlocks
);
qDebug
(
"s-task:%s batch of
(%d)
input blocks exec end, elapsed time:%.2fs, result size:%.2fMiB, numOfBlocks:%d"
,
id
,
batchSize
,
el
,
resSize
/
1048576
.
0
,
totalBlocks
);
streamFreeQitem
(
pInput
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录