Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
09b76449
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看板
提交
09b76449
编写于
7月 11, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream): set correct checkpoint version when starting stream tasks.
上级
571cccd7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
23 addition
and
38 deletion
+23
-38
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+1
-1
source/dnode/snode/src/snode.c
source/dnode/snode/src/snode.c
+0
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+4
-6
source/libs/stream/src/streamCheckpoint.c
source/libs/stream/src/streamCheckpoint.c
+1
-1
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+17
-29
未找到文件。
include/libs/stream/tstream.h
浏览文件 @
09b76449
...
@@ -259,7 +259,7 @@ typedef struct SStreamId {
...
@@ -259,7 +259,7 @@ typedef struct SStreamId {
typedef
struct
SCheckpointInfo
{
typedef
struct
SCheckpointInfo
{
int64_t
keptCheckpointId
;
int64_t
keptCheckpointId
;
int64_t
version
;
//
offset in WAL
int64_t
version
;
//
latest checkpointId version
int64_t
currentVer
;
// current offset in WAL, not serialize it
int64_t
currentVer
;
// current offset in WAL, not serialize it
}
SCheckpointInfo
;
}
SCheckpointInfo
;
...
...
source/dnode/snode/src/snode.c
浏览文件 @
09b76449
...
@@ -75,7 +75,6 @@ int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t ver) {
...
@@ -75,7 +75,6 @@ int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t ver) {
pTask
->
inputStatus
=
TASK_INPUT_STATUS__NORMAL
;
pTask
->
inputStatus
=
TASK_INPUT_STATUS__NORMAL
;
pTask
->
outputStatus
=
TASK_OUTPUT_STATUS__NORMAL
;
pTask
->
outputStatus
=
TASK_OUTPUT_STATUS__NORMAL
;
pTask
->
pMsgCb
=
&
pSnode
->
msgCb
;
pTask
->
pMsgCb
=
&
pSnode
->
msgCb
;
pTask
->
chkInfo
.
version
=
ver
;
pTask
->
pMeta
=
pSnode
->
pMeta
;
pTask
->
pMeta
=
pSnode
->
pMeta
;
pTask
->
pState
=
streamStateOpen
(
pSnode
->
path
,
pTask
,
false
,
-
1
,
-
1
);
pTask
->
pState
=
streamStateOpen
(
pSnode
->
path
,
pTask
,
false
,
-
1
,
-
1
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
09b76449
...
@@ -757,7 +757,6 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
...
@@ -757,7 +757,6 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
pTask
->
pMsgCb
=
&
pTq
->
pVnode
->
msgCb
;
pTask
->
pMsgCb
=
&
pTq
->
pVnode
->
msgCb
;
pTask
->
pMeta
=
pTq
->
pStreamMeta
;
pTask
->
pMeta
=
pTq
->
pStreamMeta
;
pTask
->
chkInfo
.
version
=
ver
;
pTask
->
chkInfo
.
currentVer
=
ver
;
pTask
->
chkInfo
.
currentVer
=
ver
;
pTask
->
dataRange
.
range
.
maxVer
=
ver
;
pTask
->
dataRange
.
range
.
maxVer
=
ver
;
...
@@ -855,14 +854,13 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
...
@@ -855,14 +854,13 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
}
}
streamSetupScheduleTrigger
(
pTask
);
streamSetupScheduleTrigger
(
pTask
);
SCheckpointInfo
*
pChkInfo
=
&
pTask
->
chkInfo
;
tqInfo
(
"vgId:%d expand stream task, s-task:%s, checkpoint
v
er:%"
PRId64
tqInfo
(
"vgId:%d expand stream task, s-task:%s, checkpoint
Id:%"
PRId64
" checkpointVer:%"
PRId64
" currentV
er:%"
PRId64
" child id:%d, level:%d, scan-history:%d, trigger:%"
PRId64
" ms"
,
" child id:%d, level:%d, scan-history:%d, trigger:%"
PRId64
" ms"
,
vgId
,
pTask
->
id
.
idStr
,
p
Task
->
chkInfo
.
version
,
pTask
->
info
.
selfChildId
,
pTask
->
info
.
taskLevel
,
vgId
,
pTask
->
id
.
idStr
,
p
ChkInfo
->
keptCheckpointId
,
pChkInfo
->
version
,
pChkInfo
->
currentVer
,
pTask
->
info
.
fillHistory
,
pTask
->
triggerParam
);
pTask
->
info
.
selfChildId
,
pTask
->
info
.
taskLevel
,
pTask
->
info
.
fillHistory
,
pTask
->
triggerParam
);
// next valid version will add one
pTask
->
chkInfo
.
version
+=
1
;
return
0
;
return
0
;
}
}
...
...
source/libs/stream/src/streamCheckpoint.c
浏览文件 @
09b76449
...
@@ -118,7 +118,6 @@ static int32_t streamAlignCheckpoint(SStreamTask* pTask, int64_t checkpointId, i
...
@@ -118,7 +118,6 @@ static int32_t streamAlignCheckpoint(SStreamTask* pTask, int64_t checkpointId, i
int64_t
old
=
atomic_val_compare_exchange_32
(
&
pTask
->
checkpointAlignCnt
,
0
,
num
);
int64_t
old
=
atomic_val_compare_exchange_32
(
&
pTask
->
checkpointAlignCnt
,
0
,
num
);
if
(
old
==
0
)
{
if
(
old
==
0
)
{
qDebug
(
"s-task:%s set initial align upstream num:%d"
,
pTask
->
id
.
idStr
,
num
);
qDebug
(
"s-task:%s set initial align upstream num:%d"
,
pTask
->
id
.
idStr
,
num
);
pTask
->
checkpointingId
=
checkpointId
;
}
}
return
atomic_sub_fetch_32
(
&
pTask
->
checkpointAlignCnt
,
1
);
return
atomic_sub_fetch_32
(
&
pTask
->
checkpointAlignCnt
,
1
);
...
@@ -207,6 +206,7 @@ int32_t streamProcessCheckpointReq(SStreamTask* pTask, SStreamCheckpointReq* pRe
...
@@ -207,6 +206,7 @@ int32_t streamProcessCheckpointReq(SStreamTask* pTask, SStreamCheckpointReq* pRe
int32_t
childId
=
pReq
->
childId
;
int32_t
childId
=
pReq
->
childId
;
// set the task status
// set the task status
pTask
->
checkpointingId
=
checkpointId
;
pTask
->
status
.
taskStatus
=
TASK_STATUS__CK
;
pTask
->
status
.
taskStatus
=
TASK_STATUS__CK
;
ASSERT
(
pTask
->
info
.
taskLevel
==
TASK_LEVEL__AGG
||
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SINK
);
ASSERT
(
pTask
->
info
.
taskLevel
==
TASK_LEVEL__AGG
||
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SINK
);
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
09b76449
...
@@ -295,21 +295,6 @@ int32_t streamBatchExec(SStreamTask* pTask, int32_t batchLimit) {
...
@@ -295,21 +295,6 @@ int32_t streamBatchExec(SStreamTask* pTask, int32_t batchLimit) {
}
}
#endif
#endif
int32_t
updateCheckPointInfo
(
SStreamTask
*
pTask
,
int64_t
checkpointId
)
{
int64_t
ckId
=
0
;
int64_t
dataVer
=
0
;
qGetCheckpointVersion
(
pTask
->
exec
.
pExecutor
,
&
dataVer
,
&
ckId
);
SCheckpointInfo
*
pCkInfo
=
&
pTask
->
chkInfo
;
// qDebug("s-task:%s exec end, start to update check point, ver from %" PRId64 " to %" PRId64 ", checkpointId:%" PRId64
// " -> %" PRId64,
// pTask->id.idStr, pCkInfo->version, dataVer, pCkInfo->keptCheckpointId, checkpointId);
pCkInfo
->
keptCheckpointId
=
checkpointId
;
// pCkInfo->version = dataVer;
return
TSDB_CODE_SUCCESS
;
}
static
void
waitForTaskIdle
(
SStreamTask
*
pTask
,
SStreamTask
*
pStreamTask
)
{
static
void
waitForTaskIdle
(
SStreamTask
*
pTask
,
SStreamTask
*
pStreamTask
)
{
// wait for the stream task to be idle
// wait for the stream task to be idle
int64_t
st
=
taosGetTimestampMs
();
int64_t
st
=
taosGetTimestampMs
();
...
@@ -379,7 +364,7 @@ static int32_t streamTransferStateToStreamTask(SStreamTask* pTask) {
...
@@ -379,7 +364,7 @@ static int32_t streamTransferStateToStreamTask(SStreamTask* pTask) {
}
}
// set input
// set input
static
void
doSetStreamInputBlock
(
SStreamTask
*
pTask
,
const
void
*
pInput
,
int64_t
*
p
Current
Ver
,
const
char
*
id
)
{
static
void
doSetStreamInputBlock
(
SStreamTask
*
pTask
,
const
void
*
pInput
,
int64_t
*
pVer
,
const
char
*
id
)
{
void
*
pExecutor
=
pTask
->
exec
.
pExecutor
;
void
*
pExecutor
=
pTask
->
exec
.
pExecutor
;
const
SStreamQueueItem
*
pItem
=
pInput
;
const
SStreamQueueItem
*
pItem
=
pInput
;
...
@@ -393,8 +378,8 @@ static void doSetStreamInputBlock(SStreamTask* pTask, const void* pInput, int64_
...
@@ -393,8 +378,8 @@ static void doSetStreamInputBlock(SStreamTask* pTask, const void* pInput, int64_
qSetMultiStreamInput
(
pExecutor
,
&
pSubmit
->
submit
,
1
,
STREAM_INPUT__DATA_SUBMIT
);
qSetMultiStreamInput
(
pExecutor
,
&
pSubmit
->
submit
,
1
,
STREAM_INPUT__DATA_SUBMIT
);
qDebug
(
"s-task:%s set submit blocks as source block completed, %p %p len:%d ver:%"
PRId64
,
id
,
pSubmit
,
qDebug
(
"s-task:%s set submit blocks as source block completed, %p %p len:%d ver:%"
PRId64
,
id
,
pSubmit
,
pSubmit
->
submit
.
msgStr
,
pSubmit
->
submit
.
msgLen
,
pSubmit
->
submit
.
ver
);
pSubmit
->
submit
.
msgStr
,
pSubmit
->
submit
.
msgLen
,
pSubmit
->
submit
.
ver
);
ASSERT
((
*
p
Current
Ver
)
<
pSubmit
->
submit
.
ver
);
ASSERT
((
*
pVer
)
<
pSubmit
->
submit
.
ver
);
(
*
p
Current
Ver
)
=
pSubmit
->
submit
.
ver
;
(
*
pVer
)
=
pSubmit
->
submit
.
ver
;
}
else
if
(
pItem
->
type
==
STREAM_INPUT__DATA_BLOCK
||
pItem
->
type
==
STREAM_INPUT__DATA_RETRIEVE
)
{
}
else
if
(
pItem
->
type
==
STREAM_INPUT__DATA_BLOCK
||
pItem
->
type
==
STREAM_INPUT__DATA_RETRIEVE
)
{
const
SStreamDataBlock
*
pBlock
=
(
const
SStreamDataBlock
*
)
pInput
;
const
SStreamDataBlock
*
pBlock
=
(
const
SStreamDataBlock
*
)
pInput
;
...
@@ -412,8 +397,8 @@ static void doSetStreamInputBlock(SStreamTask* pTask, const void* pInput, int64_
...
@@ -412,8 +397,8 @@ static void doSetStreamInputBlock(SStreamTask* pTask, const void* pInput, int64_
qDebug
(
"s-task:%s %p set (merged) submit blocks as a batch, numOfBlocks:%d, ver:%"
PRId64
,
id
,
pTask
,
qDebug
(
"s-task:%s %p set (merged) submit blocks as a batch, numOfBlocks:%d, ver:%"
PRId64
,
id
,
pTask
,
numOfBlocks
,
pMerged
->
ver
);
numOfBlocks
,
pMerged
->
ver
);
qSetMultiStreamInput
(
pExecutor
,
pBlockList
->
pData
,
numOfBlocks
,
STREAM_INPUT__MERGED_SUBMIT
);
qSetMultiStreamInput
(
pExecutor
,
pBlockList
->
pData
,
numOfBlocks
,
STREAM_INPUT__MERGED_SUBMIT
);
ASSERT
((
*
p
Current
Ver
)
<
pMerged
->
ver
);
ASSERT
((
*
pVer
)
<
pMerged
->
ver
);
(
*
p
Current
Ver
)
=
pMerged
->
ver
;
(
*
pVer
)
=
pMerged
->
ver
;
}
else
if
(
pItem
->
type
==
STREAM_INPUT__REF_DATA_BLOCK
)
{
}
else
if
(
pItem
->
type
==
STREAM_INPUT__REF_DATA_BLOCK
)
{
const
SStreamRefDataBlock
*
pRefBlock
=
(
const
SStreamRefDataBlock
*
)
pInput
;
const
SStreamRefDataBlock
*
pRefBlock
=
(
const
SStreamRefDataBlock
*
)
pInput
;
...
@@ -472,8 +457,8 @@ int32_t streamExecForAll(SStreamTask* pTask) {
...
@@ -472,8 +457,8 @@ int32_t streamExecForAll(SStreamTask* pTask) {
const
SStreamQueueItem
*
pItem
=
pInput
;
const
SStreamQueueItem
*
pItem
=
pInput
;
qDebug
(
"s-task:%s start to process batch of blocks, num:%d, type:%d"
,
id
,
batchSize
,
pItem
->
type
);
qDebug
(
"s-task:%s start to process batch of blocks, num:%d, type:%d"
,
id
,
batchSize
,
pItem
->
type
);
int64_t
currentVer
=
pTask
->
chkInfo
.
currentVer
;
int64_t
ver
=
pTask
->
chkInfo
.
version
;
doSetStreamInputBlock
(
pTask
,
pInput
,
&
currentVer
,
id
);
doSetStreamInputBlock
(
pTask
,
pInput
,
&
pTask
->
chkInfo
.
version
,
id
);
int64_t
resSize
=
0
;
int64_t
resSize
=
0
;
int32_t
totalBlocks
=
0
;
int32_t
totalBlocks
=
0
;
...
@@ -484,10 +469,11 @@ int32_t streamExecForAll(SStreamTask* pTask) {
...
@@ -484,10 +469,11 @@ int32_t streamExecForAll(SStreamTask* pTask) {
resSize
/
1048576
.
0
,
totalBlocks
);
resSize
/
1048576
.
0
,
totalBlocks
);
// update the currentVer if processing the submit blocks.
// update the currentVer if processing the submit blocks.
if
(
currentVer
>
pTask
->
chkInfo
.
currentVer
)
{
ASSERT
(
pTask
->
chkInfo
.
version
<=
pTask
->
chkInfo
.
currentVer
&&
ver
<=
pTask
->
chkInfo
.
version
);
qDebug
(
"s-task:%s update currentVer from %"
PRId64
" to %"
PRId64
,
pTask
->
id
.
idStr
,
pTask
->
chkInfo
.
currentVer
,
currentVer
);
if
(
ver
!=
pTask
->
chkInfo
.
version
)
{
pTask
->
chkInfo
.
currentVer
=
currentVer
;
qDebug
(
"s-task:%s update checkpoint ver from %"
PRId64
" to %"
PRId64
,
pTask
->
id
.
idStr
,
ver
,
pTask
->
chkInfo
.
version
);
}
}
int32_t
type
=
pInput
->
type
;
int32_t
type
=
pInput
->
type
;
...
@@ -546,7 +532,7 @@ int32_t streamTryExec(SStreamTask* pTask) {
...
@@ -546,7 +532,7 @@ int32_t streamTryExec(SStreamTask* pTask) {
if
(
remain
==
0
)
{
// all tasks are in TASK_STATUS__CK_READY state
if
(
remain
==
0
)
{
// all tasks are in TASK_STATUS__CK_READY state
streamBackendDoCheckpoint
(
pMeta
,
pTask
->
checkpointingId
);
streamBackendDoCheckpoint
(
pMeta
,
pTask
->
checkpointingId
);
qDebug
(
"vgId:%d do vnode wide checkpoint completed, checkpoint
id:%"
PRId64
""
,
pMeta
->
vgId
,
qDebug
(
"vgId:%d do vnode wide checkpoint completed, checkpoint
Id:%"
PRId64
,
pMeta
->
vgId
,
pTask
->
checkpointingId
);
pTask
->
checkpointingId
);
}
}
...
@@ -574,8 +560,10 @@ int32_t streamTryExec(SStreamTask* pTask) {
...
@@ -574,8 +560,10 @@ int32_t streamTryExec(SStreamTask* pTask) {
taosWUnLockLatch
(
&
pTask
->
pMeta
->
lock
);
taosWUnLockLatch
(
&
pTask
->
pMeta
->
lock
);
}
}
qInfo
(
"vgId:%d s-task:%s commit task status after checkpoint completed, checkpointId:%"
PRId64
", ver:%"
PRId64
,
qInfo
(
"vgId:%d s-task:%s commit task status after checkpoint completed, checkpointId:%"
PRId64
", ver:%"
PRId64
pMeta
->
vgId
,
pTask
->
id
.
idStr
,
pTask
->
chkInfo
.
keptCheckpointId
,
pTask
->
chkInfo
.
version
);
" currentVer:%"
PRId64
,
pMeta
->
vgId
,
pTask
->
id
.
idStr
,
pTask
->
chkInfo
.
keptCheckpointId
,
pTask
->
chkInfo
.
version
,
pTask
->
chkInfo
.
currentVer
);
}
else
{
}
else
{
// todo: let's retry send rsp to upstream/mnode
// todo: let's retry send rsp to upstream/mnode
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录