fix(query): fix memory leak.
This commit is contained in:
parent
6115d3dbe8
commit
1d8af5d4cf
|
@ -165,15 +165,6 @@ int32_t qGetQualifiedTableIdList(void* pTableList, const char* tagCond, int32_t
|
||||||
*/
|
*/
|
||||||
int32_t qUpdateQueriedTableIdList(qTaskInfo_t tinfo, int64_t uid, int32_t type);
|
int32_t qUpdateQueriedTableIdList(qTaskInfo_t tinfo, int64_t uid, int32_t type);
|
||||||
|
|
||||||
/**
|
|
||||||
* release the query handle and decrease the reference count in cache
|
|
||||||
* @param pMgmt
|
|
||||||
* @param pQInfo
|
|
||||||
* @param freeHandle
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
void** qReleaseTask(void* pMgmt, void* pQInfo, bool freeHandle);
|
|
||||||
|
|
||||||
void qProcessFetchRsp(void* parent, struct SRpcMsg* pMsg, struct SEpSet* pEpSet);
|
void qProcessFetchRsp(void* parent, struct SRpcMsg* pMsg, struct SEpSet* pEpSet);
|
||||||
|
|
||||||
int32_t qGetExplainExecInfo(qTaskInfo_t tinfo, int32_t *resNum, SExplainExecInfo **pRes);
|
int32_t qGetExplainExecInfo(qTaskInfo_t tinfo, int32_t *resNum, SExplainExecInfo **pRes);
|
||||||
|
|
|
@ -4184,6 +4184,7 @@ static void destroyOperatorInfo(SOperatorInfo* pOperator) {
|
||||||
pOperator->numOfDownstream = 0;
|
pOperator->numOfDownstream = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosMemoryFree(pOperator->pExpr);
|
||||||
taosMemoryFreeClear(pOperator->info);
|
taosMemoryFreeClear(pOperator->info);
|
||||||
taosMemoryFreeClear(pOperator);
|
taosMemoryFreeClear(pOperator);
|
||||||
}
|
}
|
||||||
|
@ -4195,8 +4196,6 @@ int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t n
|
||||||
pAggSup->resultRowSize = getResultRowSize(pCtx, numOfOutput);
|
pAggSup->resultRowSize = getResultRowSize(pCtx, numOfOutput);
|
||||||
pAggSup->keyBuf = taosMemoryCalloc(1, keyBufSize + POINTER_BYTES + sizeof(int64_t));
|
pAggSup->keyBuf = taosMemoryCalloc(1, keyBufSize + POINTER_BYTES + sizeof(int64_t));
|
||||||
pAggSup->pResultRowHashTable = taosHashInit(10, hashFn, true, HASH_NO_LOCK);
|
pAggSup->pResultRowHashTable = taosHashInit(10, hashFn, true, HASH_NO_LOCK);
|
||||||
// pAggSup->pResultRowListSet = taosHashInit(100, hashFn, false, HASH_NO_LOCK);
|
|
||||||
// pAggSup->pResultRowArrayList = taosArrayInit(10, sizeof(SResultRowCell));
|
|
||||||
|
|
||||||
if (pAggSup->keyBuf == NULL /*|| pAggSup->pResultRowArrayList == NULL || pAggSup->pResultRowListSet == NULL*/ ||
|
if (pAggSup->keyBuf == NULL /*|| pAggSup->pResultRowArrayList == NULL || pAggSup->pResultRowListSet == NULL*/ ||
|
||||||
pAggSup->pResultRowHashTable == NULL) {
|
pAggSup->pResultRowHashTable == NULL) {
|
||||||
|
@ -4358,6 +4357,7 @@ void destroySFillOperatorInfo(void* param, int32_t numOfOutput) {
|
||||||
static void destroyProjectOperatorInfo(void* param, int32_t numOfOutput) {
|
static void destroyProjectOperatorInfo(void* param, int32_t numOfOutput) {
|
||||||
SProjectOperatorInfo* pInfo = (SProjectOperatorInfo*)param;
|
SProjectOperatorInfo* pInfo = (SProjectOperatorInfo*)param;
|
||||||
doDestroyBasicInfo(&pInfo->binfo, numOfOutput);
|
doDestroyBasicInfo(&pInfo->binfo, numOfOutput);
|
||||||
|
cleanupAggSup(&pInfo->aggSup);
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroyExchangeOperatorInfo(void* param, int32_t numOfOutput) {
|
void destroyExchangeOperatorInfo(void* param, int32_t numOfOutput) {
|
||||||
|
@ -4687,7 +4687,7 @@ static SExecTaskInfo* createExecTaskInfo(uint64_t queryId, uint64_t taskId, EOPT
|
||||||
|
|
||||||
char* p = taosMemoryCalloc(1, 128);
|
char* p = taosMemoryCalloc(1, 128);
|
||||||
snprintf(p, 128, "TID:0x%" PRIx64 " QID:0x%" PRIx64, taskId, queryId);
|
snprintf(p, 128, "TID:0x%" PRIx64 " QID:0x%" PRIx64, taskId, queryId);
|
||||||
pTaskInfo->id.str = strdup(p);
|
pTaskInfo->id.str = p;
|
||||||
|
|
||||||
return pTaskInfo;
|
return pTaskInfo;
|
||||||
}
|
}
|
||||||
|
@ -5287,6 +5287,7 @@ void doDestroyTask(SExecTaskInfo* pTaskInfo) {
|
||||||
qDebug("%s execTask is freed", GET_TASKID(pTaskInfo));
|
qDebug("%s execTask is freed", GET_TASKID(pTaskInfo));
|
||||||
|
|
||||||
doDestroyTableQueryInfo(&pTaskInfo->tableqinfoGroupInfo);
|
doDestroyTableQueryInfo(&pTaskInfo->tableqinfoGroupInfo);
|
||||||
|
destroyOperatorInfo(pTaskInfo->pRoot);
|
||||||
// taosArrayDestroy(pTaskInfo->summary.queryProfEvents);
|
// taosArrayDestroy(pTaskInfo->summary.queryProfEvents);
|
||||||
// taosHashCleanup(pTaskInfo->summary.operatorProfResults);
|
// taosHashCleanup(pTaskInfo->summary.operatorProfResults);
|
||||||
|
|
||||||
|
|
|
@ -670,6 +670,8 @@ static void destroySysScanOperator(void* param, int32_t numOfOutput) {
|
||||||
if (strncasecmp(name, TSDB_INS_TABLE_USER_TABLES, TSDB_TABLE_FNAME_LEN) == 0) {
|
if (strncasecmp(name, TSDB_INS_TABLE_USER_TABLES, TSDB_TABLE_FNAME_LEN) == 0) {
|
||||||
metaCloseTbCursor(pInfo->pCur);
|
metaCloseTbCursor(pInfo->pCur);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosArrayDestroy(pInfo->scanCols);
|
||||||
}
|
}
|
||||||
|
|
||||||
EDealRes getDBNameFromConditionWalker(SNode* pNode, void* pContext) {
|
EDealRes getDBNameFromConditionWalker(SNode* pNode, void* pContext) {
|
||||||
|
@ -1248,6 +1250,11 @@ static SSDataBlock* doTagScan(SOperatorInfo* pOperator) {
|
||||||
SExprInfo* pExprInfo = &pOperator->pExpr[0];
|
SExprInfo* pExprInfo = &pOperator->pExpr[0];
|
||||||
SSDataBlock* pRes = pInfo->pRes;
|
SSDataBlock* pRes = pInfo->pRes;
|
||||||
|
|
||||||
|
if (taosArrayGetSize(pInfo->pTableGroups->pGroupList) == 0) {
|
||||||
|
setTaskStatus(pTaskInfo, TASK_COMPLETED);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
SArray* pa = taosArrayGetP(pInfo->pTableGroups->pGroupList, 0);
|
SArray* pa = taosArrayGetP(pInfo->pTableGroups->pGroupList, 0);
|
||||||
|
|
||||||
char str[512] = {0};
|
char str[512] = {0};
|
||||||
|
|
Loading…
Reference in New Issue