[vnode] Fix a few error handling as well as memory leak
1. Fix error handling in vnodeProcessQueryMsg() where qCreateQueryInfo() fails. 2. Inside qCreateQueryInfo(), cleanup pQInfo upon failure, also add a missing goto statement.
This commit is contained in:
parent
5f132980e8
commit
f38f691796
|
@ -6131,6 +6131,7 @@ int32_t qCreateQueryInfo(void *tsdb, int32_t vgId, SQueryTableMsg *pQueryMsg, qi
|
||||||
(*pQInfo) = createQInfoImpl(pQueryMsg, pGroupbyExpr, pExprs, &groupInfo, pTagColumnInfo);
|
(*pQInfo) = createQInfoImpl(pQueryMsg, pGroupbyExpr, pExprs, &groupInfo, pTagColumnInfo);
|
||||||
if ((*pQInfo) == NULL) {
|
if ((*pQInfo) == NULL) {
|
||||||
code = TSDB_CODE_SERV_OUT_OF_MEMORY;
|
code = TSDB_CODE_SERV_OUT_OF_MEMORY;
|
||||||
|
goto _query_over;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = initQInfo(pQueryMsg, tsdb, vgId, *pQInfo, isSTableQuery);
|
code = initQInfo(pQueryMsg, tsdb, vgId, *pQInfo, isSTableQuery);
|
||||||
|
@ -6140,6 +6141,11 @@ _query_over:
|
||||||
tfree(tbnameCond);
|
tfree(tbnameCond);
|
||||||
taosArrayDestroy(pTableIdList);
|
taosArrayDestroy(pTableIdList);
|
||||||
|
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
tfree(*pQInfo);
|
||||||
|
*pQInfo = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// if failed to add ref for all meters in this query, abort current query
|
// if failed to add ref for all meters in this query, abort current query
|
||||||
// atomic_fetch_add_32(&vnodeSelectReqNum, 1);
|
// atomic_fetch_add_32(&vnodeSelectReqNum, 1);
|
||||||
return code;
|
return code;
|
||||||
|
|
|
@ -67,11 +67,14 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, void *pCont, int32_t cont
|
||||||
|
|
||||||
dTrace("pVnode:%p vgId:%d QInfo:%p, dnode query msg disposed", pVnode, pVnode->vgId, pQInfo);
|
dTrace("pVnode:%p vgId:%d QInfo:%p, dnode query msg disposed", pVnode, pVnode->vgId, pQInfo);
|
||||||
} else {
|
} else {
|
||||||
|
assert(pCont != NULL);
|
||||||
pQInfo = pCont;
|
pQInfo = pCont;
|
||||||
code = TSDB_CODE_ACTION_IN_PROGRESS;
|
code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pQInfo != NULL) {
|
||||||
qTableQuery(pQInfo); // do execute query
|
qTableQuery(pQInfo); // do execute query
|
||||||
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue