Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e263d5f5
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看板
提交
e263d5f5
编写于
7月 10, 2023
作者:
Y
yihaoDeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add checkpoint
上级
4d838d3d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
25 deletion
+25
-25
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+2
-2
source/libs/stream/src/stream.c
source/libs/stream/src/stream.c
+21
-22
source/libs/stream/src/streamCheckpoint.c
source/libs/stream/src/streamCheckpoint.c
+2
-1
未找到文件。
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
e263d5f5
...
@@ -885,7 +885,7 @@ static int32_t mndProcessStreamCheckpointTmr(SRpcMsg *pReq) {
...
@@ -885,7 +885,7 @@ static int32_t mndProcessStreamCheckpointTmr(SRpcMsg *pReq) {
return
0
;
return
0
;
}
}
int64_t
checkpointId
=
t
GenIdPI64
();
int64_t
checkpointId
=
t
aosGetTimestampMs
();
SMStreamDoCheckpointMsg
*
pMsg
=
rpcMallocCont
(
sizeof
(
SMStreamDoCheckpointMsg
));
SMStreamDoCheckpointMsg
*
pMsg
=
rpcMallocCont
(
sizeof
(
SMStreamDoCheckpointMsg
));
pMsg
->
checkpointId
=
checkpointId
;
pMsg
->
checkpointId
=
checkpointId
;
...
@@ -994,7 +994,7 @@ static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStre
...
@@ -994,7 +994,7 @@ static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStre
mndTransDrop
(
pTrans
);
mndTransDrop
(
pTrans
);
return
-
1
;
return
-
1
;
}
}
mDebug
(
"start to trigger checkpoint for stream:%s
"
,
pStream
->
name
);
mDebug
(
"start to trigger checkpoint for stream:%s
, checkpoint: %"
PRId64
""
,
pStream
->
name
,
checkpointId
);
atomic_store_64
(
&
pStream
->
currentTick
,
1
);
atomic_store_64
(
&
pStream
->
currentTick
,
1
);
taosWLockLatch
(
&
pStream
->
lock
);
taosWLockLatch
(
&
pStream
->
lock
);
// 1. redo action: broadcast checkpoint source msg for all source vg
// 1. redo action: broadcast checkpoint source msg for all source vg
...
...
source/libs/stream/src/stream.c
浏览文件 @
e263d5f5
...
@@ -16,10 +16,10 @@
...
@@ -16,10 +16,10 @@
#include "streamInt.h"
#include "streamInt.h"
#include "ttimer.h"
#include "ttimer.h"
#define STREAM_TASK_INPUT_QUEUE_CAPACITY
20480
#define STREAM_TASK_INPUT_QUEUE_CAPACITY 20480
#define STREAM_TASK_INPUT_QUEUE_CAPACITY_IN_SIZE
(30)
#define STREAM_TASK_INPUT_QUEUE_CAPACITY_IN_SIZE (30)
#define ONE_MB_F
(1048576.0)
#define ONE_MB_F (1048576.0)
#define QUEUE_MEM_SIZE_IN_MB(_q)
(taosQueueMemorySize(_q) / ONE_MB_F)
#define QUEUE_MEM_SIZE_IN_MB(_q) (taosQueueMemorySize(_q) / ONE_MB_F)
SStreamGlobalEnv
streamEnv
;
SStreamGlobalEnv
streamEnv
;
...
@@ -106,7 +106,7 @@ int32_t streamSetupScheduleTrigger(SStreamTask* pTask) {
...
@@ -106,7 +106,7 @@ int32_t streamSetupScheduleTrigger(SStreamTask* pTask) {
int32_t
ref
=
atomic_add_fetch_32
(
&
pTask
->
refCnt
,
1
);
int32_t
ref
=
atomic_add_fetch_32
(
&
pTask
->
refCnt
,
1
);
ASSERT
(
ref
==
2
&&
pTask
->
schedTimer
==
NULL
);
ASSERT
(
ref
==
2
&&
pTask
->
schedTimer
==
NULL
);
qDebug
(
"s-task:%s setup scheduler trigger, delay:%"
PRId64
" ms"
,
pTask
->
id
.
idStr
,
pTask
->
triggerParam
);
qDebug
(
"s-task:%s setup scheduler trigger, delay:%"
PRId64
" ms"
,
pTask
->
id
.
idStr
,
pTask
->
triggerParam
);
pTask
->
schedTimer
=
taosTmrStart
(
streamSchedByTimer
,
(
int32_t
)
pTask
->
triggerParam
,
pTask
,
streamEnv
.
timer
);
pTask
->
schedTimer
=
taosTmrStart
(
streamSchedByTimer
,
(
int32_t
)
pTask
->
triggerParam
,
pTask
,
streamEnv
.
timer
);
pTask
->
triggerStatus
=
TASK_TRIGGER_STATUS__INACTIVE
;
pTask
->
triggerStatus
=
TASK_TRIGGER_STATUS__INACTIVE
;
...
@@ -155,7 +155,7 @@ int32_t streamTaskEnqueueBlocks(SStreamTask* pTask, const SStreamDispatchReq* pR
...
@@ -155,7 +155,7 @@ int32_t streamTaskEnqueueBlocks(SStreamTask* pTask, const SStreamDispatchReq* pR
}
else
{
}
else
{
int32_t
code
=
tAppendDataToInputQueue
(
pTask
,
(
SStreamQueueItem
*
)
pBlock
);
int32_t
code
=
tAppendDataToInputQueue
(
pTask
,
(
SStreamQueueItem
*
)
pBlock
);
// input queue is full, upstream is blocked now
// input queue is full, upstream is blocked now
status
=
(
code
==
TSDB_CODE_SUCCESS
)
?
TASK_INPUT_STATUS__NORMAL
:
TASK_INPUT_STATUS__BLOCKED
;
status
=
(
code
==
TSDB_CODE_SUCCESS
)
?
TASK_INPUT_STATUS__NORMAL
:
TASK_INPUT_STATUS__BLOCKED
;
}
}
// rsp by input status
// rsp by input status
...
@@ -183,8 +183,8 @@ int32_t streamTaskEnqueueRetrieve(SStreamTask* pTask, SStreamRetrieveReq* pReq,
...
@@ -183,8 +183,8 @@ int32_t streamTaskEnqueueRetrieve(SStreamTask* pTask, SStreamRetrieveReq* pReq,
// enqueue
// enqueue
if
(
pData
!=
NULL
)
{
if
(
pData
!=
NULL
)
{
qDebug
(
"s-task:%s (child %d) recv retrieve req from task:0x%x(vgId:%d), reqId:0x%"
PRIx64
,
pTask
->
id
.
idStr
,
pTask
->
info
.
selfChildId
,
qDebug
(
"s-task:%s (child %d) recv retrieve req from task:0x%x(vgId:%d), reqId:0x%"
PRIx64
,
pTask
->
id
.
idStr
,
pReq
->
srcTaskId
,
pReq
->
srcNodeId
,
pReq
->
reqId
);
p
Task
->
info
.
selfChildId
,
p
Req
->
srcTaskId
,
pReq
->
srcNodeId
,
pReq
->
reqId
);
pData
->
type
=
STREAM_INPUT__DATA_RETRIEVE
;
pData
->
type
=
STREAM_INPUT__DATA_RETRIEVE
;
pData
->
srcVgId
=
0
;
pData
->
srcVgId
=
0
;
...
@@ -265,7 +265,6 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i
...
@@ -265,7 +265,6 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i
pRsp
->
downstreamTaskId
,
tstrerror
(
code
),
++
pTask
->
msgInfo
.
retryCount
);
pRsp
->
downstreamTaskId
,
tstrerror
(
code
),
++
pTask
->
msgInfo
.
retryCount
);
int32_t
ret
=
streamDispatchAllBlocks
(
pTask
,
pTask
->
msgInfo
.
pData
);
int32_t
ret
=
streamDispatchAllBlocks
(
pTask
,
pTask
->
msgInfo
.
pData
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -291,20 +290,20 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i
...
@@ -291,20 +290,20 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i
// so the TASK_INPUT_STATUS_BLOCKED is rsp
// so the TASK_INPUT_STATUS_BLOCKED is rsp
// todo blocking the output status
// todo blocking the output status
if
(
pRsp
->
inputStatus
==
TASK_INPUT_STATUS__BLOCKED
)
{
if
(
pRsp
->
inputStatus
==
TASK_INPUT_STATUS__BLOCKED
)
{
pTask
->
msgInfo
.
blockingTs
=
taosGetTimestampMs
();
// record the blocking start time
pTask
->
msgInfo
.
blockingTs
=
taosGetTimestampMs
();
// record the blocking start time
int32_t
waitDuration
=
300
;
// 300 ms
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"
,
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
);
pTask
->
id
.
idStr
,
pRsp
->
downstreamTaskId
,
pTask
->
msgInfo
.
blockingTs
,
waitDuration
);
streamRetryDispatchStreamBlock
(
pTask
,
waitDuration
);
streamRetryDispatchStreamBlock
(
pTask
,
waitDuration
);
}
else
{
// pipeline send data in output queue
}
else
{
// pipeline send data in output queue
// this message has been sent successfully, let's try next one.
// this message has been sent successfully, let's try next one.
destroyStreamDataBlock
(
pTask
->
msgInfo
.
pData
);
destroyStreamDataBlock
(
pTask
->
msgInfo
.
pData
);
pTask
->
msgInfo
.
pData
=
NULL
;
pTask
->
msgInfo
.
pData
=
NULL
;
if
(
pTask
->
msgInfo
.
blockingTs
!=
0
)
{
if
(
pTask
->
msgInfo
.
blockingTs
!=
0
)
{
int64_t
el
=
taosGetTimestampMs
()
-
pTask
->
msgInfo
.
blockingTs
;
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
);
qDebug
(
"s-task:%s resume to normal from inputQ blocking, idle time:%"
PRId64
"ms"
,
pTask
->
id
.
idStr
,
el
);
pTask
->
msgInfo
.
blockingTs
=
0
;
pTask
->
msgInfo
.
blockingTs
=
0
;
}
}
...
@@ -350,9 +349,10 @@ int32_t tAppendDataToInputQueue(SStreamTask* pTask, SStreamQueueItem* pItem) {
...
@@ -350,9 +349,10 @@ int32_t tAppendDataToInputQueue(SStreamTask* pTask, SStreamQueueItem* pItem) {
if
(
type
==
STREAM_INPUT__DATA_SUBMIT
)
{
if
(
type
==
STREAM_INPUT__DATA_SUBMIT
)
{
SStreamDataSubmit
*
px
=
(
SStreamDataSubmit
*
)
pItem
;
SStreamDataSubmit
*
px
=
(
SStreamDataSubmit
*
)
pItem
;
if
((
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SOURCE
)
&&
tInputQueueIsFull
(
pTask
))
{
if
((
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SOURCE
)
&&
tInputQueueIsFull
(
pTask
))
{
qError
(
"s-task:%s input queue is full, capacity(size:%d num:%dMiB), current(blocks:%d, size:%.2fMiB) stop to push data"
,
qError
(
pTask
->
id
.
idStr
,
STREAM_TASK_INPUT_QUEUE_CAPACITY
,
STREAM_TASK_INPUT_QUEUE_CAPACITY_IN_SIZE
,
total
,
"s-task:%s input queue is full, capacity(size:%d num:%dMiB), current(blocks:%d, size:%.2fMiB) stop to push "
size
);
"data"
,
pTask
->
id
.
idStr
,
STREAM_TASK_INPUT_QUEUE_CAPACITY
,
STREAM_TASK_INPUT_QUEUE_CAPACITY_IN_SIZE
,
total
,
size
);
streamDataSubmitDestroy
(
px
);
streamDataSubmitDestroy
(
px
);
taosFreeQitem
(
pItem
);
taosFreeQitem
(
pItem
);
return
-
1
;
return
-
1
;
...
@@ -366,27 +366,26 @@ int32_t tAppendDataToInputQueue(SStreamTask* pTask, SStreamQueueItem* pItem) {
...
@@ -366,27 +366,26 @@ int32_t tAppendDataToInputQueue(SStreamTask* pTask, SStreamQueueItem* pItem) {
}
}
qDebug
(
"s-task:%s submit enqueue msgLen:%d ver:%"
PRId64
", total in queue:%d, size:%.2fMiB"
,
pTask
->
id
.
idStr
,
qDebug
(
"s-task:%s submit enqueue msgLen:%d ver:%"
PRId64
", total in queue:%d, size:%.2fMiB"
,
pTask
->
id
.
idStr
,
px
->
submit
.
msgLen
,
px
->
submit
.
ver
,
total
,
size
+
px
->
submit
.
msgLen
/
1048576
.
0
);
px
->
submit
.
msgLen
,
px
->
submit
.
ver
,
total
,
size
+
px
->
submit
.
msgLen
/
1048576
.
0
);
}
else
if
(
type
==
STREAM_INPUT__DATA_BLOCK
||
type
==
STREAM_INPUT__DATA_RETRIEVE
||
}
else
if
(
type
==
STREAM_INPUT__DATA_BLOCK
||
type
==
STREAM_INPUT__DATA_RETRIEVE
||
type
==
STREAM_INPUT__REF_DATA_BLOCK
)
{
type
==
STREAM_INPUT__REF_DATA_BLOCK
)
{
if
((
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SOURCE
)
&&
(
tInputQueueIsFull
(
pTask
)))
{
if
((
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SOURCE
)
&&
(
tInputQueueIsFull
(
pTask
)))
{
qError
(
"s-task:%s input queue is full, capacity:%d size:%d MiB, current(blocks:%d, size:%.2fMiB) abort"
,
qError
(
"s-task:%s input queue is full, capacity:%d size:%d MiB, current(blocks:%d, size:%.2fMiB) abort"
,
pTask
->
id
.
idStr
,
STREAM_TASK_INPUT_QUEUE_CAPACITY
,
STREAM_TASK_INPUT_QUEUE_CAPACITY_IN_SIZE
,
total
,
pTask
->
id
.
idStr
,
STREAM_TASK_INPUT_QUEUE_CAPACITY
,
STREAM_TASK_INPUT_QUEUE_CAPACITY_IN_SIZE
,
total
,
size
);
size
);
destroyStreamDataBlock
((
SStreamDataBlock
*
)
pItem
);
destroyStreamDataBlock
((
SStreamDataBlock
*
)
pItem
);
return
-
1
;
return
-
1
;
}
}
qDebug
(
"s-task:%s data block enqueue, current(blocks:%d, size:%.2fMiB)"
,
pTask
->
id
.
idStr
,
total
,
size
);
qDebug
(
"s-task:%s data block enqueue, current(blocks:%d, size:%.2fMiB)"
,
pTask
->
id
.
idStr
,
total
,
size
);
int32_t
code
=
taosWriteQitem
(
pTask
->
inputQueue
->
queue
,
pItem
);
int32_t
code
=
taosWriteQitem
(
pTask
->
inputQueue
->
queue
,
pItem
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
destroyStreamDataBlock
((
SStreamDataBlock
*
)
pItem
);
destroyStreamDataBlock
((
SStreamDataBlock
*
)
pItem
);
return
code
;
return
code
;
}
}
}
else
if
(
type
==
STREAM_INPUT__CHECKPOINT
)
{
}
else
if
(
type
==
STREAM_INPUT__CHECKPOINT
)
{
taosWriteQitem
(
pTask
->
inputQueue
->
queue
,
pItem
);
taosWriteQitem
(
pTask
->
inputQueue
->
queue
,
pItem
);
qDebug
(
"s-task:%s checkpoint enqueue, current(blocks:%d, size:%.2fMiB)"
,
pTask
->
id
.
idStr
,
total
,
size
);
qDebug
(
"s-task:%s checkpoint enqueue, current(blocks:%d, size:%.2fMiB)"
,
pTask
->
id
.
idStr
,
total
,
size
);
}
else
if
(
type
==
STREAM_INPUT__GET_RES
)
{
// use the default memory limit, refactor later.
}
else
if
(
type
==
STREAM_INPUT__GET_RES
)
{
// use the default memory limit, refactor later.
taosWriteQitem
(
pTask
->
inputQueue
->
queue
,
pItem
);
taosWriteQitem
(
pTask
->
inputQueue
->
queue
,
pItem
);
qDebug
(
"s-task:%s data res enqueue, current(blocks:%d, size:%.2fMiB)"
,
pTask
->
id
.
idStr
,
total
,
size
);
qDebug
(
"s-task:%s data res enqueue, current(blocks:%d, size:%.2fMiB)"
,
pTask
->
id
.
idStr
,
total
,
size
);
}
}
...
...
source/libs/stream/src/streamCheckpoint.c
浏览文件 @
e263d5f5
...
@@ -160,7 +160,7 @@ static int32_t streamTaskDispatchCheckpointMsg(SStreamTask* pTask, uint64_t chec
...
@@ -160,7 +160,7 @@ static int32_t streamTaskDispatchCheckpointMsg(SStreamTask* pTask, uint64_t chec
req
.
downstreamTaskId
=
pVgInfo
->
taskId
;
req
.
downstreamTaskId
=
pVgInfo
->
taskId
;
streamDispatchCheckpointMsg
(
pTask
,
&
req
,
pVgInfo
->
vgId
,
&
pVgInfo
->
epSet
);
streamDispatchCheckpointMsg
(
pTask
,
&
req
,
pVgInfo
->
vgId
,
&
pVgInfo
->
epSet
);
}
}
}
else
{
// no need to dispatch msg to downstream task
}
else
{
// no need to dispatch msg to downstream task
qDebug
(
"s-task:%s no down stream task, not dispatch checkpoint msg to downstream"
,
pTask
->
id
.
idStr
);
qDebug
(
"s-task:%s no down stream task, not dispatch checkpoint msg to downstream"
,
pTask
->
id
.
idStr
);
streamProcessCheckpointRsp
(
NULL
,
pTask
);
streamProcessCheckpointRsp
(
NULL
,
pTask
);
}
}
...
@@ -202,6 +202,7 @@ int32_t streamProcessCheckpointSourceReq(SStreamMeta* pMeta, SStreamTask* pTask,
...
@@ -202,6 +202,7 @@ int32_t streamProcessCheckpointSourceReq(SStreamMeta* pMeta, SStreamTask* pTask,
// 1. set task status to be prepared for check point, no data are allowed to put into inputQ.
// 1. set task status to be prepared for check point, no data are allowed to put into inputQ.
pTask
->
status
.
taskStatus
=
TASK_STATUS__CK
;
pTask
->
status
.
taskStatus
=
TASK_STATUS__CK
;
pTask
->
checkpointNotReadyTasks
=
1
;
pTask
->
checkpointNotReadyTasks
=
1
;
pTask
->
checkpointingId
=
pReq
->
checkpointId
;
// 2. let's dispatch checkpoint msg to downstream task directly and do nothing else.
// 2. let's dispatch checkpoint msg to downstream task directly and do nothing else.
streamTaskDispatchCheckpointMsg
(
pTask
,
checkpointId
);
streamTaskDispatchCheckpointMsg
(
pTask
,
checkpointId
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录