Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6f2fc4fa
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
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看板
提交
6f2fc4fa
编写于
7月 12, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream): commit task meta after do vnode-wide checkpoint.
上级
09b76449
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
38 addition
and
25 deletion
+38
-25
source/libs/executor/src/dataDispatcher.c
source/libs/executor/src/dataDispatcher.c
+2
-2
source/libs/stream/inc/streamInt.h
source/libs/stream/inc/streamInt.h
+1
-0
source/libs/stream/src/streamCheckpoint.c
source/libs/stream/src/streamCheckpoint.c
+29
-0
source/libs/stream/src/streamData.c
source/libs/stream/src/streamData.c
+1
-0
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+5
-23
未找到文件。
source/libs/executor/src/dataDispatcher.c
浏览文件 @
6f2fc4fa
...
@@ -54,8 +54,8 @@ typedef struct SDataDispatchHandle {
...
@@ -54,8 +54,8 @@ typedef struct SDataDispatchHandle {
// clang-format off
// clang-format off
// data format:
// data format:
// +----------------+------------------+--------------+--------------+------------------+--------------------------------------------+------------------------------------+-------------+-----------+-------------+-----------+
// +----------------+------------------+--------------+--------------+------------------+--------------------------------------------+------------------------------------+-------------+-----------+-------------+-----------+
// |SDataCacheEntry | version | total length | numOfRows | group id | col1_schema | col2_schema | col3_schema... | column#1 length, column#2 length...| col1 bitmap | col1 data | col2 bitmap | col2 data |
.... | | (4 bytes) |(8 bytes)
// |SDataCacheEntry | version | total length | numOfRows | group id | col1_schema | col2_schema | col3_schema... | column#1 length, column#2 length...| col1 bitmap | col1 data | col2 bitmap | col2 data |
// | | sizeof(int32_t) |sizeof(int32) | sizeof(int32)| sizeof(uint64_t) | (sizeof(int8_t)+sizeof(int32_t))*numOfCols | sizeof(int32_t) * numOfCols | actual size | |
// | | sizeof(int32_t) |sizeof(int32) | sizeof(int32)| sizeof(uint64_t) | (sizeof(int8_t)+sizeof(int32_t))*numOfCols | sizeof(int32_t) * numOfCols | actual size | |
|
// +----------------+------------------+--------------+--------------+------------------+--------------------------------------------+------------------------------------+-------------+-----------+-------------+-----------+
// +----------------+------------------+--------------+--------------+------------------+--------------------------------------------+------------------------------------+-------------+-----------+-------------+-----------+
// The length of bitmap is decided by number of rows of this data block, and the length of each column data is
// The length of bitmap is decided by number of rows of this data block, and the length of each column data is
// recorded in the first segment, next to the struct header
// recorded in the first segment, next to the struct header
...
...
source/libs/stream/inc/streamInt.h
浏览文件 @
6f2fc4fa
...
@@ -53,6 +53,7 @@ int32_t streamDispatchCheckMsg(SStreamTask* pTask, const SStreamTaskCheckReq* pR
...
@@ -53,6 +53,7 @@ int32_t streamDispatchCheckMsg(SStreamTask* pTask, const SStreamTaskCheckReq* pR
int32_t
streamDispatchCheckpointMsg
(
SStreamTask
*
pTask
,
const
SStreamCheckpointReq
*
pReq
,
int32_t
nodeId
,
SEpSet
*
pEpSet
);
int32_t
streamDispatchCheckpointMsg
(
SStreamTask
*
pTask
,
const
SStreamCheckpointReq
*
pReq
,
int32_t
nodeId
,
SEpSet
*
pEpSet
);
int32_t
streamTaskSendCheckpointRsp
(
SStreamTask
*
pTask
);
int32_t
streamTaskSendCheckpointRsp
(
SStreamTask
*
pTask
);
int32_t
streamTaskSendCheckpointSourceRsp
(
SStreamTask
*
pTask
);
int32_t
streamTaskSendCheckpointSourceRsp
(
SStreamTask
*
pTask
);
int32_t
streamSaveTasks
(
SStreamMeta
*
pMeta
,
int64_t
checkpointId
);
int32_t
extractBlocksFromInputQ
(
SStreamTask
*
pTask
,
SStreamQueueItem
**
pInput
,
int32_t
*
numOfBlocks
,
const
char
*
id
);
int32_t
extractBlocksFromInputQ
(
SStreamTask
*
pTask
,
SStreamQueueItem
**
pInput
,
int32_t
*
numOfBlocks
,
const
char
*
id
);
SStreamQueueItem
*
streamMergeQueueItem
(
SStreamQueueItem
*
dst
,
SStreamQueueItem
*
pElem
);
SStreamQueueItem
*
streamMergeQueueItem
(
SStreamQueueItem
*
dst
,
SStreamQueueItem
*
pElem
);
...
...
source/libs/stream/src/streamCheckpoint.c
浏览文件 @
6f2fc4fa
...
@@ -262,3 +262,32 @@ int32_t streamProcessCheckpointRsp(SStreamMeta* pMeta, SStreamTask* pTask) {
...
@@ -262,3 +262,32 @@ int32_t streamProcessCheckpointRsp(SStreamMeta* pMeta, SStreamTask* pTask) {
return
0
;
return
0
;
}
}
int32_t
streamSaveTasks
(
SStreamMeta
*
pMeta
,
int64_t
checkpointId
)
{
taosWLockLatch
(
&
pMeta
->
lock
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pMeta
->
pTaskList
);
++
i
)
{
uint32_t
*
pTaskId
=
taosArrayGet
(
pMeta
->
pTaskList
,
i
);
SStreamTask
*
p
=
*
(
SStreamTask
**
)
taosHashGet
(
pMeta
->
pTasks
,
pTaskId
,
sizeof
(
*
pTaskId
));
ASSERT
(
p
->
chkInfo
.
keptCheckpointId
<
p
->
checkpointingId
&&
p
->
checkpointingId
==
checkpointId
);
p
->
chkInfo
.
keptCheckpointId
=
p
->
checkpointingId
;
streamMetaSaveTask
(
pMeta
,
p
);
qDebug
(
"vgId:%d s-task:%s commit task status after checkpoint completed, checkpointId:%"
PRId64
", ver:%"
PRId64
" currentVer:%"
PRId64
,
pMeta
->
vgId
,
p
->
id
.
idStr
,
checkpointId
,
p
->
chkInfo
.
version
,
p
->
chkInfo
.
currentVer
);
}
if
(
streamMetaCommit
(
pMeta
)
<
0
)
{
taosWUnLockLatch
(
&
pMeta
->
lock
);
qError
(
"vgId:%d failed to commit stream meta after do checkpoint, checkpointId:%"
PRId64
", since %s"
,
pMeta
->
vgId
,
checkpointId
,
terrstr
());
return
-
1
;
}
else
{
taosWUnLockLatch
(
&
pMeta
->
lock
);
qInfo
(
"vgId:%d commit stream meta after do checkpoint, checkpointId:%. DONE"
PRId64
,
pMeta
->
vgId
,
checkpointId
);
}
return
TSDB_CODE_SUCCESS
;
}
source/libs/stream/src/streamData.c
浏览文件 @
6f2fc4fa
...
@@ -120,6 +120,7 @@ SStreamDataSubmit* streamDataSubmitNew(SPackedData* pData, int32_t type) {
...
@@ -120,6 +120,7 @@ SStreamDataSubmit* streamDataSubmitNew(SPackedData* pData, int32_t type) {
return
NULL
;
return
NULL
;
}
}
pDataSubmit
->
ver
=
pData
->
ver
;
pDataSubmit
->
submit
=
*
pData
;
pDataSubmit
->
submit
=
*
pData
;
*
pDataSubmit
->
dataRef
=
1
;
// initialize the reference count to be 1
*
pDataSubmit
->
dataRef
=
1
;
// initialize the reference count to be 1
pDataSubmit
->
type
=
type
;
pDataSubmit
->
type
=
type
;
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
6f2fc4fa
...
@@ -532,7 +532,8 @@ int32_t streamTryExec(SStreamTask* pTask) {
...
@@ -532,7 +532,8 @@ 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, checkpointId:%"
PRId64
,
pMeta
->
vgId
,
streamSaveTasks
(
pMeta
,
pTask
->
checkpointingId
);
qDebug
(
"vgId:%d vnode wide checkpoint completed, save all tasks status, checkpointId:%"
PRId64
,
pMeta
->
vgId
,
pTask
->
checkpointingId
);
pTask
->
checkpointingId
);
}
}
...
@@ -543,29 +544,10 @@ int32_t streamTryExec(SStreamTask* pTask) {
...
@@ -543,29 +544,10 @@ int32_t streamTryExec(SStreamTask* pTask) {
code
=
streamTaskSendCheckpointRsp
(
pTask
);
code
=
streamTaskSendCheckpointRsp
(
pTask
);
}
}
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
taosWLockLatch
(
&
pTask
->
pMeta
->
lock
);
ASSERT
(
pTask
->
chkInfo
.
keptCheckpointId
<
pTask
->
checkpointingId
);
pTask
->
chkInfo
.
keptCheckpointId
=
pTask
->
checkpointingId
;
streamMetaSaveTask
(
pTask
->
pMeta
,
pTask
);
if
(
streamMetaCommit
(
pTask
->
pMeta
)
<
0
)
{
taosWUnLockLatch
(
&
pTask
->
pMeta
->
lock
);
qError
(
"s-task:%s failed to commit stream meta after do checkpoint, checkpointId:%"
PRId64
", ver:%"
PRId64
", since %s"
,
pTask
->
id
.
idStr
,
pTask
->
chkInfo
.
keptCheckpointId
,
pTask
->
chkInfo
.
version
,
terrstr
());
return
-
1
;
}
else
{
taosWUnLockLatch
(
&
pTask
->
pMeta
->
lock
);
}
qInfo
(
"vgId:%d s-task:%s commit task status after checkpoint completed, checkpointId:%"
PRId64
", ver:%"
PRId64
" currentVer:%"
PRId64
,
pMeta
->
vgId
,
pTask
->
id
.
idStr
,
pTask
->
chkInfo
.
keptCheckpointId
,
pTask
->
chkInfo
.
version
,
pTask
->
chkInfo
.
currentVer
);
}
else
{
// todo: let's retry send rsp to upstream/mnode
// todo: let's retry send rsp to upstream/mnode
qError
(
"s-task:%s failed to send checkpoint rsp to upstream, checkpointId:%"
PRId64
", code:%s"
,
pTask
->
id
.
idStr
,
pTask
->
checkpointingId
,
tstrerror
(
code
));
}
}
}
else
{
}
else
{
if
(
!
taosQueueEmpty
(
pTask
->
inputQueue
->
queue
)
&&
(
!
streamTaskShouldStop
(
&
pTask
->
status
))
&&
if
(
!
taosQueueEmpty
(
pTask
->
inputQueue
->
queue
)
&&
(
!
streamTaskShouldStop
(
&
pTask
->
status
))
&&
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录