Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e7c200ad
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
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看板
提交
e7c200ad
编写于
7月 06, 2023
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: support dynamic table scan
上级
0718859c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
64 addition
and
8 deletion
+64
-8
source/libs/executor/src/operator.c
source/libs/executor/src/operator.c
+2
-0
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+27
-2
source/libs/qworker/inc/qwInt.h
source/libs/qworker/inc/qwInt.h
+1
-0
source/libs/qworker/src/qwUtil.c
source/libs/qworker/src/qwUtil.c
+4
-2
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+30
-4
未找到文件。
source/libs/executor/src/operator.c
浏览文件 @
e7c200ad
...
...
@@ -309,6 +309,8 @@ SOperatorInfo* createOperator(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SR
if
(
pTableScanNode
->
scan
.
node
.
dynamicOp
)
{
pTaskInfo
->
dynamicTask
=
true
;
pTableListInfo
->
idInfo
.
suid
=
pTableScanNode
->
scan
.
suid
;
pTableListInfo
->
idInfo
.
tableType
=
pTableScanNode
->
scan
.
tableType
;
}
else
{
code
=
createScanTableListInfo
(
&
pTableScanNode
->
scan
,
pTableScanNode
->
pGroupTags
,
pTableScanNode
->
groupSort
,
pHandle
,
pTableListInfo
,
pTagCond
,
pTagIndexCond
,
pTaskInfo
);
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
e7c200ad
...
...
@@ -784,8 +784,33 @@ static SSDataBlock* doGroupedTableScan(SOperatorInfo* pOperator) {
return
NULL
;
}
static
int32_t
createTableListInfoFromParam
(
STableScanInfo
*
pInfo
,
STableScanOperatorParam
*
pParam
)
{
static
int32_t
createTableListInfoFromParam
(
SOperatorInfo
*
pOperator
)
{
STableScanInfo
*
pInfo
=
pOperator
->
info
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
int32_t
code
=
0
;
STableListInfo
*
pListInfo
=
pInfo
->
base
.
pTableListInfo
;
int32_t
num
=
taosArrayGetSize
(
pOperator
->
pOperatorParam
->
pUidList
);
if
(
num
<=
0
)
{
qError
(
"empty table scan uid list"
);
return
TSDB_CODE_INVALID_PARA
;
}
qDebug
(
"add total %d dynamic tables to scan"
,
num
);
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
uint64_t
*
pUid
=
taosArrayGet
(
pOperator
->
pOperatorParam
->
pUidList
,
i
);
STableKeyInfo
info
=
{.
uid
=
*
pUid
,
.
groupId
=
0
};
void
*
p
=
taosArrayPush
(
pListInfo
->
pTableList
,
&
info
);
if
(
p
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
taosHashPut
(
pListInfo
->
map
,
pUid
,
sizeof
(
uint64_t
),
&
i
,
sizeof
(
int32_t
));
qTrace
(
"add dynamic table scan uid:%"
PRIu64
", %s"
,
info
.
uid
,
GET_TASKID
(
pTaskInfo
));
}
pOperator
->
pOperatorParam
=
NULL
;
return
code
;
}
static
SSDataBlock
*
doTableScan
(
SOperatorInfo
*
pOperator
)
{
...
...
@@ -794,7 +819,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
SStorageAPI
*
pAPI
=
&
pTaskInfo
->
storageAPI
;
if
(
pOperator
->
pOperatorParam
)
{
int32_t
code
=
createTableListInfoFromParam
(
p
Info
,
(
STableScanOperatorParam
*
)
pOperator
->
pOperatorParam
);
int32_t
code
=
createTableListInfoFromParam
(
p
Operator
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
pTaskInfo
->
code
=
code
;
T_LONG_JMP
(
pTaskInfo
->
env
,
code
);
...
...
source/libs/qworker/inc/qwInt.h
浏览文件 @
e7c200ad
...
...
@@ -120,6 +120,7 @@ typedef struct SQWTaskCtx {
int8_t
explain
;
int8_t
needFetch
;
int8_t
localExec
;
int8_t
dynamicTask
;
int32_t
queryMsgType
;
int32_t
fetchMsgType
;
int32_t
level
;
...
...
source/libs/qworker/src/qwUtil.c
浏览文件 @
e7c200ad
...
...
@@ -412,11 +412,13 @@ int32_t qwHandleDynamicTaskEnd(QW_FPARAMS_DEF) {
QW_ERR_RET
(
QW_CTX_NOT_EXISTS_ERR_CODE
(
mgmt
));
}
if
(
!
qIsDynamicExecTask
(
ctx
->
taskHandle
)
)
{
if
(
!
ctx
->
dynamicTask
)
{
return
TSDB_CODE_SUCCESS
;
}
qwHandleTaskComplete
(
QW_FPARAMS_DEF
,
ctx
);
qwUpdateTaskStatus
(
QW_FPARAMS
(),
JOB_TASK_STATUS_SUCC
);
qwHandleTaskComplete
(
QW_FPARAMS
(),
ctx
);
return
TSDB_CODE_SUCCESS
;
}
...
...
source/libs/qworker/src/qworker.c
浏览文件 @
e7c200ad
...
...
@@ -203,7 +203,7 @@ int32_t qwExecTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *queryStop) {
}
if
(
numOfResBlock
==
0
||
(
hasMore
==
false
))
{
if
(
!
qIsDynamicExecTask
(
taskHandle
)
)
{
if
(
!
ctx
->
dynamicTask
)
{
if
(
numOfResBlock
==
0
)
{
QW_TASK_DLOG
(
"qExecTask end with empty res, useconds:%"
PRIu64
,
useconds
);
}
else
{
...
...
@@ -217,6 +217,8 @@ int32_t qwExecTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *queryStop) {
}
else
{
QW_TASK_DLOG
(
"dyn task qExecTask done, useconds:%"
PRIu64
,
useconds
);
}
ctx
->
queryExecDone
=
true
;
}
dsEndPut
(
sinkHandle
,
useconds
);
...
...
@@ -341,7 +343,10 @@ int32_t qwGetQueryResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen,
QW_TASK_DLOG
(
"no more data in sink and query end, fetched blocks %d rows %"
PRId64
,
pOutput
->
numOfBlocks
,
pOutput
->
numOfRows
);
qwUpdateTaskStatus
(
QW_FPARAMS
(),
JOB_TASK_STATUS_SUCC
);
if
(
!
ctx
->
dynamicTask
)
{
qwUpdateTaskStatus
(
QW_FPARAMS
(),
JOB_TASK_STATUS_SUCC
);
}
if
(
NULL
==
rsp
)
{
QW_ERR_RET
(
qwMallocFetchRsp
(
!
ctx
->
localExec
,
len
,
&
rsp
));
*
pOutput
=
output
;
...
...
@@ -481,6 +486,22 @@ int32_t qwQuickRspFetchReq(QW_FPARAMS_DEF, SQWTaskCtx * ctx, SQWMsg *qwMsg, i
return
TSDB_CODE_SUCCESS
;
}
int32_t
qwStartDynamicTaskNewExec
(
QW_FPARAMS_DEF
,
SQWTaskCtx
*
ctx
,
SQWMsg
*
qwMsg
)
{
if
(
!
ctx
->
queryExecDone
||
!
ctx
->
queryEnd
)
{
QW_TASK_ELOG
(
"dynamic task prev exec not finished, execDone:%d, queryEnd:%d"
,
ctx
->
queryExecDone
,
ctx
->
queryEnd
);
return
TSDB_CODE_ACTION_IN_PROGRESS
;
}
qUpdateOperatorParam
(
ctx
->
taskHandle
);
atomic_store_8
((
int8_t
*
)
&
ctx
->
queryInQueue
,
1
);
QW_ERR_RET
(
qwBuildAndSendCQueryMsg
(
QW_FPARAMS
(),
&
qwMsg
->
connInfo
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
qwHandlePrePhaseEvents
(
QW_FPARAMS_DEF
,
int8_t
phase
,
SQWPhaseInput
*
input
,
SQWPhaseOutput
*
output
)
{
int32_t
code
=
0
;
SQWTaskCtx
*
ctx
=
NULL
;
...
...
@@ -734,13 +755,17 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, char *sql) {
//qwSendQueryRsp(QW_FPARAMS(), qwMsg->msgType + 1, ctx, code, true);
ctx
->
level
=
plan
->
level
;
ctx
->
dynamicTask
=
qIsDynamicExecTask
(
pTaskInfo
)
atomic_store_ptr
(
&
ctx
->
taskHandle
,
pTaskInfo
);
atomic_store_ptr
(
&
ctx
->
sinkHandle
,
sinkHandle
);
qwSaveTbVersionInfo
(
pTaskInfo
,
ctx
);
if
(
!
qIsDynamicExecTask
(
pTaskInfo
)
)
{
if
(
!
ctx
->
dynamicTask
)
{
QW_ERR_JRET
(
qwExecTask
(
QW_FPARAMS
(),
ctx
,
NULL
));
}
else
{
ctx
->
queryExecDone
=
true
;
ctx
->
queryEnd
=
true
;
}
_return:
...
...
@@ -862,7 +887,8 @@ int32_t qwProcessFetch(QW_FPARAMS_DEF, SQWMsg *qwMsg) {
ctx
->
dataConnInfo
=
qwMsg
->
connInfo
;
if
(
qwMsg
->
msg
)
{
qUpdateOperatorParam
(
ctx
->
taskHandle
);
code
=
qwStartDynamicTaskNewExec
(
QW_FPARAMS
(),
ctx
,
qwMsg
);
goto
_return
;
}
SOutputData
sOutput
=
{
0
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录