Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5cbad1da
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
5cbad1da
编写于
5月 20, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: do some internal refactor.
上级
6ded3284
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
47 addition
and
26 deletion
+47
-26
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+47
-26
未找到文件。
source/libs/stream/src/streamExec.c
浏览文件 @
5cbad1da
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
// maximum allowed processed block batches. One block may include several submit blocks
// maximum allowed processed block batches. One block may include several submit blocks
#define MAX_STREAM_EXEC_BATCH_NUM 128
#define MAX_STREAM_EXEC_BATCH_NUM 128
#define MIN_STREAM_EXEC_BATCH_NUM 16
#define MIN_STREAM_EXEC_BATCH_NUM 16
#define MAX_STREAM_RESULT_DUMP_THRESHOLD 1000
static
int32_t
updateCheckPointInfo
(
SStreamTask
*
pTask
);
static
int32_t
updateCheckPointInfo
(
SStreamTask
*
pTask
);
static
SStreamDataBlock
*
createStreamDataBlockFromResults
(
SStreamQueueItem
*
pItem
,
SStreamTask
*
pTask
,
int64_t
resultSize
,
SArray
*
pRes
);
static
SStreamDataBlock
*
createStreamDataBlockFromResults
(
SStreamQueueItem
*
pItem
,
SStreamTask
*
pTask
,
int64_t
resultSize
,
SArray
*
pRes
);
...
@@ -32,6 +33,39 @@ bool streamTaskShouldPause(const SStreamStatus* pStatus) {
...
@@ -32,6 +33,39 @@ bool streamTaskShouldPause(const SStreamStatus* pStatus) {
return
(
status
==
TASK_STATUS__PAUSE
);
return
(
status
==
TASK_STATUS__PAUSE
);
}
}
static
int32_t
doDumpResult
(
SStreamTask
*
pTask
,
SStreamQueueItem
*
pItem
,
SArray
*
pRes
,
int32_t
size
,
int64_t
*
totalSize
,
int32_t
*
totalBlocks
)
{
int32_t
code
=
updateCheckPointInfo
(
pTask
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
int32_t
numOfBlocks
=
taosArrayGetSize
(
pRes
);
if
(
numOfBlocks
>
0
)
{
SStreamDataBlock
*
pStreamBlocks
=
createStreamDataBlockFromResults
(
pItem
,
pTask
,
size
,
pRes
);
if
(
pStreamBlocks
==
NULL
)
{
return
-
1
;
}
qDebug
(
"s-task:%s dump stream result data blocks, num:%d, size:%.2fMiB"
,
pTask
->
id
.
idStr
,
numOfBlocks
,
size
/
1048576
.
0
);
code
=
streamTaskOutputResultBlock
(
pTask
,
pStreamBlocks
);
if
(
code
==
TSDB_CODE_UTIL_QUEUE_OUT_OF_MEMORY
)
{
// back pressure and record position
taosArrayClearEx
(
pRes
,
(
FDelete
)
blockDataFreeRes
);
taosFreeQitem
(
pStreamBlocks
);
return
-
1
;
}
}
else
{
taosArrayClearEx
(
pRes
,
(
FDelete
)
blockDataFreeRes
);
}
*
totalSize
+=
size
;
*
totalBlocks
+=
numOfBlocks
;
ASSERT
(
taosArrayGetSize
(
pRes
)
==
0
);
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
streamTaskExecImpl
(
SStreamTask
*
pTask
,
SStreamQueueItem
*
pItem
,
int64_t
*
totalSize
,
int32_t
*
totalBlocks
)
{
static
int32_t
streamTaskExecImpl
(
SStreamTask
*
pTask
,
SStreamQueueItem
*
pItem
,
int64_t
*
totalSize
,
int32_t
*
totalBlocks
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
void
*
pExecutor
=
pTask
->
exec
.
pExecutor
;
void
*
pExecutor
=
pTask
->
exec
.
pExecutor
;
...
@@ -98,38 +132,25 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, SStreamQueueItem* pItem, i
...
@@ -98,38 +132,25 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, SStreamQueueItem* pItem, i
pTask
->
selfChildId
,
numOfBlocks
,
size
/
1048576
.
0
);
pTask
->
selfChildId
,
numOfBlocks
,
size
/
1048576
.
0
);
// current output should be dispatched to down stream nodes
// current output should be dispatched to down stream nodes
if
(
numOfBlocks
>
1000
)
{
if
(
numOfBlocks
>=
MAX_STREAM_RESULT_DUMP_THRESHOLD
)
{
code
=
updateCheckPointInfo
(
pTask
);
ASSERT
(
numOfBlocks
==
taosArrayGetSize
(
pRes
));
code
=
doDumpResult
(
pTask
,
pItem
,
pRes
,
size
,
totalSize
,
totalBlocks
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
return
code
;
}
}
ASSERT
(
numOfBlocks
==
taosArrayGetSize
(
pRes
));
size
=
0
;
numOfBlocks
=
0
;
if
(
numOfBlocks
>
0
)
{
ASSERT
(
taosArrayGetSize
(
pRes
)
==
0
);
SStreamDataBlock
*
pStreamBlocks
=
createStreamDataBlockFromResults
(
pItem
,
pTask
,
size
,
pRes
);
if
(
pStreamBlocks
==
NULL
)
{
return
-
1
;
}
qDebug
(
"s-task:%s output exec stream data blocks, num:%d, size:%.2fMiB"
,
pTask
->
id
.
idStr
,
numOfBlocks
,
size
/
1048576
.
0
);
code
=
streamTaskOutputResultBlock
(
pTask
,
pStreamBlocks
);
if
(
code
==
TSDB_CODE_UTIL_QUEUE_OUT_OF_MEMORY
)
{
// back pressure and record position
taosArrayClearEx
(
pRes
,
(
FDelete
)
blockDataFreeRes
);
taosFreeQitem
(
pStreamBlocks
);
return
-
1
;
}
}
else
{
taosArrayClearEx
(
pRes
,
(
FDelete
)
blockDataFreeRes
);
}
}
}
}
*
totalSize
+=
size
;
if
(
numOfBlocks
>
0
)
{
*
totalBlocks
+=
numOfBlocks
;
ASSERT
(
numOfBlocks
==
taosArrayGetSize
(
pRes
));
code
=
doDumpResult
(
pTask
,
pItem
,
pRes
,
size
,
totalSize
,
totalBlocks
);
size
=
0
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
numOfBlocks
=
0
;
return
code
;
}
ASSERT
(
taosArrayGetSize
(
pRes
)
==
0
);
ASSERT
(
taosArrayGetSize
(
pRes
)
==
0
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录