Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8c8b1a6d
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看板
提交
8c8b1a6d
编写于
7月 17, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream): handle block before checkpoint msg in the inputQ.
上级
dea2e73d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
58 addition
and
31 deletion
+58
-31
source/libs/stream/src/streamQueue.c
source/libs/stream/src/streamQueue.c
+56
-29
source/libs/stream/src/streamRecover.c
source/libs/stream/src/streamRecover.c
+2
-2
未找到文件。
source/libs/stream/src/streamQueue.c
浏览文件 @
8c8b1a6d
...
@@ -168,10 +168,37 @@ SStreamQueueItem* doReadMultiBlocksFromQueue(SQueueReader* pReader, const char*
...
@@ -168,10 +168,37 @@ SStreamQueueItem* doReadMultiBlocksFromQueue(SQueueReader* pReader, const char*
#endif
#endif
int32_t
extractBlocksFromInputQ
(
SStreamTask
*
pTask
,
SStreamQueueItem
**
pInput
,
int32_t
*
numOfBlocks
)
{
int32_t
extractBlocksFromInputQ
(
SStreamTask
*
pTask
,
SStreamQueueItem
**
pInput
,
int32_t
*
numOfBlocks
)
{
int32_t
retryTimes
=
0
;
int32_t
retryTimes
=
0
;
int32_t
MAX_RETRY_TIMES
=
5
;
int32_t
MAX_RETRY_TIMES
=
5
;
const
char
*
id
=
pTask
->
id
.
idStr
;
const
char
*
id
=
pTask
->
id
.
idStr
;
if
(
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SINK
)
{
// extract block from inputQ, one-by-one
while
(
1
)
{
if
(
streamTaskShouldPause
(
&
pTask
->
status
))
{
qDebug
(
"s-task:%s task should pause, extract input blocks:%d"
,
pTask
->
id
.
idStr
,
*
numOfBlocks
);
return
TSDB_CODE_SUCCESS
;
}
SStreamQueueItem
*
qItem
=
streamQueueNextItem
(
pTask
->
inputQueue
);
if
(
qItem
==
NULL
)
{
if
(
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SOURCE
&&
(
++
retryTimes
)
<
MAX_RETRY_TIMES
)
{
taosMsleep
(
10
);
qDebug
(
"===stream===try again batchSize:%d, retry:%d, %s"
,
*
numOfBlocks
,
retryTimes
,
id
);
continue
;
}
qDebug
(
"===stream===break batchSize:%d, %s"
,
*
numOfBlocks
,
id
);
return
TSDB_CODE_SUCCESS
;
}
qDebug
(
"s-task:%s sink task handle result block one-by-one"
,
id
);
*
numOfBlocks
=
1
;
*
pInput
=
qItem
;
return
TSDB_CODE_SUCCESS
;
}
}
// non sink task
while
(
1
)
{
while
(
1
)
{
if
(
streamTaskShouldPause
(
&
pTask
->
status
))
{
if
(
streamTaskShouldPause
(
&
pTask
->
status
))
{
qDebug
(
"s-task:%s task should pause, extract input blocks:%d"
,
pTask
->
id
.
idStr
,
*
numOfBlocks
);
qDebug
(
"s-task:%s task should pause, extract input blocks:%d"
,
pTask
->
id
.
idStr
,
*
numOfBlocks
);
...
@@ -191,41 +218,41 @@ int32_t extractBlocksFromInputQ(SStreamTask* pTask, SStreamQueueItem** pInput, i
...
@@ -191,41 +218,41 @@ int32_t extractBlocksFromInputQ(SStreamTask* pTask, SStreamQueueItem** pInput, i
}
}
// do not merge blocks for sink node and check point data block
// do not merge blocks for sink node and check point data block
if
((
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SINK
)
||
if
((
qItem
->
type
==
STREAM_INPUT__CHECKPOINT
||
qItem
->
type
==
STREAM_INPUT__CHECKPOINT_TRIGGER
))
{
(
qItem
->
type
==
STREAM_INPUT__CHECKPOINT
||
qItem
->
type
==
STREAM_INPUT__CHECKPOINT_TRIGGER
))
{
if
(
*
pInput
==
NULL
)
{
if
(
qItem
->
type
==
STREAM_INPUT__CHECKPOINT
||
qItem
->
type
==
STREAM_INPUT__CHECKPOINT_TRIGGER
)
{
qDebug
(
"s-task:%s checkpoint msg extracted, start to process immediately"
,
id
);
qDebug
(
"s-task:%s checkpoint msg extracted, start to process immediately"
,
id
);
*
numOfBlocks
=
1
;
*
pInput
=
qItem
;
return
TSDB_CODE_SUCCESS
;
}
else
{
}
else
{
qDebug
(
"s-task:%s sink task handle result block one-by-one"
,
id
);
// previous existed blocks needs to be handle, before handle the checkpoint msg block
}
qDebug
(
"s-task:%s checkpoint msg extracted, handle previous block first, numOfBlocks:%d"
,
id
,
*
numOfBlocks
);
*
numOfBlocks
=
1
;
*
pInput
=
qItem
;
return
TSDB_CODE_SUCCESS
;
}
if
(
*
pInput
==
NULL
)
{
ASSERT
((
*
numOfBlocks
)
==
0
);
*
pInput
=
qItem
;
}
else
{
// todo we need to sort the data block, instead of just appending into the array list.
void
*
newRet
=
streamMergeQueueItem
(
*
pInput
,
qItem
);
if
(
newRet
==
NULL
)
{
qError
(
"s-task:%s failed to merge blocks from inputQ, numOfBlocks:%d"
,
id
,
*
numOfBlocks
);
streamQueueProcessFail
(
pTask
->
inputQueue
);
streamQueueProcessFail
(
pTask
->
inputQueue
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
}
else
{
if
(
*
pInput
==
NULL
)
{
ASSERT
((
*
numOfBlocks
)
==
0
);
*
pInput
=
qItem
;
}
else
{
// todo we need to sort the data block, instead of just appending into the array list.
void
*
newRet
=
streamMergeQueueItem
(
*
pInput
,
qItem
);
if
(
newRet
==
NULL
)
{
qError
(
"s-task:%s failed to merge blocks from inputQ, numOfBlocks:%d"
,
id
,
*
numOfBlocks
);
streamQueueProcessFail
(
pTask
->
inputQueue
);
return
TSDB_CODE_SUCCESS
;
}
*
pInput
=
newRet
;
*
pInput
=
newRet
;
}
}
*
numOfBlocks
+=
1
;
*
numOfBlocks
+=
1
;
streamQueueProcessSuccess
(
pTask
->
inputQueue
);
streamQueueProcessSuccess
(
pTask
->
inputQueue
);
if
(
*
numOfBlocks
>=
MAX_STREAM_EXEC_BATCH_NUM
)
{
if
(
*
numOfBlocks
>=
MAX_STREAM_EXEC_BATCH_NUM
)
{
qDebug
(
"s-task:%s batch size limit:%d reached, start to process blocks"
,
id
,
MAX_STREAM_EXEC_BATCH_NUM
);
qDebug
(
"s-task:%s batch size limit:%d reached, start to process blocks"
,
id
,
MAX_STREAM_EXEC_BATCH_NUM
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
}
}
}
}
}
source/libs/stream/src/streamRecover.c
浏览文件 @
8c8b1a6d
...
@@ -665,13 +665,13 @@ void streamPrepareNdoCheckDownstream(SStreamTask* pTask) {
...
@@ -665,13 +665,13 @@ void streamPrepareNdoCheckDownstream(SStreamTask* pTask) {
pRange
->
range
.
minVer
=
0
;
pRange
->
range
.
minVer
=
0
;
pRange
->
range
.
maxVer
=
ver
;
pRange
->
range
.
maxVer
=
ver
;
qDebug
(
"s-task:%s level:%d fill-history task exists, update stream time window:%"
PRId64
" - %"
PRId64
qDebug
(
"s-task:%s level:%d
related
fill-history task exists, update stream time window:%"
PRId64
" - %"
PRId64
", ver range:%"
PRId64
" - %"
PRId64
,
", ver range:%"
PRId64
" - %"
PRId64
,
pTask
->
id
.
idStr
,
pTask
->
info
.
taskLevel
,
pRange
->
window
.
skey
,
pRange
->
window
.
ekey
,
pRange
->
range
.
minVer
,
pTask
->
id
.
idStr
,
pTask
->
info
.
taskLevel
,
pRange
->
window
.
skey
,
pRange
->
window
.
ekey
,
pRange
->
range
.
minVer
,
pRange
->
range
.
maxVer
);
pRange
->
range
.
maxVer
);
}
else
{
}
else
{
SHistDataRange
*
pRange
=
&
pTask
->
dataRange
;
SHistDataRange
*
pRange
=
&
pTask
->
dataRange
;
qDebug
(
"s-task:%s no
associated scan
-history task, stream time window:%"
PRId64
" - %"
PRId64
qDebug
(
"s-task:%s no
related fill
-history task, stream time window:%"
PRId64
" - %"
PRId64
", ver range:%"
PRId64
" - %"
PRId64
,
", ver range:%"
PRId64
" - %"
PRId64
,
pTask
->
id
.
idStr
,
pRange
->
window
.
skey
,
pRange
->
window
.
ekey
,
pRange
->
range
.
minVer
,
pRange
->
range
.
maxVer
);
pTask
->
id
.
idStr
,
pRange
->
window
.
skey
,
pRange
->
window
.
ekey
,
pRange
->
range
.
minVer
,
pRange
->
range
.
maxVer
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录