Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d63758a1
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
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看板
提交
d63758a1
编写于
8月 16, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream): fix error in execute task on a tranferred node.
上级
993ae843
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
56 addition
and
16 deletion
+56
-16
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+2
-0
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+13
-7
source/libs/stream/src/streamMeta.c
source/libs/stream/src/streamMeta.c
+4
-0
source/libs/stream/src/streamTask.c
source/libs/stream/src/streamTask.c
+37
-9
未找到文件。
include/libs/stream/tstream.h
浏览文件 @
d63758a1
...
...
@@ -638,6 +638,8 @@ int32_t streamTaskLaunchScanHistory(SStreamTask* pTask);
int32_t
streamTaskCheckStatus
(
SStreamTask
*
pTask
,
int32_t
upstreamTaskId
,
int32_t
vgId
,
int64_t
stage
);
int32_t
streamTaskRestart
(
SStreamTask
*
pTask
,
const
char
*
pDir
,
bool
startTask
);
int32_t
streamTaskUpdateEpsetInfo
(
SStreamTask
*
pTask
,
SArray
*
pNodeList
);
void
streamTaskResetUpstreamStageInfo
(
SStreamTask
*
pTask
);
int32_t
streamTaskStop
(
SStreamTask
*
pTask
);
int32_t
streamSendCheckRsp
(
const
SStreamMeta
*
pMeta
,
const
SStreamTaskCheckReq
*
pReq
,
SStreamTaskCheckRsp
*
pRsp
,
SRpcHandleInfo
*
pRpcInfo
,
int32_t
taskId
);
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
d63758a1
...
...
@@ -530,6 +530,7 @@ static int32_t vnodeSnapshotDoWrite(const SSyncFSM *pFsm, void *pWriter, void *p
static
void
vnodeRestoreFinish
(
const
SSyncFSM
*
pFsm
,
const
SyncIndex
commitIdx
)
{
SVnode
*
pVnode
=
pFsm
->
data
;
int32_t
vgId
=
pVnode
->
config
.
vgId
;
SyncIndex
appliedIdx
=
-
1
;
do
{
...
...
@@ -541,7 +542,7 @@ static void vnodeRestoreFinish(const SSyncFSM *pFsm, const SyncIndex commitIdx)
}
else
{
vInfo
(
"vgId:%d, restore not finish since %"
PRId64
" items to be applied. commit-index:%"
PRId64
", applied-index:%"
PRId64
,
pVnode
->
config
.
vgId
,
commitIdx
-
appliedIdx
,
commitIdx
,
appliedIdx
);
vgId
,
commitIdx
-
appliedIdx
,
commitIdx
,
appliedIdx
);
taosMsleep
(
10
);
}
}
while
(
true
);
...
...
@@ -550,14 +551,19 @@ static void vnodeRestoreFinish(const SSyncFSM *pFsm, const SyncIndex commitIdx)
walApplyVer
(
pVnode
->
pWal
,
commitIdx
);
pVnode
->
restored
=
true
;
vInfo
(
"vgId:%d, sync restore finished, start to restore stream tasks by replay wal"
,
pVnode
->
config
.
vgId
);
// start to restore all stream tasks
if
(
tsDisableStream
)
{
vInfo
(
"vgId:%d, not launch stream tasks, since stream tasks are disabled"
,
pVnode
->
config
.
vgId
);
if
(
vnodeIsRoleLeader
(
pVnode
))
{
vInfo
(
"vgId:%d, sync restore finished, start to launch stream tasks"
,
vgId
);
// start to restore all stream tasks
if
(
tsDisableStream
)
{
vInfo
(
"vgId:%d, not launch stream tasks, since stream tasks are disabled"
,
vgId
);
}
else
{
vInfo
(
"vgId:%d start to launch stream tasks"
,
pVnode
->
config
.
vgId
);
tqCheckStreamStatus
(
pVnode
->
pTq
);
}
}
else
{
vInfo
(
"vgId:%d start to launch stream tasks"
,
pVnode
->
config
.
vgId
);
tqCheckStreamStatus
(
pVnode
->
pTq
);
vInfo
(
"vgId:%d, sync restore finished, no launch stream tasks since not leader"
,
vgId
);
}
}
...
...
source/libs/stream/src/streamMeta.c
浏览文件 @
d63758a1
...
...
@@ -143,6 +143,10 @@ _err:
void
streamMetaClose
(
SStreamMeta
*
pMeta
)
{
qDebug
(
"start to close stream meta"
);
if
(
pMeta
==
NULL
)
{
return
;
}
tdbAbort
(
pMeta
->
db
,
pMeta
->
txn
);
tdbTbClose
(
pMeta
->
pTaskDb
);
tdbTbClose
(
pMeta
->
pCheckpointDb
);
...
...
source/libs/stream/src/streamTask.c
浏览文件 @
d63758a1
...
...
@@ -405,11 +405,15 @@ int32_t streamTaskSetUpstreamInfo(SStreamTask* pTask, const SStreamTask* pUpstre
}
void
streamTaskUpdateUpstreamInfo
(
SStreamTask
*
pTask
,
int32_t
nodeId
,
const
SEpSet
*
pEpSet
)
{
char
buf
[
512
]
=
{
0
};
EPSET_TO_STR
(
pEpSet
,
buf
);
int32_t
numOfUpstream
=
taosArrayGetSize
(
pTask
->
pUpstreamInfoList
);
for
(
int32_t
i
=
0
;
i
<
numOfUpstream
;
++
i
)
{
SStreamChildEpInfo
*
pInfo
=
taosArrayGet
(
pTask
->
pUpstreamInfoList
,
i
);
if
(
pInfo
->
nodeId
==
nodeId
)
{
epsetAssign
(
&
pInfo
->
epSet
,
pEpSet
);
qDebug
(
"s-task:0x%x update the upstreamInfo, nodeId:%d newEpset:%s"
,
pTask
->
id
.
taskId
,
nodeId
,
buf
);
break
;
}
}
...
...
@@ -426,6 +430,9 @@ void streamTaskSetFixedDownstreamInfo(SStreamTask* pTask, const SStreamTask* pDo
}
void
streamTaskUpdateDownstreamInfo
(
SStreamTask
*
pTask
,
int32_t
nodeId
,
const
SEpSet
*
pEpSet
)
{
char
buf
[
512
]
=
{
0
};
EPSET_TO_STR
(
pEpSet
,
buf
);
int8_t
type
=
pTask
->
outputInfo
.
type
;
if
(
type
==
TASK_OUTPUT__SHUFFLE_DISPATCH
)
{
SArray
*
pVgs
=
pTask
->
shuffleDispatcher
.
dbInfo
.
pVgroupInfos
;
...
...
@@ -435,16 +442,16 @@ void streamTaskUpdateDownstreamInfo(SStreamTask* pTask, int32_t nodeId, const SE
SVgroupInfo
*
pVgInfo
=
taosArrayGet
(
pVgs
,
i
);
if
(
pVgInfo
->
vgId
==
nodeId
)
{
pVgInfo
->
epSet
=
*
pEpSet
;
qDebug
(
"s-task:0x%x update the dispatch info, nodeId:%d
"
,
pTask
->
id
.
taskId
,
nodeId
);
epsetAssign
(
&
pVgInfo
->
epSet
,
pEpSet
)
;
qDebug
(
"s-task:0x%x update the dispatch info, nodeId:%d
newEpset:%s"
,
pTask
->
id
.
taskId
,
nodeId
,
buf
);
break
;
}
}
}
else
if
(
type
==
TASK_OUTPUT__FIXED_DISPATCH
)
{
STaskDispatcherFixedEp
*
pDispatcher
=
&
pTask
->
fixedEpDispatcher
;
if
(
pDispatcher
->
nodeId
==
nodeId
)
{
pDispatcher
->
epSet
=
*
pEpSet
;
qDebug
(
"s-task:0x%x update the dispatch info, nodeId:%d
"
,
pTask
->
id
.
taskId
,
nodeId
);
epsetAssign
(
&
pDispatcher
->
epSet
,
pEpSet
)
;
qDebug
(
"s-task:0x%x update the dispatch info, nodeId:%d
newEpSet:%s"
,
pTask
->
id
.
taskId
,
nodeId
,
buf
);
}
}
else
{
// do nothing
...
...
@@ -486,7 +493,12 @@ int32_t streamTaskRestart(SStreamTask* pTask, const char* pDir, bool startTask)
taosArrayClear
(
pTask
->
checkReqIds
);
taosArrayClear
(
pTask
->
pRspMsgList
);
// reset the upstream task stage info
streamTaskResetUpstreamStageInfo
(
pTask
);
pTask
->
status
.
downstreamReady
=
0
;
// todo: handle the case when the task is in fill-history (step 1) phase
streamSetStatusNormal
(
pTask
);
taosWLockLatch
(
&
pTask
->
pMeta
->
lock
);
...
...
@@ -494,20 +506,22 @@ int32_t streamTaskRestart(SStreamTask* pTask, const char* pDir, bool startTask)
streamMetaCommit
(
pTask
->
pMeta
);
taosWUnLockLatch
(
&
pTask
->
pMeta
->
lock
);
// qDebug("s-task:%s reset downstream status and inc stage to be:%d, status:%s, start to check downstream", id,
// pTask->status.stage, streamGetTaskStatusStr(pTask->status.taskStatus));
qDebug
(
"s-task:%s vgId:%d restart completed"
,
pTask
->
id
.
idStr
,
vgId
);
// 3. start to check the downstream status
if
(
startTask
)
{
streamTaskCheckDownstreamTasks
(
pTask
);
}
return
0
;
}
int32_t
doUpdateEpsetInfo
(
SStreamTask
*
pTask
,
int32_t
nodeId
,
SEpSet
*
pEpSet
)
{
int32_t
doUpdateTaskEpset
(
SStreamTask
*
pTask
,
int32_t
nodeId
,
SEpSet
*
pEpSet
)
{
char
buf
[
512
]
=
{
0
};
if
(
pTask
->
info
.
nodeId
==
nodeId
)
{
// execution task should be moved away
epsetAssign
(
&
pTask
->
info
.
epSet
,
pEpSet
);
EPSET_TO_STR
(
pEpSet
,
buf
)
qDebug
(
"s-task:0x%x (vgId:%d) epset is updated %s"
,
pTask
->
id
.
taskId
,
nodeId
,
buf
);
}
// check for the dispath info and the upstream task info
...
...
@@ -527,7 +541,21 @@ int32_t doUpdateEpsetInfo(SStreamTask* pTask, int32_t nodeId, SEpSet* pEpSet) {
int32_t
streamTaskUpdateEpsetInfo
(
SStreamTask
*
pTask
,
SArray
*
pNodeList
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pNodeList
);
++
i
)
{
SNodeUpdateInfo
*
pInfo
=
taosArrayGet
(
pNodeList
,
i
);
doUpdate
EpsetInfo
(
pTask
,
pInfo
->
nodeId
,
&
pInfo
->
newEp
);
doUpdate
TaskEpset
(
pTask
,
pInfo
->
nodeId
,
&
pInfo
->
newEp
);
}
return
0
;
}
void
streamTaskResetUpstreamStageInfo
(
SStreamTask
*
pTask
)
{
if
(
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SOURCE
)
{
return
;
}
int32_t
size
=
taosArrayGetSize
(
pTask
->
pUpstreamInfoList
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SStreamChildEpInfo
*
pInfo
=
taosArrayGetP
(
pTask
->
pUpstreamInfoList
,
i
);
pInfo
->
stage
=
-
1
;
}
qDebug
(
"s-task:%s reset all upstream tasks stage info"
,
pTask
->
id
.
idStr
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录