Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f6ae9cf9
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看板
提交
f6ae9cf9
编写于
8月 01, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream): fetch all data before paused and dump to sink node.
上级
b8386037
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
24 deletion
+29
-24
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+1
-1
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+21
-9
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+7
-14
未找到文件。
include/libs/stream/tstream.h
浏览文件 @
f6ae9cf9
...
...
@@ -590,7 +590,7 @@ bool streamTaskIsIdle(const SStreamTask* pTask);
int32_t
streamTaskEndScanWAL
(
SStreamTask
*
pTask
);
SStreamChildEpInfo
*
streamTaskGetUpstreamTaskEpInfo
(
SStreamTask
*
pTask
,
int32_t
taskId
);
int32_t
streamScanExec
(
SStreamTask
*
pTask
,
int32_t
batchS
z
);
int32_t
streamScanExec
(
SStreamTask
*
pTask
,
int32_t
batchS
ize
);
char
*
createStreamTaskIdStr
(
int64_t
streamId
,
int32_t
taskId
);
...
...
source/libs/executor/src/executor.c
浏览文件 @
f6ae9cf9
...
...
@@ -647,23 +647,33 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
*
pRes
=
NULL
;
int64_t
curOwner
=
0
;
if
((
curOwner
=
atomic_val_compare_exchange_64
(
&
pTaskInfo
->
owner
,
0
,
threadId
))
!=
0
)
{
// todo extract method
taosRLockLatch
(
&
pTaskInfo
->
lock
);
bool
isKilled
=
isTaskKilled
(
pTaskInfo
);
if
(
isKilled
)
{
clearStreamBlock
(
pTaskInfo
->
pRoot
);
qDebug
(
"%s already killed, abort"
,
GET_TASKID
(
pTaskInfo
));
taosRUnLockLatch
(
&
pTaskInfo
->
lock
);
return
TSDB_CODE_SUCCESS
;
}
if
(
pTaskInfo
->
owner
!=
0
)
{
qError
(
"%s-%p execTask is now executed by thread:%p"
,
GET_TASKID
(
pTaskInfo
),
pTaskInfo
,
(
void
*
)
curOwner
);
pTaskInfo
->
code
=
TSDB_CODE_QRY_IN_EXEC
;
taosRUnLockLatch
(
&
pTaskInfo
->
lock
);
return
pTaskInfo
->
code
;
}
pTaskInfo
->
owner
=
threadId
;
taosRUnLockLatch
(
&
pTaskInfo
->
lock
);
if
(
pTaskInfo
->
cost
.
start
==
0
)
{
pTaskInfo
->
cost
.
start
=
taosGetTimestampUs
();
}
if
(
isTaskKilled
(
pTaskInfo
))
{
clearStreamBlock
(
pTaskInfo
->
pRoot
);
atomic_store_64
(
&
pTaskInfo
->
owner
,
0
);
qDebug
(
"%s already killed, abort"
,
GET_TASKID
(
pTaskInfo
));
return
TSDB_CODE_SUCCESS
;
}
// error occurs, record the error code and return to client
int32_t
ret
=
setjmp
(
pTaskInfo
->
env
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -767,11 +777,13 @@ int32_t qKillTask(qTaskInfo_t tinfo, int32_t rspCode) {
qDebug
(
"%s sync killed execTask"
,
GET_TASKID
(
pTaskInfo
));
setTaskKilled
(
pTaskInfo
,
TSDB_CODE_TSC_QUERY_KILLED
);
taosWLockLatch
(
&
pTaskInfo
->
lock
);
while
(
qTaskIsExecuting
(
pTaskInfo
))
{
taosMsleep
(
10
);
}
pTaskInfo
->
code
=
rspCode
;
taosWUnLockLatch
(
&
pTaskInfo
->
lock
);
return
TSDB_CODE_SUCCESS
;
}
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
f6ae9cf9
...
...
@@ -162,7 +162,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, SStreamQueueItem* pItem, i
return
code
;
}
int32_t
streamScanExec
(
SStreamTask
*
pTask
,
int32_t
batchS
z
)
{
int32_t
streamScanExec
(
SStreamTask
*
pTask
,
int32_t
batchS
ize
)
{
ASSERT
(
pTask
->
info
.
taskLevel
==
TASK_LEVEL__SOURCE
);
int32_t
code
=
TSDB_CODE_SUCCESS
;
void
*
exec
=
pTask
->
exec
.
pExecutor
;
...
...
@@ -174,7 +174,7 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
if
(
streamTaskShouldPause
(
&
pTask
->
status
))
{
double
el
=
(
taosGetTimestampMs
()
-
pTask
->
tsInfo
.
step1Start
)
/
1000
.
0
;
qDebug
(
"s-task:%s paused from the scan-history task, elapsed time:%.2fsec"
,
pTask
->
id
.
idStr
,
el
);
return
0
;
break
;
}
SArray
*
pRes
=
taosArrayInit
(
0
,
sizeof
(
SSDataBlock
));
...
...
@@ -190,10 +190,6 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
return
0
;
}
if
(
streamTaskShouldPause
(
&
pTask
->
status
))
{
break
;
}
SSDataBlock
*
output
=
NULL
;
uint64_t
ts
=
0
;
code
=
qExecTask
(
exec
,
&
output
,
&
ts
);
...
...
@@ -203,13 +199,9 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
}
// the generated results before fill-history task been paused, should be dispatched to sink node
if
(
output
==
NULL
&&
qStreamRecoverScanFinished
(
exec
)
)
{
finished
=
true
;
if
(
output
==
NULL
)
{
finished
=
qStreamRecoverScanFinished
(
exec
)
;
break
;
}
else
{
if
(
output
==
NULL
)
{
ASSERT
(
0
);
}
}
SSDataBlock
block
=
{
0
};
...
...
@@ -218,8 +210,9 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
taosArrayPush
(
pRes
,
&
block
);
numOfBlocks
++
;
qDebug
(
"s-task:%s scan exec numOfBlocks:%d, limit:%d"
,
pTask
->
id
.
idStr
,
numOfBlocks
,
batchSz
);
if
(
numOfBlocks
>=
batchSz
)
{
if
(
numOfBlocks
>=
batchSize
||
code
!=
TSDB_CODE_SUCCESS
)
{
qDebug
(
"s-task:%s scan exec numOfBlocks:%d, limit:%d, code:%s"
,
pTask
->
id
.
idStr
,
numOfBlocks
,
batchSize
,
tstrerror
(
code
));
break
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录