This commit is contained in:
Xiaoyu Wang 2022-03-29 23:47:12 -04:00
parent 9f93b1ebc6
commit 7593fc6ae6
4 changed files with 28 additions and 6 deletions

View File

@ -481,8 +481,7 @@ void nodesDestroyNode(SNodeptr pNode) {
SVnodeModifLogicNode* pLogicNode = (SVnodeModifLogicNode*)pNode; SVnodeModifLogicNode* pLogicNode = (SVnodeModifLogicNode*)pNode;
destroyLogicNode((SLogicNode*)pLogicNode); destroyLogicNode((SLogicNode*)pLogicNode);
destroyVgDataBlockArray(pLogicNode->pDataBlocks); destroyVgDataBlockArray(pLogicNode->pDataBlocks);
taosMemoryFreeClear(pLogicNode->pVgDataBlocks->pData); // pVgDataBlocks is weak reference
taosMemoryFreeClear(pLogicNode->pVgDataBlocks);
break; break;
} }
case QUERY_NODE_LOGIC_PLAN_EXCHANGE: case QUERY_NODE_LOGIC_PLAN_EXCHANGE:
@ -512,6 +511,7 @@ void nodesDestroyNode(SNodeptr pNode) {
SLogicSubplan* pSubplan = (SLogicSubplan*)pNode; SLogicSubplan* pSubplan = (SLogicSubplan*)pNode;
nodesDestroyList(pSubplan->pChildren); nodesDestroyList(pSubplan->pChildren);
nodesDestroyNode(pSubplan->pNode); nodesDestroyNode(pSubplan->pNode);
nodesClearList(pSubplan->pParents);
taosMemoryFreeClear(pSubplan->pVgroupList); taosMemoryFreeClear(pSubplan->pVgroupList);
break; break;
} }
@ -591,11 +591,28 @@ void nodesDestroyNode(SNodeptr pNode) {
nodesDestroyList(pSubplan->pChildren); nodesDestroyList(pSubplan->pChildren);
nodesDestroyNode(pSubplan->pNode); nodesDestroyNode(pSubplan->pNode);
nodesDestroyNode(pSubplan->pDataSink); nodesDestroyNode(pSubplan->pDataSink);
nodesClearList(pSubplan->pParents);
break; break;
} }
case QUERY_NODE_PHYSICAL_PLAN: case QUERY_NODE_PHYSICAL_PLAN: {
nodesDestroyList(((SQueryPlan*)pNode)->pSubplans); SQueryPlan* pPlan = (SQueryPlan*)pNode;
if (NULL != pPlan->pSubplans) {
// only need to destroy the top-level subplans, because they will recurse to all the subplans below
bool first = true;
SNode* pElement = NULL;
FOREACH(pElement, pPlan->pSubplans) {
if (first) {
first = false;
nodesDestroyNode(pElement);
} else {
nodesClearList(((SNodeListNode*)pElement)->pNodeList);
taosMemoryFreeClear(pElement);
}
}
nodesClearList(pPlan->pSubplans);
}
break; break;
}
default: default:
break; break;
} }

View File

@ -692,7 +692,7 @@ static int32_t createVnodeModifLogicNode(SLogicPlanContext* pCxt, SVnodeModifOpS
if (NULL == pModif) { if (NULL == pModif) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
pModif->pDataBlocks = pStmt->pDataBlocks; TSWAP(pModif->pDataBlocks, pStmt->pDataBlocks, SArray*);
pModif->msgType = getMsgType(pStmt->sqlNodeType); pModif->msgType = getMsgType(pStmt->sqlNodeType);
*pLogicNode = (SLogicNode*)pModif; *pLogicNode = (SLogicNode*)pModif;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;

View File

@ -1083,7 +1083,11 @@ static int32_t doCreatePhysiPlan(SPhysiPlanContext* pCxt, SQueryLogicPlan* pLogi
static void destoryLocationHash(void* p) { static void destoryLocationHash(void* p) {
SHashObj* pHash = *(SHashObj**)p; SHashObj* pHash = *(SHashObj**)p;
// todo SSlotIndex* pIndex = taosHashIterate(pHash, NULL);
while (NULL != pIndex) {
taosArrayDestroy(pIndex->pSlotIdsInfo);
pIndex = taosHashIterate(pHash, pIndex);
}
taosHashCleanup(pHash); taosHashCleanup(pHash);
} }

View File

@ -140,6 +140,7 @@ static int32_t stsSplit(SSplitContext* pCxt) {
code = stsCreateExchangeNode(pCxt, pInfo->pSubplan, pInfo->pScan); code = stsCreateExchangeNode(pCxt, pInfo->pSubplan, pInfo->pScan);
} }
++(pCxt->groupId); ++(pCxt->groupId);
taosMemoryFreeClear(pCxt->pInfo);
return code; return code;
} }