Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ab23faed
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看板
提交
ab23faed
编写于
6月 24, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: planner memory leak
上级
28d66616
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
48 addition
and
18 deletion
+48
-18
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+22
-5
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+1
-4
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+5
-5
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+2
-1
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+12
-0
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+6
-3
未找到文件。
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
ab23faed
...
...
@@ -346,9 +346,11 @@ static void destroyVgDataBlockArray(SArray* pArray) {
}
static
void
destroyLogicNode
(
SLogicNode
*
pNode
)
{
nodesDestroyList
(
pNode
->
pChildren
);
nodesDestroyNode
(
pNode
->
pConditions
);
nodesDestroyList
(
pNode
->
pTargets
);
nodesDestroyNode
(
pNode
->
pConditions
);
nodesDestroyList
(
pNode
->
pChildren
);
nodesDestroyNode
(
pNode
->
pLimit
);
nodesDestroyNode
(
pNode
->
pSlimit
);
}
static
void
destroyPhysiNode
(
SPhysiNode
*
pNode
)
{
...
...
@@ -368,6 +370,7 @@ static void destroyWinodwPhysiNode(SWinodwPhysiNode* pNode) {
static
void
destroyScanPhysiNode
(
SScanPhysiNode
*
pNode
)
{
destroyPhysiNode
((
SPhysiNode
*
)
pNode
);
nodesDestroyList
(
pNode
->
pScanCols
);
nodesDestroyList
(
pNode
->
pScanPseudoCols
);
}
static
void
destroyDataSinkNode
(
SDataSinkNode
*
pNode
)
{
nodesDestroyNode
((
SNode
*
)
pNode
->
pInputDataBlockDesc
);
}
...
...
@@ -516,6 +519,9 @@ void nodesDestroyNode(SNode* pNode) {
nodesDestroyNode
(
pStmt
->
pWindow
);
nodesDestroyList
(
pStmt
->
pGroupByList
);
nodesDestroyNode
(
pStmt
->
pHaving
);
nodesDestroyNode
(
pStmt
->
pRange
);
nodesDestroyNode
(
pStmt
->
pEvery
);
nodesDestroyNode
(
pStmt
->
pFill
);
nodesDestroyList
(
pStmt
->
pOrderByList
);
nodesDestroyNode
((
SNode
*
)
pStmt
->
pLimit
);
nodesDestroyNode
((
SNode
*
)
pStmt
->
pSlimit
);
...
...
@@ -779,6 +785,8 @@ void nodesDestroyNode(SNode* pNode) {
SInterpFuncLogicNode
*
pLogicNode
=
(
SInterpFuncLogicNode
*
)
pNode
;
destroyLogicNode
((
SLogicNode
*
)
pLogicNode
);
nodesDestroyList
(
pLogicNode
->
pFuncs
);
nodesDestroyNode
(
pLogicNode
->
pFillValues
);
nodesDestroyNode
(
pLogicNode
->
pTimeSeries
);
break
;
}
case
QUERY_NODE_LOGIC_SUBPLAN
:
{
...
...
@@ -793,14 +801,21 @@ void nodesDestroyNode(SNode* pNode) {
nodesDestroyList
(((
SQueryLogicPlan
*
)
pNode
)
->
pTopSubplans
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN
:
destroyScanPhysiNode
((
SScanPhysiNode
*
)
pNode
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
:
{
STableScanPhysiNode
*
pPhyNode
=
(
STableScanPhysiNode
*
)
pNode
;
destroyScanPhysiNode
((
SScanPhysiNode
*
)
pNode
);
nodesDestroyList
(
pPhyNode
->
pDynamicScanFuncs
);
nodesDestroyList
(
pPhyNode
->
pPartitionTags
);
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_PROJECT
:
{
SProjectPhysiNode
*
pPhyNode
=
(
SProjectPhysiNode
*
)
pNode
;
destroyPhysiNode
((
SPhysiNode
*
)
pPhyNode
);
...
...
@@ -891,6 +906,8 @@ void nodesDestroyNode(SNode* pNode) {
destroyPhysiNode
((
SPhysiNode
*
)
pPhyNode
);
nodesDestroyList
(
pPhyNode
->
pExprs
);
nodesDestroyList
(
pPhyNode
->
pFuncs
);
nodesDestroyNode
(
pPhyNode
->
pFillValues
);
nodesDestroyNode
(
pPhyNode
->
pTimeSeries
);
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_DISPATCH
:
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
ab23faed
...
...
@@ -1840,10 +1840,7 @@ static int32_t createMultiResFuncsFromStar(STranslateContext* pCxt, SFunctionNod
code
=
createMultiResFuncs
(
pSrcFunc
,
pExprs
,
pOutput
);
}
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
nodesDestroyList
(
pExprs
);
}
nodesDestroyList
(
pExprs
);
return
code
;
}
...
...
source/libs/planner/src/planLogicCreater.c
浏览文件 @
ab23faed
...
...
@@ -780,8 +780,8 @@ static int32_t createProjectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSel
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pProject
->
node
.
pLimit
=
(
SNode
*
)
pSelect
->
pLimit
;
pProject
->
node
.
pSlimit
=
(
SNode
*
)
pSelect
->
pSlimit
;
TSWAP
(
pProject
->
node
.
pLimit
,
pSelect
->
pLimit
)
;
TSWAP
(
pProject
->
node
.
pSlimit
,
pSelect
->
pSlimit
)
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
...
@@ -940,7 +940,7 @@ static int32_t createSetOpSortLogicNode(SLogicPlanContext* pCxt, SSetOperator* p
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pSort
->
node
.
pLimit
=
pSetOperator
->
pLimit
;
TSWAP
(
pSort
->
node
.
pLimit
,
pSetOperator
->
pLimit
)
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
...
@@ -973,7 +973,7 @@ static int32_t createSetOpProjectLogicNode(SLogicPlanContext* pCxt, SSetOperator
}
if
(
NULL
==
pSetOperator
->
pOrderByList
)
{
pProject
->
node
.
pLimit
=
pSetOperator
->
pLimit
;
TSWAP
(
pProject
->
node
.
pLimit
,
pSetOperator
->
pLimit
)
;
}
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
...
@@ -1004,7 +1004,7 @@ static int32_t createSetOpAggLogicNode(SLogicPlanContext* pCxt, SSetOperator* pS
}
if
(
NULL
==
pSetOperator
->
pOrderByList
)
{
pAgg
->
node
.
pLimit
=
pSetOperator
->
pLimit
;
TSWAP
(
pAgg
->
node
.
pSlimit
,
pSetOperator
->
pLimit
)
;
}
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
...
source/libs/planner/src/planOptimizer.c
浏览文件 @
ab23faed
...
...
@@ -682,7 +682,7 @@ static EOrder opkGetPrimaryKeyOrder(SSortLogicNode* pSort) {
static
SNode
*
opkRewriteDownNode
(
SSortLogicNode
*
pSort
)
{
SNode
*
pDownNode
=
nodesListGetNode
(
pSort
->
node
.
pChildren
,
0
);
// todo
pSort
->
node
.
pChildren
=
NULL
;
NODES_CLEAR_LIST
(
pSort
->
node
.
pChildren
)
;
return
pDownNode
;
}
...
...
@@ -1061,6 +1061,7 @@ static EDealRes partTagsOptRebuildTbanmeImpl(SNode** pNode, void* pContext) {
}
strcpy
(
pFunc
->
functionName
,
"tbname"
);
pFunc
->
funcType
=
FUNCTION_TYPE_TBNAME
;
pFunc
->
node
.
resType
=
((
SColumnNode
*
)
*
pNode
)
->
node
.
resType
;
nodesDestroyNode
(
*
pNode
);
*
pNode
=
(
SNode
*
)
pFunc
;
return
DEAL_RES_IGNORE_CHILD
;
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
ab23faed
...
...
@@ -862,6 +862,9 @@ static int32_t createIndefRowsFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList*
nodesDestroyNode
((
SNode
*
)
pIdfRowsFunc
);
}
nodesDestroyList
(
pPrecalcExprs
);
nodesDestroyList
(
pFuncs
);
return
code
;
}
...
...
@@ -913,6 +916,9 @@ static int32_t createInterpFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pCh
nodesDestroyNode
((
SNode
*
)
pInterpFunc
);
}
nodesDestroyList
(
pPrecalcExprs
);
nodesDestroyList
(
pFuncs
);
return
code
;
}
...
...
@@ -1048,6 +1054,9 @@ static int32_t createWindowPhysiNodeFinalize(SPhysiPlanContext* pCxt, SNodeList*
nodesDestroyNode
((
SNode
*
)
pWindow
);
}
nodesDestroyList
(
pPrecalcExprs
);
nodesDestroyList
(
pFuncs
);
return
code
;
}
...
...
@@ -1241,6 +1250,9 @@ static int32_t createPartitionPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChi
nodesDestroyNode
((
SNode
*
)
pPart
);
}
nodesDestroyList
(
pPrecalcExprs
);
nodesDestroyList
(
pPartitionKeys
);
return
code
;
}
...
...
source/libs/planner/src/planSpliter.c
浏览文件 @
ab23faed
...
...
@@ -179,7 +179,7 @@ static bool stbSplNeedSplitWindow(bool streamQuery, SLogicNode* pNode) {
return
!
stbSplHasGatherExecFunc
(
pWindow
->
pFuncs
)
&&
stbSplHasMultiTbScan
(
streamQuery
,
pNode
);
}
}
if
(
WINDOW_TYPE_STATE
==
pWindow
->
winType
)
{
if
(
!
streamQuery
)
{
return
stbSplHasMultiTbScan
(
streamQuery
,
pNode
);
...
...
@@ -374,7 +374,7 @@ static int32_t stbSplCreateMergeNode(SSplitContext* pCxt, SLogicSubplan* pSubpla
int32_t
code
=
TSDB_CODE_SUCCESS
;
pMerge
->
pInputs
=
nodesCloneList
(
pPartChild
->
pTargets
);
// NULL
=
= pSubplan means 'merge node' replaces 'split node'.
// NULL
!
= pSubplan means 'merge node' replaces 'split node'.
if
(
NULL
==
pSubplan
)
{
pMerge
->
node
.
pTargets
=
nodesCloneList
(
pPartChild
->
pTargets
);
}
else
{
...
...
@@ -390,6 +390,9 @@ static int32_t stbSplCreateMergeNode(SSplitContext* pCxt, SLogicSubplan* pSubpla
code
=
replaceLogicNode
(
pSubplan
,
pSplitNode
,
(
SLogicNode
*
)
pMerge
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
pSubplan
)
{
nodesDestroyNode
((
SNode
*
)
pSplitNode
);
}
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
nodesDestroyNode
((
SNode
*
)
pMerge
);
}
...
...
@@ -512,7 +515,7 @@ static int32_t stbSplSplitSessionOrStateForBatch(SSplitContext* pCxt, SStableSpl
SLogicNode
*
pChild
=
(
SLogicNode
*
)
nodesListGetNode
(
pWindow
->
pChildren
,
0
);
SNodeList
*
pMergeKeys
=
NULL
;
int32_t
code
=
stbSplCreateMergeKeysByPrimaryKey
(((
SWindowLogicNode
*
)
pWindow
)
->
pTspk
,
&
pMergeKeys
);
int32_t
code
=
stbSplCreateMergeKeysByPrimaryKey
(((
SWindowLogicNode
*
)
pWindow
)
->
pTspk
,
&
pMergeKeys
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
stbSplCreateMergeNode
(
pCxt
,
pInfo
->
pSubplan
,
pChild
,
pMergeKeys
,
(
SLogicNode
*
)
pChild
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录