Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d2d76128
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
d2d76128
编写于
9月 16, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: support multiple exchange operators in explain
上级
a85a73e2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
19 deletion
+39
-19
source/libs/command/inc/commandInt.h
source/libs/command/inc/commandInt.h
+2
-0
source/libs/command/src/explain.c
source/libs/command/src/explain.c
+30
-16
source/libs/scheduler/src/schTask.c
source/libs/scheduler/src/schTask.c
+7
-3
未找到文件。
source/libs/command/inc/commandInt.h
浏览文件 @
d2d76128
...
...
@@ -99,8 +99,10 @@ extern "C" {
typedef
struct
SExplainGroup
{
int32_t
nodeNum
;
int32_t
nodeIdx
;
int32_t
physiPlanExecNum
;
int32_t
physiPlanExecIdx
;
bool
singleChannel
;
SRWLatch
lock
;
SSubplan
*
plan
;
SArray
*
nodeExecInfo
;
//Array<SExplainRsp>
...
...
source/libs/command/src/explain.c
浏览文件 @
d2d76128
...
...
@@ -21,7 +21,7 @@
#include "tdatablock.h"
int32_t
qExplainGenerateResNode
(
SPhysiNode
*
pNode
,
SExplainGroup
*
group
,
SExplainResNode
**
pRes
);
int32_t
qExplainAppendGroupResRows
(
void
*
pCtx
,
int32_t
groupId
,
int32_t
level
);
int32_t
qExplainAppendGroupResRows
(
void
*
pCtx
,
int32_t
groupId
,
int32_t
level
,
bool
singleChannel
);
void
qExplainFreeResNode
(
SExplainResNode
*
resNode
)
{
if
(
NULL
==
resNode
)
{
...
...
@@ -250,7 +250,7 @@ int32_t qExplainGenerateResChildren(SPhysiNode *pNode, SExplainGroup *group, SNo
return
TSDB_CODE_SUCCESS
;
}
int32_t
qExplainGenerateResNodeExecInfo
(
SArray
**
pExecInfo
,
SExplainGroup
*
group
)
{
int32_t
qExplainGenerateResNodeExecInfo
(
S
PhysiNode
*
pNode
,
S
Array
**
pExecInfo
,
SExplainGroup
*
group
)
{
*
pExecInfo
=
taosArrayInit
(
group
->
nodeNum
,
sizeof
(
SExplainExecInfo
));
if
(
NULL
==
(
*
pExecInfo
))
{
qError
(
"taosArrayInit %d explainExecInfo failed"
,
group
->
nodeNum
);
...
...
@@ -258,17 +258,28 @@ int32_t qExplainGenerateResNodeExecInfo(SArray **pExecInfo, SExplainGroup *group
}
SExplainRsp
*
rsp
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
group
->
nodeNum
;
++
i
)
{
rsp
=
taosArrayGet
(
group
->
nodeExecInfo
,
i
);
/*
if (group->physiPlanExecIdx >= rsp->numOfPlans) {
qError("physiPlanIdx %d exceed plan num %d", group->physiPlanExecIdx, rsp->numOfPlans);
return TSDB_CODE_QRY_APP_ERROR;
}
if
(
group
->
singleChannel
)
{
if
(
0
==
group
->
physiPlanExecIdx
)
{
group
->
nodeIdx
=
0
;
}
rsp
=
taosArrayGet
(
group
->
nodeExecInfo
,
group
->
nodeIdx
++
);
if
(
group
->
physiPlanExecIdx
>=
rsp
->
numOfPlans
)
{
qError
(
"physiPlanIdx %d exceed plan num %d"
,
group
->
physiPlanExecIdx
,
rsp
->
numOfPlans
);
return
TSDB_CODE_QRY_APP_ERROR
;
}
taosArrayPush
(
*
pExecInfo
,
rsp
->
subplanInfo
+
group
->
physiPlanExecIdx
);
}
else
{
for
(
int32_t
i
=
0
;
i
<
group
->
nodeNum
;
++
i
)
{
rsp
=
taosArrayGet
(
group
->
nodeExecInfo
,
i
);
if
(
group
->
physiPlanExecIdx
>=
rsp
->
numOfPlans
)
{
qError
(
"physiPlanIdx %d exceed plan num %d"
,
group
->
physiPlanExecIdx
,
rsp
->
numOfPlans
);
return
TSDB_CODE_QRY_APP_ERROR
;
}
taosArrayPush(*pExecInfo, rsp->subplanInfo + group->physiPlanExecIdx);
*/
taosArrayPush
(
*
pExecInfo
,
rsp
->
subplanInfo
);
taosArrayPush
(
*
pExecInfo
,
rsp
->
subplanInfo
+
group
->
physiPlanExecIdx
);
}
}
++
group
->
physiPlanExecIdx
;
...
...
@@ -293,7 +304,7 @@ int32_t qExplainGenerateResNode(SPhysiNode *pNode, SExplainGroup *group, SExplai
resNode
->
pNode
=
pNode
;
if
(
group
->
nodeExecInfo
)
{
QRY_ERR_JRET
(
qExplainGenerateResNodeExecInfo
(
&
resNode
->
pExecInfo
,
group
));
QRY_ERR_JRET
(
qExplainGenerateResNodeExecInfo
(
pNode
,
&
resNode
->
pExecInfo
,
group
));
}
QRY_ERR_JRET
(
qExplainGenerateResChildren
(
pNode
,
group
,
&
resNode
->
pChildren
));
...
...
@@ -803,7 +814,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
}
}
QRY_ERR_RET
(
qExplainAppendGroupResRows
(
ctx
,
pExchNode
->
srcGroupId
,
level
+
1
));
QRY_ERR_RET
(
qExplainAppendGroupResRows
(
ctx
,
pExchNode
->
srcGroupId
,
level
+
1
,
pExchNode
->
singleChannel
));
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_SORT
:
{
...
...
@@ -1535,7 +1546,7 @@ int32_t qExplainResNodeToRows(SExplainResNode *pResNode, SExplainCtx *ctx, int32
return
TSDB_CODE_SUCCESS
;
}
int32_t
qExplainAppendGroupResRows
(
void
*
pCtx
,
int32_t
groupId
,
int32_t
level
)
{
int32_t
qExplainAppendGroupResRows
(
void
*
pCtx
,
int32_t
groupId
,
int32_t
level
,
bool
singleChannel
)
{
SExplainResNode
*
node
=
NULL
;
int32_t
code
=
0
;
SExplainCtx
*
ctx
=
(
SExplainCtx
*
)
pCtx
;
...
...
@@ -1546,6 +1557,9 @@ int32_t qExplainAppendGroupResRows(void *pCtx, int32_t groupId, int32_t level) {
QRY_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
}
group
->
singleChannel
=
singleChannel
;
group
->
physiPlanExecIdx
=
0
;
QRY_ERR_RET
(
qExplainGenerateResNode
(
group
->
plan
->
pNode
,
group
,
&
node
));
QRY_ERR_JRET
(
qExplainResNodeToRows
(
node
,
ctx
,
level
));
...
...
@@ -1709,7 +1723,7 @@ int32_t qExplainAppendPlanRows(SExplainCtx *pCtx) {
}
int32_t
qExplainGenerateRsp
(
SExplainCtx
*
pCtx
,
SRetrieveTableRsp
**
pRsp
)
{
QRY_ERR_RET
(
qExplainAppendGroupResRows
(
pCtx
,
pCtx
->
rootGroupId
,
0
));
QRY_ERR_RET
(
qExplainAppendGroupResRows
(
pCtx
,
pCtx
->
rootGroupId
,
0
,
false
));
QRY_ERR_RET
(
qExplainAppendPlanRows
(
pCtx
));
QRY_ERR_RET
(
qExplainGetRspFromCtx
(
pCtx
,
pRsp
));
...
...
source/libs/scheduler/src/schTask.c
浏览文件 @
d2d76128
...
...
@@ -21,6 +21,7 @@
#include "tref.h"
#include "trpc.h"
#include "qworker.h"
#include "tglobal.h"
void
schFreeTask
(
SSchJob
*
pJob
,
SSchTask
*
pTask
)
{
schDeregisterTaskHb
(
pJob
,
pTask
);
...
...
@@ -897,9 +898,12 @@ int32_t schLaunchRemoteTask(SSchJob *pJob, SSchTask *pTask) {
SCH_TASK_ELOG
(
"failed to create physical plan, code:%s, msg:%p, len:%d"
,
tstrerror
(
code
),
pTask
->
msg
,
pTask
->
msgLen
);
SCH_ERR_RET
(
code
);
}
else
{
//binary msg
//SCH_TASK_DLOGL("physical plan len:%d, %s", pTask->msgLen, pTask->msg);
}
else
if
(
tsQueryPlannerTrace
)
{
char
*
msg
=
NULL
;
int32_t
msgLen
=
0
;
qSubPlanToString
(
plan
,
&
msg
,
&
msgLen
);
SCH_TASK_DLOGL
(
"physical plan len:%d, %s"
,
msgLen
,
msg
);
taosMemoryFree
(
msg
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录