fix querytask.c memory leak when random malloc error
remove (void)
This commit is contained in:
parent
dc9bde6838
commit
38e8d9f2fa
|
@ -174,10 +174,14 @@ static void tRSmaInfoHashFreeNode(void *data) {
|
||||||
|
|
||||||
if ((pRSmaInfo = *(SRSmaInfo **)data)) {
|
if ((pRSmaInfo = *(SRSmaInfo **)data)) {
|
||||||
if ((pItem = RSMA_INFO_ITEM((SRSmaInfo *)pRSmaInfo, 0)) && pItem->level) {
|
if ((pItem = RSMA_INFO_ITEM((SRSmaInfo *)pRSmaInfo, 0)) && pItem->level) {
|
||||||
(void)taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES);
|
if (TSDB_CODE_SUCCESS != taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES)) {
|
||||||
|
smaError("failed to hash remove %s:%d", __FUNCTION__, __LINE__);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((pItem = RSMA_INFO_ITEM((SRSmaInfo *)pRSmaInfo, 1)) && pItem->level) {
|
if ((pItem = RSMA_INFO_ITEM((SRSmaInfo *)pRSmaInfo, 1)) && pItem->level) {
|
||||||
(void)taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES);
|
if (TSDB_CODE_SUCCESS != taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES)) {
|
||||||
|
smaError("failed to hash remove %s:%d", __FUNCTION__, __LINE__);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
(void)tdFreeRSmaInfo(pRSmaInfo->pSma, pRSmaInfo);
|
(void)tdFreeRSmaInfo(pRSmaInfo->pSma, pRSmaInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,10 +50,14 @@ int32_t streamTaskSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
|
||||||
}
|
}
|
||||||
|
|
||||||
STablePair pair1 = {.tbl = pTq->pStreamMeta->pTaskDb, .type = SNAP_DATA_STREAM_TASK};
|
STablePair pair1 = {.tbl = pTq->pStreamMeta->pTaskDb, .type = SNAP_DATA_STREAM_TASK};
|
||||||
(void)taosArrayPush(pReader->tdbTbList, &pair1);
|
if (NULL == taosArrayPush(pReader->tdbTbList, &pair1)) {
|
||||||
|
TAOS_CHECK_GOTO(terrno, NULL, _err);
|
||||||
|
}
|
||||||
|
|
||||||
STablePair pair2 = {.tbl = pTq->pStreamMeta->pCheckpointDb, .type = SNAP_DATA_STREAM_TASK_CHECKPOINT};
|
STablePair pair2 = {.tbl = pTq->pStreamMeta->pCheckpointDb, .type = SNAP_DATA_STREAM_TASK_CHECKPOINT};
|
||||||
(void)taosArrayPush(pReader->tdbTbList, &pair2);
|
if (NULL == taosArrayPush(pReader->tdbTbList, &pair2)) {
|
||||||
|
TAOS_CHECK_GOTO(terrno, NULL, _err);
|
||||||
|
}
|
||||||
|
|
||||||
pReader->pos = 0;
|
pReader->pos = 0;
|
||||||
|
|
||||||
|
|
|
@ -217,6 +217,7 @@ SSchemaWrapper* extractQueriedColumnSchema(SScanPhysiNode* pScanNode) {
|
||||||
|
|
||||||
pqSw->pSchema = taosMemoryCalloc(numOfCols + numOfTags, sizeof(SSchema));
|
pqSw->pSchema = taosMemoryCalloc(numOfCols + numOfTags, sizeof(SSchema));
|
||||||
if (pqSw->pSchema == NULL) {
|
if (pqSw->pSchema == NULL) {
|
||||||
|
taosMemoryFree(pqSw);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -409,16 +409,19 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
if (pCxt->currLevel == currTotalLevel) {
|
if (pCxt->currLevel == currTotalLevel) {
|
||||||
(void)taosArrayPush(pTables, &pTable);
|
if (NULL == taosArrayPush(pTables, &pTable)) {
|
||||||
|
taosArrayDestroy(pTables);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
if (hasSameTableAlias(pTables)) {
|
if (hasSameTableAlias(pTables)) {
|
||||||
(void)taosArrayDestroy(pTables);
|
taosArrayDestroy(pTables);
|
||||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS,
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS,
|
||||||
"Not unique table/alias: '%s'", ((STableNode*)pTable)->tableAlias);
|
"Not unique table/alias: '%s'", ((STableNode*)pTable)->tableAlias);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (NULL == taosArrayPush(pCxt->pNsLevel, &pTables)) {
|
if (NULL == taosArrayPush(pCxt->pNsLevel, &pTables)) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
(void)taosArrayDestroy(pTables);
|
taosArrayDestroy(pTables);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++currTotalLevel;
|
++currTotalLevel;
|
||||||
|
@ -820,7 +823,7 @@ static int32_t resetHighLevelTranslateNamespace(STranslateContext* pCxt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = size - 1; i >= pCxt->currLevel; --i) {
|
for (int32_t i = size - 1; i >= pCxt->currLevel; --i) {
|
||||||
(void)taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i));
|
taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i));
|
||||||
}
|
}
|
||||||
taosArrayPopTailBatch(pCxt->pNsLevel, levelNum);
|
taosArrayPopTailBatch(pCxt->pNsLevel, levelNum);
|
||||||
|
|
||||||
|
@ -837,9 +840,9 @@ static int32_t resetTranslateNamespace(STranslateContext* pCxt) {
|
||||||
if (NULL != pCxt->pNsLevel) {
|
if (NULL != pCxt->pNsLevel) {
|
||||||
size_t size = taosArrayGetSize(pCxt->pNsLevel);
|
size_t size = taosArrayGetSize(pCxt->pNsLevel);
|
||||||
for (size_t i = 0; i < size; ++i) {
|
for (size_t i = 0; i < size; ++i) {
|
||||||
(void)taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i));
|
taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i));
|
||||||
}
|
}
|
||||||
(void)taosArrayDestroy(pCxt->pNsLevel);
|
taosArrayDestroy(pCxt->pNsLevel);
|
||||||
}
|
}
|
||||||
pCxt->pNsLevel = taosArrayInit(TARRAY_MIN_SIZE, POINTER_BYTES);
|
pCxt->pNsLevel = taosArrayInit(TARRAY_MIN_SIZE, POINTER_BYTES);
|
||||||
if (NULL == pCxt->pNsLevel) {
|
if (NULL == pCxt->pNsLevel) {
|
||||||
|
@ -852,9 +855,9 @@ static void destroyTranslateContext(STranslateContext* pCxt) {
|
||||||
if (NULL != pCxt->pNsLevel) {
|
if (NULL != pCxt->pNsLevel) {
|
||||||
size_t size = taosArrayGetSize(pCxt->pNsLevel);
|
size_t size = taosArrayGetSize(pCxt->pNsLevel);
|
||||||
for (size_t i = 0; i < size; ++i) {
|
for (size_t i = 0; i < size; ++i) {
|
||||||
(void)taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i));
|
taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i));
|
||||||
}
|
}
|
||||||
(void)taosArrayDestroy(pCxt->pNsLevel);
|
taosArrayDestroy(pCxt->pNsLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != pCxt->pCmdMsg) {
|
if (NULL != pCxt->pCmdMsg) {
|
||||||
|
@ -1208,7 +1211,9 @@ static int32_t setColumnInfoByExpr(STempTableNode* pTable, SExprNode* pExpr, SCo
|
||||||
SAssociationNode assNode;
|
SAssociationNode assNode;
|
||||||
assNode.pPlace = (SNode**)pColRef;
|
assNode.pPlace = (SNode**)pColRef;
|
||||||
assNode.pAssociationNode = (SNode*)*pColRef;
|
assNode.pAssociationNode = (SNode*)*pColRef;
|
||||||
(void)taosArrayPush(pExpr->pAssociation, &assNode);
|
if (NULL == taosArrayPush(pExpr->pAssociation, &assNode)) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
strcpy(pCol->tableAlias, pTable->table.tableAlias);
|
strcpy(pCol->tableAlias, pTable->table.tableAlias);
|
||||||
pCol->isPrimTs = isPrimaryKeyImpl((SNode*)pExpr);
|
pCol->isPrimTs = isPrimaryKeyImpl((SNode*)pExpr);
|
||||||
|
@ -3882,7 +3887,7 @@ static int32_t setVnodeSysTableVgroupList(STranslateContext* pCxt, SName* pName,
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = toVgroupsInfo(pVgs, &pRealTable->pVgroupList);
|
code = toVgroupsInfo(pVgs, &pRealTable->pVgroupList);
|
||||||
}
|
}
|
||||||
(void)taosArrayDestroy(pVgs);
|
taosArrayDestroy(pVgs);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -3893,7 +3898,7 @@ static int32_t setDnodeSysTableVgroupList(STranslateContext* pCxt, SName* pName,
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = dnodeToVgroupsInfo(pDnodes, &pRealTable->pVgroupList);
|
code = dnodeToVgroupsInfo(pDnodes, &pRealTable->pVgroupList);
|
||||||
}
|
}
|
||||||
(void)taosArrayDestroy(pDnodes);
|
taosArrayDestroy(pDnodes);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3913,7 +3918,7 @@ static int32_t setSuperTableVgroupList(STranslateContext* pCxt, SName* pName, SR
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = toVgroupsInfo(vgroupList, &pRealTable->pVgroupList);
|
code = toVgroupsInfo(vgroupList, &pRealTable->pVgroupList);
|
||||||
}
|
}
|
||||||
(void)taosArrayDestroy(vgroupList);
|
taosArrayDestroy(vgroupList);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4033,7 +4038,10 @@ static int32_t setTableTsmas(STranslateContext* pCxt, SName* pName, SRealTableNo
|
||||||
}
|
}
|
||||||
pVgpsInfo->numOfVgroups = 1;
|
pVgpsInfo->numOfVgroups = 1;
|
||||||
pVgpsInfo->vgroups[0] = vgInfo;
|
pVgpsInfo->vgroups[0] = vgInfo;
|
||||||
(void)taosArrayPush(pRealTable->tsmaTargetTbVgInfo, &pVgpsInfo);
|
if (NULL == taosArrayPush(pRealTable->tsmaTargetTbVgInfo, &pVgpsInfo)) {
|
||||||
|
code = terrno;
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4062,7 +4070,10 @@ static int32_t setTableTsmas(STranslateContext* pCxt, SName* pName, SRealTableNo
|
||||||
// ignore table not exists error
|
// ignore table not exists error
|
||||||
code = TSDB_CODE_SUCCESS;
|
code = TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
(void)taosArrayPush(pRealTable->tsmaTargetTbInfo, &ctbInfo);
|
if (NULL == taosArrayPush(pRealTable->tsmaTargetTbInfo, &ctbInfo)) {
|
||||||
|
code = terrno;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5991,20 +6002,26 @@ static int32_t isOperatorEqTbnameCond(STranslateContext* pCxt, SOperatorNode* pO
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* pTableAlias = NULL;
|
||||||
if (LIST_LENGTH(pTbnameFunc->pParameterList) == 0) {
|
if (LIST_LENGTH(pTbnameFunc->pParameterList) == 0) {
|
||||||
*ppTableAlias = NULL;
|
|
||||||
} else if (LIST_LENGTH(pTbnameFunc->pParameterList) == 1) {
|
} else if (LIST_LENGTH(pTbnameFunc->pParameterList) == 1) {
|
||||||
SNode* pQualNode = nodesListGetNode(pTbnameFunc->pParameterList, 0);
|
SNode* pQualNode = nodesListGetNode(pTbnameFunc->pParameterList, 0);
|
||||||
if (nodeType(pQualNode) != QUERY_NODE_VALUE) return false;
|
if (nodeType(pQualNode) != QUERY_NODE_VALUE) return false;
|
||||||
SValueNode* pQualValNode = (SValueNode*)pQualNode;
|
SValueNode* pQualValNode = (SValueNode*)pQualNode;
|
||||||
*ppTableAlias = pQualValNode->literal;
|
pTableAlias = pQualValNode->literal;
|
||||||
} else {
|
} else {
|
||||||
*pRet = false;
|
*pRet = false;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
*ppTabNames = taosArrayInit(1, sizeof(void*));
|
SArray* pTabNames = NULL;
|
||||||
if (!*ppTabNames) return TSDB_CODE_OUT_OF_MEMORY;
|
pTabNames = taosArrayInit(1, sizeof(void*));
|
||||||
(void)taosArrayPush(*ppTabNames, &(pValueNode->literal));
|
if (!pTabNames) return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
if (NULL == taosArrayPush(pTabNames, &(pValueNode->literal))) {
|
||||||
|
taosArrayDestroy(pTabNames);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
*ppTableAlias = pTableAlias;
|
||||||
|
*ppTabNames = pTabNames;
|
||||||
*pRet = true;
|
*pRet = true;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -6042,7 +6059,11 @@ static int32_t isOperatorTbnameInCond(STranslateContext* pCxt, SOperatorNode* pO
|
||||||
*pRet = false;
|
*pRet = false;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
(void)taosArrayPush(*ppTbNames, &((SValueNode*)pValNode)->literal);
|
if (NULL == taosArrayPush(*ppTbNames, &((SValueNode*)pValNode)->literal)) {
|
||||||
|
taosArrayDestroy(*ppTbNames);
|
||||||
|
*ppTbNames = NULL;
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*pRet = true;
|
*pRet = true;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -6070,7 +6091,7 @@ static int32_t findEqCondTbNameInOperatorNode(STranslateContext* pCxt, SNode* pW
|
||||||
*pRet = true;
|
*pRet = true;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
(void)taosArrayDestroy(pInfo->aTbnames);
|
taosArrayDestroy(pInfo->aTbnames);
|
||||||
pInfo->aTbnames = NULL;
|
pInfo->aTbnames = NULL;
|
||||||
}
|
}
|
||||||
*pRet = false;
|
*pRet = false;
|
||||||
|
@ -6104,7 +6125,7 @@ static int32_t findEqualCondTbnameInLogicCondAnd(STranslateContext* pCxt, SNode*
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
(void)taosArrayDestroy(info.aTbnames);
|
taosArrayDestroy(info.aTbnames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6123,7 +6144,7 @@ static int32_t unionEqualCondTbnamesOfSameTable(SArray* aTableTbnames, SEqCondTb
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
(void)taosArrayDestroy(pInfo->aTbnames);
|
taosArrayDestroy(pInfo->aTbnames);
|
||||||
pInfo->aTbnames = NULL;
|
pInfo->aTbnames = NULL;
|
||||||
bFoundTable = true;
|
bFoundTable = true;
|
||||||
break;
|
break;
|
||||||
|
@ -6163,7 +6184,7 @@ static int32_t findEqualCondTbnameInLogicCondOr(STranslateContext* pCxt, SNode*
|
||||||
if (TSDB_CODE_SUCCESS == code && !bAllTbName) {
|
if (TSDB_CODE_SUCCESS == code && !bAllTbName) {
|
||||||
for (int i = 0; i < taosArrayGetSize(aTableTbnames); ++i) {
|
for (int i = 0; i < taosArrayGetSize(aTableTbnames); ++i) {
|
||||||
SEqCondTbNameTableInfo* pInfo = taosArrayGet(aTableTbnames, i);
|
SEqCondTbNameTableInfo* pInfo = taosArrayGet(aTableTbnames, i);
|
||||||
(void)taosArrayDestroy(pInfo->aTbnames);
|
taosArrayDestroy(pInfo->aTbnames);
|
||||||
pInfo->aTbnames = NULL;
|
pInfo->aTbnames = NULL;
|
||||||
}
|
}
|
||||||
taosArrayClear(aTableTbnames);
|
taosArrayClear(aTableTbnames);
|
||||||
|
@ -6326,7 +6347,10 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt*
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
(void)taosArrayPush(pTbNames, &pNewTbName);
|
if (NULL == taosArrayPush(pTbNames, &pNewTbName)) {
|
||||||
|
code = terrno;
|
||||||
|
break;
|
||||||
|
}
|
||||||
sprintf(pNewTbName, "%s.%s_%s", pTsma->dbFName, pTsma->name, pTbName);
|
sprintf(pNewTbName, "%s.%s_%s", pTsma->dbFName, pTsma->name, pTbName);
|
||||||
int32_t len = taosCreateMD5Hash(pNewTbName, strlen(pNewTbName));
|
int32_t len = taosCreateMD5Hash(pNewTbName, strlen(pNewTbName));
|
||||||
}
|
}
|
||||||
|
@ -6337,7 +6361,9 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt*
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
findVgroupsFromEqualTbname(pCxt, pTbNames, pInfo->pRealTable->table.dbName, numOfVgs, vgsInfo);
|
findVgroupsFromEqualTbname(pCxt, pTbNames, pInfo->pRealTable->table.dbName, numOfVgs, vgsInfo);
|
||||||
if (vgsInfo->numOfVgroups != 0) {
|
if (vgsInfo->numOfVgroups != 0) {
|
||||||
(void)taosArrayPush(pInfo->pRealTable->tsmaTargetTbVgInfo, &vgsInfo);
|
if (NULL == taosArrayPush(pInfo->pRealTable->tsmaTargetTbVgInfo, &vgsInfo)) {
|
||||||
|
code = terrno;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
taosMemoryFree(vgsInfo);
|
taosMemoryFree(vgsInfo);
|
||||||
}
|
}
|
||||||
|
@ -6366,9 +6392,9 @@ static int32_t setTableVgroupsFromEqualTbnameCond(STranslateContext* pCxt, SSele
|
||||||
}
|
}
|
||||||
for (int i = 0; i < taosArrayGetSize(aTables); ++i) {
|
for (int i = 0; i < taosArrayGetSize(aTables); ++i) {
|
||||||
SEqCondTbNameTableInfo* pInfo = taosArrayGet(aTables, i);
|
SEqCondTbNameTableInfo* pInfo = taosArrayGet(aTables, i);
|
||||||
(void)taosArrayDestroy(pInfo->aTbnames);
|
taosArrayDestroy(pInfo->aTbnames);
|
||||||
}
|
}
|
||||||
(void)taosArrayDestroy(aTables);
|
taosArrayDestroy(aTables);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7968,7 +7994,7 @@ static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
(void)taosArrayDestroy(*pArray);
|
taosArrayDestroy(*pArray);
|
||||||
*pArray = NULL;
|
*pArray = NULL;
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
|
@ -7992,7 +8018,11 @@ static int32_t tagDefNodeToField(SNodeList* pList, SArray** pArray, bool calByte
|
||||||
if (pCol->sma) {
|
if (pCol->sma) {
|
||||||
field.flags |= COL_SMA_ON;
|
field.flags |= COL_SMA_ON;
|
||||||
}
|
}
|
||||||
(void)taosArrayPush(*pArray, &field);
|
if (NULL == taosArrayPush(*pArray, &field)) {
|
||||||
|
taosArrayDestroy(*pArray);
|
||||||
|
*pArray = NULL;
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -8734,7 +8764,13 @@ static int32_t buildRollupFuncs(SNodeList* pFuncs, SArray** pArray) {
|
||||||
*pArray = taosArrayInit(LIST_LENGTH(pFuncs), TSDB_FUNC_NAME_LEN);
|
*pArray = taosArrayInit(LIST_LENGTH(pFuncs), TSDB_FUNC_NAME_LEN);
|
||||||
if (!*pArray) return TSDB_CODE_OUT_OF_MEMORY;
|
if (!*pArray) return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SNode* pNode;
|
SNode* pNode;
|
||||||
FOREACH(pNode, pFuncs) { (void)taosArrayPush(*pArray, ((SFunctionNode*)pNode)->functionName); }
|
FOREACH(pNode, pFuncs) {
|
||||||
|
if (NULL == taosArrayPush(*pArray, ((SFunctionNode*)pNode)->functionName)) {
|
||||||
|
taosArrayDestroy(*pArray);
|
||||||
|
*pArray = NULL;
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8899,7 +8935,7 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt*
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: {
|
case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: {
|
||||||
(void)taosArrayDestroy(pAlterReq->pFields);
|
taosArrayDestroy(pAlterReq->pFields);
|
||||||
|
|
||||||
pAlterReq->pFields = taosArrayInit(1, sizeof(SFieldWithOptions));
|
pAlterReq->pFields = taosArrayInit(1, sizeof(SFieldWithOptions));
|
||||||
if (!pAlterReq->pFields) return TSDB_CODE_OUT_OF_MEMORY;
|
if (!pAlterReq->pFields) return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -10593,7 +10629,7 @@ static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList** ppC
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
(void)taosArrayDestroy(pProjColPos);
|
taosArrayDestroy(pProjColPos);
|
||||||
nodesDestroyList(*pProjections);
|
nodesDestroyList(*pProjections);
|
||||||
nodesDestroyList(*ppCols);
|
nodesDestroyList(*ppCols);
|
||||||
*pProjections = pNewProjections;
|
*pProjections = pNewProjections;
|
||||||
|
@ -10705,7 +10741,7 @@ static int32_t adjustOrderOfTags(STranslateContext* pCxt, SNodeList* pTags, cons
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
(void)taosArrayDestroy(pTagPos);
|
taosArrayDestroy(pTagPos);
|
||||||
nodesDestroyList(*pTagExprs);
|
nodesDestroyList(*pTagExprs);
|
||||||
*pTagExprs = pNewTagExprs;
|
*pTagExprs = pNewTagExprs;
|
||||||
} else {
|
} else {
|
||||||
|
@ -13331,7 +13367,7 @@ static void destroyCreateTbReqBatch(void* data) {
|
||||||
tdDestroySVCreateTbReq(pTableReq);
|
tdDestroySVCreateTbReq(pTableReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosArrayDestroy(pTbBatch->req.pArray);
|
taosArrayDestroy(pTbBatch->req.pArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray) {
|
int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray) {
|
||||||
|
@ -13354,7 +13390,7 @@ static void destroyCreateTbReqArray(SArray* pArray) {
|
||||||
taosMemoryFreeClear(pVg->pData);
|
taosMemoryFreeClear(pVg->pData);
|
||||||
taosMemoryFreeClear(pVg);
|
taosMemoryFreeClear(pVg);
|
||||||
}
|
}
|
||||||
(void)taosArrayDestroy(pArray);
|
taosArrayDestroy(pArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t buildCreateTableDataBlock(int32_t acctId, const SCreateTableStmt* pStmt, const SVgroupInfo* pInfo,
|
static int32_t buildCreateTableDataBlock(int32_t acctId, const SCreateTableStmt* pStmt, const SVgroupInfo* pInfo,
|
||||||
|
@ -13443,12 +13479,12 @@ static int32_t addCreateTbReqIntoVgroup(SHashObj* pVgroupHashmap, const char* db
|
||||||
if (!tBatch.req.pArray) {
|
if (!tBatch.req.pArray) {
|
||||||
code = terrno;
|
code = terrno;
|
||||||
} else if (NULL == taosArrayPush(tBatch.req.pArray, &req)) {
|
} else if (NULL == taosArrayPush(tBatch.req.pArray, &req)) {
|
||||||
(void)taosArrayDestroy(tBatch.req.pArray);
|
taosArrayDestroy(tBatch.req.pArray);
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
} else {
|
} else {
|
||||||
code = taosHashPut(pVgroupHashmap, &pVgInfo->vgId, sizeof(pVgInfo->vgId), &tBatch, sizeof(tBatch));
|
code = taosHashPut(pVgroupHashmap, &pVgInfo->vgId, sizeof(pVgInfo->vgId), &tBatch, sizeof(tBatch));
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
(void)taosArrayDestroy(tBatch.req.pArray);
|
taosArrayDestroy(tBatch.req.pArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // add to the correct vgroup
|
} else { // add to the correct vgroup
|
||||||
|
@ -13545,7 +13581,7 @@ static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableCla
|
||||||
taosMemoryFreeClear(p->pData);
|
taosMemoryFreeClear(p->pData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void)taosArrayDestroy(pTagArray);
|
taosArrayDestroy(pTagArray);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13608,7 +13644,7 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau
|
||||||
taosMemoryFreeClear(p->pData);
|
taosMemoryFreeClear(p->pData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void)taosArrayDestroy(pTagArray);
|
taosArrayDestroy(pTagArray);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13659,7 +13695,7 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla
|
||||||
taosMemoryFree(pTag);
|
taosMemoryFree(pTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosArrayDestroy(tagName);
|
taosArrayDestroy(tagName);
|
||||||
taosMemoryFreeClear(pSuperTableMeta);
|
taosMemoryFreeClear(pSuperTableMeta);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -14066,10 +14102,9 @@ _ERR:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t resetParseFileContext(SParseFileContext* pParFileCxt) {
|
static void resetParseFileContext(SParseFileContext* pParFileCxt) {
|
||||||
taosArrayClear(pParFileCxt->aCreateTbData);
|
taosArrayClear(pParFileCxt->aCreateTbData);
|
||||||
taosArrayClearEx(pParFileCxt->aTagVals, clearTagValArrayFp);
|
taosArrayClearEx(pParFileCxt->aTagVals, clearTagValArrayFp);
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t createSubTableFromFile(SMsgBuf* pMsgBuf, SParseContext* pParseCxt, SVnodeModifyOpStmt* pModifyStmt) {
|
static int32_t createSubTableFromFile(SMsgBuf* pMsgBuf, SParseContext* pParseCxt, SVnodeModifyOpStmt* pModifyStmt) {
|
||||||
|
@ -14104,7 +14139,7 @@ static int32_t createSubTableFromFile(SMsgBuf* pMsgBuf, SParseContext* pParseCxt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)resetParseFileContext(pModifyStmt->pParFileCxt);
|
resetParseFileContext(pModifyStmt->pParFileCxt);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -14132,7 +14167,7 @@ int32_t serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap, SArray** pOut
|
||||||
} while (true);
|
} while (true);
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
(void)taosArrayDestroy(pBufArray);
|
taosArrayDestroy(pBufArray);
|
||||||
} else {
|
} else {
|
||||||
*pOut = pBufArray;
|
*pOut = pBufArray;
|
||||||
}
|
}
|
||||||
|
@ -14258,14 +14293,14 @@ static int32_t addDropTbReqIntoVgroup(SHashObj* pVgroupHashmap, SVgroupInfo* pVg
|
||||||
tBatch.info = *pVgInfo;
|
tBatch.info = *pVgInfo;
|
||||||
tBatch.req.pArray = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SVDropTbReq));
|
tBatch.req.pArray = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SVDropTbReq));
|
||||||
if (NULL == taosArrayPush(tBatch.req.pArray, pReq)) {
|
if (NULL == taosArrayPush(tBatch.req.pArray, pReq)) {
|
||||||
(void)taosArrayDestroy(tBatch.req.pArray);
|
taosArrayDestroy(tBatch.req.pArray);
|
||||||
tBatch.req.pArray = NULL;
|
tBatch.req.pArray = NULL;
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = taosHashPut(pVgroupHashmap, &pVgInfo->vgId, sizeof(pVgInfo->vgId), &tBatch, sizeof(tBatch));
|
code = taosHashPut(pVgroupHashmap, &pVgInfo->vgId, sizeof(pVgInfo->vgId), &tBatch, sizeof(tBatch));
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
(void)taosArrayDestroy(tBatch.req.pArray);
|
taosArrayDestroy(tBatch.req.pArray);
|
||||||
tBatch.req.pArray = NULL;
|
tBatch.req.pArray = NULL;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -14312,7 +14347,7 @@ over:
|
||||||
|
|
||||||
static void destroyDropTbReqBatch(void* data) {
|
static void destroyDropTbReqBatch(void* data) {
|
||||||
SVgroupDropTableBatch* pTbBatch = (SVgroupDropTableBatch*)data;
|
SVgroupDropTableBatch* pTbBatch = (SVgroupDropTableBatch*)data;
|
||||||
(void)taosArrayDestroy(pTbBatch->req.pArray);
|
taosArrayDestroy(pTbBatch->req.pArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t serializeVgroupDropTableBatch(SVgroupDropTableBatch* pTbBatch, SArray* pBufArray) {
|
static int32_t serializeVgroupDropTableBatch(SVgroupDropTableBatch* pTbBatch, SArray* pBufArray) {
|
||||||
|
@ -14374,7 +14409,7 @@ int32_t serializeVgroupsDropTableBatch(SHashObj* pVgroupHashmap, SArray** pOut)
|
||||||
code = serializeVgroupDropTableBatch(pTbBatch, pBufArray);
|
code = serializeVgroupDropTableBatch(pTbBatch, pBufArray);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
taosHashCancelIterate(pVgroupHashmap, pTbBatch);
|
taosHashCancelIterate(pVgroupHashmap, pTbBatch);
|
||||||
(void)taosArrayDestroy(pBufArray);
|
taosArrayDestroy(pBufArray);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (true);
|
} while (true);
|
||||||
|
@ -14452,7 +14487,7 @@ static int32_t rewriteDropTable(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = buildCmdMsg(pCxt, TDMT_MND_DROP_TB_WITH_TSMA, (FSerializeFunc)tSerializeSMDropTbsReq, &req);
|
code = buildCmdMsg(pCxt, TDMT_MND_DROP_TB_WITH_TSMA, (FSerializeFunc)tSerializeSMDropTbsReq, &req);
|
||||||
}
|
}
|
||||||
(void)taosArrayDestroy(req.pVgReqs);
|
taosArrayDestroy(req.pVgReqs);
|
||||||
}
|
}
|
||||||
taosHashCleanup(pVgroupHashmap);
|
taosHashCleanup(pVgroupHashmap);
|
||||||
return code;
|
return code;
|
||||||
|
@ -14817,7 +14852,7 @@ static int32_t buildModifyVnodeArray(STranslateContext* pCxt, SAlterTableStmt* p
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
*pArray = pTmpArray;
|
*pArray = pTmpArray;
|
||||||
} else {
|
} else {
|
||||||
(void)taosArrayDestroy(pTmpArray);
|
taosArrayDestroy(pTmpArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
|
@ -14835,7 +14870,7 @@ static void destoryAlterTbReq(SVAlterTbReq* pReq) {
|
||||||
taosMemoryFreeClear(p->pData);
|
taosMemoryFreeClear(p->pData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void)taosArrayDestroy(pReq->pTagArray);
|
taosArrayDestroy(pReq->pTagArray);
|
||||||
if (pReq->tagFree) tTagFree((STag*)pReq->pTagVal);
|
if (pReq->tagFree) tTagFree((STag*)pReq->pTagVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14920,7 +14955,7 @@ static int32_t serializeFlushDb(SArray* pVgs, SArray** pOutput) {
|
||||||
for (int32_t i = 0; i < numOfVgs; ++i) {
|
for (int32_t i = 0; i < numOfVgs; ++i) {
|
||||||
int32_t code = serializeFlushVgroup((SVgroupInfo*)taosArrayGet(pVgs, i), pBufArray);
|
int32_t code = serializeFlushVgroup((SVgroupInfo*)taosArrayGet(pVgs, i), pBufArray);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
(void)taosArrayDestroy(pBufArray);
|
taosArrayDestroy(pBufArray);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14942,9 +14977,9 @@ static int32_t rewriteFlushDatabase(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
code = rewriteToVnodeModifyOpStmt(pQuery, pBufArray);
|
code = rewriteToVnodeModifyOpStmt(pQuery, pBufArray);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
(void)taosArrayDestroy(pBufArray);
|
taosArrayDestroy(pBufArray);
|
||||||
}
|
}
|
||||||
(void)taosArrayDestroy(pVgs);
|
taosArrayDestroy(pVgs);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15577,7 +15612,7 @@ static int32_t toMsgType(ENodeType type) {
|
||||||
|
|
||||||
static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) {
|
static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
if (NULL != pCxt->pDbs) {
|
if (NULL != pCxt->pDbs) {
|
||||||
(void)taosArrayDestroy(pQuery->pDbList);
|
taosArrayDestroy(pQuery->pDbList);
|
||||||
pQuery->pDbList = taosArrayInit(taosHashGetSize(pCxt->pDbs), TSDB_DB_FNAME_LEN);
|
pQuery->pDbList = taosArrayInit(taosHashGetSize(pCxt->pDbs), TSDB_DB_FNAME_LEN);
|
||||||
if (NULL == pQuery->pDbList) {
|
if (NULL == pQuery->pDbList) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -15593,7 +15628,7 @@ static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != pCxt->pTables) {
|
if (NULL != pCxt->pTables) {
|
||||||
(void)taosArrayDestroy(pQuery->pTableList);
|
taosArrayDestroy(pQuery->pTableList);
|
||||||
pQuery->pTableList = taosArrayInit(taosHashGetSize(pCxt->pTables), sizeof(SName));
|
pQuery->pTableList = taosArrayInit(taosHashGetSize(pCxt->pTables), sizeof(SName));
|
||||||
if (NULL == pQuery->pTableList) {
|
if (NULL == pQuery->pTableList) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -15609,7 +15644,7 @@ static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != pCxt->pTargetTables) {
|
if (NULL != pCxt->pTargetTables) {
|
||||||
(void)taosArrayDestroy(pQuery->pTargetTableList);
|
taosArrayDestroy(pQuery->pTargetTableList);
|
||||||
pQuery->pTargetTableList = taosArrayInit(taosHashGetSize(pCxt->pTargetTables), sizeof(SName));
|
pQuery->pTargetTableList = taosArrayInit(taosHashGetSize(pCxt->pTargetTables), sizeof(SName));
|
||||||
if (NULL == pQuery->pTargetTableList) {
|
if (NULL == pQuery->pTargetTableList) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
|
@ -1706,7 +1706,9 @@ EDealRes fltTreeToGroup(SNode *pNode, void *pContext) {
|
||||||
cell = cell->pNext;
|
cell = cell->pNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosArrayAddAll(ctx->group, preGroup);
|
if (NULL == taosArrayAddAll(ctx->group, preGroup)) {
|
||||||
|
FLT_ERR_JRET(terrno);
|
||||||
|
}
|
||||||
|
|
||||||
taosArrayDestroy(preGroup);
|
taosArrayDestroy(preGroup);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue