Merge pull request #27796 from taosdata/enh/TD-31691

Enh/td 31691
This commit is contained in:
Pan Wei 2024-09-11 13:47:43 +08:00 committed by GitHub
commit f9c8b6cd7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 131 additions and 134 deletions

View File

@ -13288,7 +13288,7 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
req.ntb.schemaRow.pSchema = taosMemoryCalloc(req.ntb.schemaRow.nCols, sizeof(SSchema)); req.ntb.schemaRow.pSchema = taosMemoryCalloc(req.ntb.schemaRow.nCols, sizeof(SSchema));
if (NULL == req.name || NULL == req.ntb.schemaRow.pSchema) { if (NULL == req.name || NULL == req.ntb.schemaRow.pSchema) {
tdDestroySVCreateTbReq(&req); tdDestroySVCreateTbReq(&req);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
if (pStmt->ignoreExists) { if (pStmt->ignoreExists) {
req.flags |= TD_CREATE_IF_NOT_EXISTS; req.flags |= TD_CREATE_IF_NOT_EXISTS;

View File

@ -202,7 +202,7 @@ static int32_t rewriteExprsForSelect(SNodeList* pExprs, SSelectStmt* pSelect, ES
if (NULL != pRewriteExprs) { if (NULL != pRewriteExprs) {
cxt.pOutputs = taosMemoryCalloc(LIST_LENGTH(pExprs), sizeof(bool)); cxt.pOutputs = taosMemoryCalloc(LIST_LENGTH(pExprs), sizeof(bool));
if (NULL == cxt.pOutputs) { if (NULL == cxt.pOutputs) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
} }
nodesRewriteSelectStmt(pSelect, clause, doRewriteExpr, &cxt); nodesRewriteSelectStmt(pSelect, clause, doRewriteExpr, &cxt);

View File

@ -2883,7 +2883,7 @@ static int32_t smaIndexOptCreateSmaScan(SScanLogicNode* pScan, STableIndexInfo*
pSmaScan->pVgroupList = taosMemoryCalloc(1, sizeof(SVgroupsInfo) + sizeof(SVgroupInfo)); pSmaScan->pVgroupList = taosMemoryCalloc(1, sizeof(SVgroupsInfo) + sizeof(SVgroupInfo));
if (!pSmaScan->pVgroupList) { if (!pSmaScan->pVgroupList) {
nodesDestroyNode((SNode*)pSmaScan); nodesDestroyNode((SNode*)pSmaScan);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
code = nodesCloneList(pCols, &pSmaScan->node.pTargets); code = nodesCloneList(pCols, &pSmaScan->node.pTargets);
if (NULL == pSmaScan->node.pTargets) { if (NULL == pSmaScan->node.pTargets) {
@ -4297,7 +4297,7 @@ static void lastRowScanOptRemoveUslessTargets(SNodeList* pTargets, SNodeList* pL
static int32_t lastRowScanBuildFuncTypes(SScanLogicNode* pScan, SColumnNode* pColNode, int32_t funcType) { static int32_t lastRowScanBuildFuncTypes(SScanLogicNode* pScan, SColumnNode* pColNode, int32_t funcType) {
SFunctParam* pFuncTypeParam = taosMemoryCalloc(1, sizeof(SFunctParam)); SFunctParam* pFuncTypeParam = taosMemoryCalloc(1, sizeof(SFunctParam));
if (NULL == pFuncTypeParam) { if (NULL == pFuncTypeParam) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pFuncTypeParam->type = funcType; pFuncTypeParam->type = funcType;
if (NULL == pScan->pFuncTypes) { if (NULL == pScan->pFuncTypes) {
@ -4311,7 +4311,7 @@ static int32_t lastRowScanBuildFuncTypes(SScanLogicNode* pScan, SColumnNode* pCo
pFuncTypeParam->pCol = taosMemoryCalloc(1, sizeof(SColumn)); pFuncTypeParam->pCol = taosMemoryCalloc(1, sizeof(SColumn));
if (NULL == pFuncTypeParam->pCol) { if (NULL == pFuncTypeParam->pCol) {
taosMemoryFree(pFuncTypeParam); taosMemoryFree(pFuncTypeParam);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pFuncTypeParam->pCol->colId = pColNode->colId; pFuncTypeParam->pCol->colId = pColNode->colId;
strcpy(pFuncTypeParam->pCol->name, pColNode->colName); strcpy(pFuncTypeParam->pCol->name, pColNode->colName);
@ -6671,7 +6671,7 @@ static int32_t fillTSMAOptCtx(STSMAOptCtx* pTsmaOptCtx, SScanLogicNode* pScan) {
if (nodeType(pTsmaOptCtx->pParent) == QUERY_NODE_LOGIC_PLAN_WINDOW) { if (nodeType(pTsmaOptCtx->pParent) == QUERY_NODE_LOGIC_PLAN_WINDOW) {
pTsmaOptCtx->queryInterval = taosMemoryCalloc(1, sizeof(SInterval)); pTsmaOptCtx->queryInterval = taosMemoryCalloc(1, sizeof(SInterval));
if (!pTsmaOptCtx->queryInterval) return TSDB_CODE_OUT_OF_MEMORY; if (!pTsmaOptCtx->queryInterval) return terrno;
SWindowLogicNode* pWindow = (SWindowLogicNode*)pTsmaOptCtx->pParent; SWindowLogicNode* pWindow = (SWindowLogicNode*)pTsmaOptCtx->pParent;
pTsmaOptCtx->queryInterval->interval = pWindow->interval; pTsmaOptCtx->queryInterval->interval = pWindow->interval;
@ -7076,7 +7076,7 @@ static int32_t tsmaOptRewriteTbname(const STSMAOptCtx* pTsmaOptCtx, SNode** pTbN
pValue->node.resType = ((SExprNode*)(*pTbNameNode))->resType; pValue->node.resType = ((SExprNode*)(*pTbNameNode))->resType;
pValue->literal = taosMemoryCalloc(1, TSDB_TABLE_FNAME_LEN + 1); pValue->literal = taosMemoryCalloc(1, TSDB_TABLE_FNAME_LEN + 1);
pValue->datum.p = taosMemoryCalloc(1, TSDB_TABLE_FNAME_LEN + 1 + VARSTR_HEADER_SIZE); pValue->datum.p = taosMemoryCalloc(1, TSDB_TABLE_FNAME_LEN + 1 + VARSTR_HEADER_SIZE);
if (!pValue->literal || !pValue->datum.p) code = TSDB_CODE_OUT_OF_MEMORY; if (!pValue->literal || !pValue->datum.p) code = terrno;
} }
if (code == TSDB_CODE_SUCCESS) { if (code == TSDB_CODE_SUCCESS) {
@ -7204,7 +7204,7 @@ static int32_t tsmaOptRewriteScan(STSMAOptCtx* pTsmaOptCtx, SScanLogicNode* pNew
int32_t len = sizeof(int32_t) + sizeof(SVgroupInfo) * pVgpsInfo->numOfVgroups; int32_t len = sizeof(int32_t) + sizeof(SVgroupInfo) * pVgpsInfo->numOfVgroups;
pNewScan->pVgroupList = taosMemoryCalloc(1, len); pNewScan->pVgroupList = taosMemoryCalloc(1, len);
if (!pNewScan->pVgroupList) { if (!pNewScan->pVgroupList) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
break; break;
} }
memcpy(pNewScan->pVgroupList, pVgpsInfo, len); memcpy(pNewScan->pVgroupList, pVgpsInfo, len);

View File

@ -47,7 +47,7 @@ static int32_t doSetScanVgroup(SLogicNode* pNode, const SVgroupInfo* pVgroup, bo
SScanLogicNode* pScan = (SScanLogicNode*)pNode; SScanLogicNode* pScan = (SScanLogicNode*)pNode;
pScan->pVgroupList = taosMemoryCalloc(1, sizeof(SVgroupsInfo) + sizeof(SVgroupInfo)); pScan->pVgroupList = taosMemoryCalloc(1, sizeof(SVgroupsInfo) + sizeof(SVgroupInfo));
if (NULL == pScan->pVgroupList) { if (NULL == pScan->pVgroupList) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
memcpy(pScan->pVgroupList->vgroups, pVgroup, sizeof(SVgroupInfo)); memcpy(pScan->pVgroupList->vgroups, pVgroup, sizeof(SVgroupInfo));
*pFound = true; *pFound = true;

View File

@ -623,7 +623,7 @@ int32_t cloneSVreateTbReq(SVCreateTbReq* pSrc, SVCreateTbReq** pDst) {
*pDst = taosMemoryCalloc(1, sizeof(SVCreateTbReq)); *pDst = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
if (NULL == *pDst) { if (NULL == *pDst) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
(*pDst)->flags = pSrc->flags; (*pDst)->flags = pSrc->flags;

View File

@ -436,7 +436,7 @@ int32_t qwGetDeleteResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, SDeleteRes *pRes
output.pData = taosMemoryCalloc(1, len); output.pData = taosMemoryCalloc(1, len);
if (NULL == output.pData) { if (NULL == output.pData) {
QW_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); QW_ERR_RET(terrno);
} }
code = dsGetDataBlock(ctx->sinkHandle, &output); code = dsGetDataBlock(ctx->sinkHandle, &output);
@ -1324,7 +1324,7 @@ int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, void **qWorkerMgmt, const S
if (NULL == mgmt) { if (NULL == mgmt) {
qError("calloc %d failed", (int32_t)sizeof(SQWorker)); qError("calloc %d failed", (int32_t)sizeof(SQWorker));
(void)atomic_sub_fetch_32(&gQwMgmt.qwNum, 1); (void)atomic_sub_fetch_32(&gQwMgmt.qwNum, 1);
QW_RET(TSDB_CODE_OUT_OF_MEMORY); QW_RET(terrno);
} }
mgmt->cfg.maxSchedulerNum = QW_DEFAULT_SCHEDULER_NUMBER; mgmt->cfg.maxSchedulerNum = QW_DEFAULT_SCHEDULER_NUMBER;

View File

@ -468,20 +468,20 @@ int32_t filterInitUnitsFields(SFilterInfo *info) {
info->unitSize = FILTER_DEFAULT_UNIT_SIZE; info->unitSize = FILTER_DEFAULT_UNIT_SIZE;
info->units = taosMemoryCalloc(info->unitSize, sizeof(SFilterUnit)); info->units = taosMemoryCalloc(info->unitSize, sizeof(SFilterUnit));
if (info->units == NULL) { if (info->units == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
info->fields[FLD_TYPE_COLUMN].num = 0; info->fields[FLD_TYPE_COLUMN].num = 0;
info->fields[FLD_TYPE_COLUMN].size = FILTER_DEFAULT_FIELD_SIZE; info->fields[FLD_TYPE_COLUMN].size = FILTER_DEFAULT_FIELD_SIZE;
info->fields[FLD_TYPE_COLUMN].fields = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].size, sizeof(SFilterField)); info->fields[FLD_TYPE_COLUMN].fields = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].size, sizeof(SFilterField));
if (info->fields[FLD_TYPE_COLUMN].fields == NULL) { if (info->fields[FLD_TYPE_COLUMN].fields == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
info->fields[FLD_TYPE_VALUE].num = 0; info->fields[FLD_TYPE_VALUE].num = 0;
info->fields[FLD_TYPE_VALUE].size = FILTER_DEFAULT_FIELD_SIZE; info->fields[FLD_TYPE_VALUE].size = FILTER_DEFAULT_FIELD_SIZE;
info->fields[FLD_TYPE_VALUE].fields = taosMemoryCalloc(info->fields[FLD_TYPE_VALUE].size, sizeof(SFilterField)); info->fields[FLD_TYPE_VALUE].fields = taosMemoryCalloc(info->fields[FLD_TYPE_VALUE].size, sizeof(SFilterField));
if (info->fields[FLD_TYPE_VALUE].fields == NULL) { if (info->fields[FLD_TYPE_VALUE].fields == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
@ -497,7 +497,7 @@ static FORCE_INLINE int32_t filterNewRange(SFilterRangeCtx *ctx, SFilterRange *r
} else { } else {
*r = taosMemoryCalloc(1, sizeof(SFilterRangeNode)); *r = taosMemoryCalloc(1, sizeof(SFilterRangeNode));
if (*r == NULL) { if (*r == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
} }
@ -516,7 +516,7 @@ int32_t filterInitRangeCtx(int32_t type, int32_t options, SFilterRangeCtx **ctx)
*ctx = taosMemoryCalloc(1, sizeof(SFilterRangeCtx)); *ctx = taosMemoryCalloc(1, sizeof(SFilterRangeCtx));
if (*ctx == NULL) { if (*ctx == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
(*ctx)->type = type; (*ctx)->type = type;
(*ctx)->options = options; (*ctx)->options = options;
@ -961,7 +961,7 @@ int32_t filterDetachCnfGroup(SFilterGroup *gp1, SFilterGroup *gp2, SArray *group
gp.unitNum = gp1->unitNum + gp2->unitNum; gp.unitNum = gp1->unitNum + gp2->unitNum;
gp.unitIdxs = taosMemoryCalloc(gp.unitNum, sizeof(*gp.unitIdxs)); gp.unitIdxs = taosMemoryCalloc(gp.unitNum, sizeof(*gp.unitIdxs));
if (NULL == gp.unitIdxs) { if (NULL == gp.unitIdxs) {
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_RET(terrno);
} }
(void)memcpy(gp.unitIdxs, gp1->unitIdxs, gp1->unitNum * sizeof(*gp.unitIdxs)); (void)memcpy(gp.unitIdxs, gp1->unitIdxs, gp1->unitNum * sizeof(*gp.unitIdxs));
(void)memcpy(gp.unitIdxs + gp1->unitNum, gp2->unitIdxs, gp2->unitNum * sizeof(*gp.unitIdxs)); (void)memcpy(gp.unitIdxs + gp1->unitNum, gp2->unitIdxs, gp2->unitNum * sizeof(*gp.unitIdxs));
@ -1300,7 +1300,7 @@ int32_t fltAddGroupUnitFromNode(SFilterInfo *info, SNode *tree, SArray *group) {
SScalarParam out = {.columnData = taosMemoryCalloc(1, sizeof(SColumnInfoData))}; SScalarParam out = {.columnData = taosMemoryCalloc(1, sizeof(SColumnInfoData))};
if (out.columnData == NULL) { if (out.columnData == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
out.columnData->info.type = type; out.columnData->info.type = type;
out.columnData->info.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; // reserved space for simple_copy out.columnData->info.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; // reserved space for simple_copy
@ -1330,7 +1330,7 @@ int32_t fltAddGroupUnitFromNode(SFilterInfo *info, SNode *tree, SArray *group) {
} else { } else {
void *data = taosMemoryCalloc(1, tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes); // reserved space for simple_copy void *data = taosMemoryCalloc(1, tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes); // reserved space for simple_copy
if (NULL == data) { if (NULL == data) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
break; break;
} }
(void)memcpy(data, nodesGetValueFromNode(valueNode), tDataTypes[type].bytes); (void)memcpy(data, nodesGetValueFromNode(valueNode), tDataTypes[type].bytes);
@ -2201,13 +2201,13 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
size_t bufBytes = TMAX(dType->bytes, sizeof(int64_t)); size_t bufBytes = TMAX(dType->bytes, sizeof(int64_t));
fi->data = taosMemoryCalloc(1, bufBytes); fi->data = taosMemoryCalloc(1, bufBytes);
if (fi->data == NULL) { if (fi->data == NULL) {
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_RET(terrno);
} }
assignVal(fi->data, nodesGetValueFromNode(var), dType->bytes, type); assignVal(fi->data, nodesGetValueFromNode(var), dType->bytes, type);
} else { } else {
SScalarParam out = {.columnData = taosMemoryCalloc(1, sizeof(SColumnInfoData))}; SScalarParam out = {.columnData = taosMemoryCalloc(1, sizeof(SColumnInfoData))};
if (out.columnData == NULL) { if (out.columnData == NULL) {
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_RET(terrno);
} }
out.columnData->info.type = type; out.columnData->info.type = type;
out.columnData->info.precision = precision; out.columnData->info.precision = precision;
@ -2228,7 +2228,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
: TMAX(out.columnData->info.bytes, sizeof(int64_t)); : TMAX(out.columnData->info.bytes, sizeof(int64_t));
fi->data = taosMemoryCalloc(1, bufBytes); fi->data = taosMemoryCalloc(1, bufBytes);
if (fi->data== NULL) { if (fi->data== NULL) {
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_RET(terrno);
} }
size_t valBytes = IS_VAR_DATA_TYPE(type) ? varDataTLen(out.columnData->pData) : out.columnData->info.bytes; size_t valBytes = IS_VAR_DATA_TYPE(type) ? varDataTLen(out.columnData->pData) : out.columnData->info.bytes;
@ -2444,7 +2444,7 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t
gRes[gResIdx] = taosMemoryCalloc(1, sizeof(SFilterGroupCtx)); gRes[gResIdx] = taosMemoryCalloc(1, sizeof(SFilterGroupCtx));
if (gRes[gResIdx] == NULL) { if (gRes[gResIdx] == NULL) {
FLT_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_JRET(terrno);
} }
gRes[gResIdx]->colInfo = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(SFilterColInfo)); gRes[gResIdx]->colInfo = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(SFilterColInfo));
if (gRes[gResIdx]->colInfo == NULL) { if (gRes[gResIdx]->colInfo == NULL) {
@ -2874,7 +2874,7 @@ int32_t filterConvertGroupFromArray(SFilterInfo *info, SArray *group) {
info->groups = taosMemoryCalloc(info->groupNum, sizeof(*info->groups)); info->groups = taosMemoryCalloc(info->groupNum, sizeof(*info->groups));
if (info->groups == NULL) { if (info->groups == NULL) {
info->groupNum = 0; info->groupNum = 0;
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_RET(terrno);
} }
} }
@ -2886,7 +2886,7 @@ int32_t filterConvertGroupFromArray(SFilterInfo *info, SArray *group) {
pg->unitFlags = taosMemoryCalloc(pg->unitNum, sizeof(*pg->unitFlags)); pg->unitFlags = taosMemoryCalloc(pg->unitNum, sizeof(*pg->unitFlags));
if (pg->unitFlags == NULL) { if (pg->unitFlags == NULL) {
pg->unitNum = 0; pg->unitNum = 0;
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_RET(terrno);
} }
info->groups[i] = *pg; info->groups[i] = *pg;
} }
@ -3003,7 +3003,7 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx **gRes, int32_
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
uint32_t *idxNum = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(*idxNum)); uint32_t *idxNum = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(*idxNum));
if (idxNum == NULL) { if (idxNum == NULL) {
FLT_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_JRET(terrno);
} }
for (int32_t i = 0; i < gResNum; ++i) { for (int32_t i = 0; i < gResNum; ++i) {
for (uint32_t m = 0; m < gRes[i]->colNum; ++m) { for (uint32_t m = 0; m < gRes[i]->colNum; ++m) {
@ -3029,7 +3029,7 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx **gRes, int32_
if (idxs == NULL) { if (idxs == NULL) {
idxs = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(*idxs)); idxs = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(*idxs));
if (idxs == NULL) { if (idxs == NULL) {
FLT_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_JRET(terrno);
} }
} }
@ -3042,7 +3042,7 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx **gRes, int32_
info->colRange = taosMemoryCalloc(colNum, POINTER_BYTES); info->colRange = taosMemoryCalloc(colNum, POINTER_BYTES);
if (info->colRange == NULL) { if (info->colRange == NULL) {
info->colRangeNum = 0; info->colRangeNum = 0;
FLT_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_JRET(terrno);
} }
for (int32_t i = 0; i < gResNum; ++i) { for (int32_t i = 0; i < gResNum; ++i) {
@ -3582,7 +3582,7 @@ int32_t filterExecuteImplMisc(void *pinfo, int32_t numOfRows, SColumnInfoData *p
(info->cunits[uidx].optr == OP_TYPE_MATCH || info->cunits[uidx].optr == OP_TYPE_NMATCH)) { (info->cunits[uidx].optr == OP_TYPE_MATCH || info->cunits[uidx].optr == OP_TYPE_NMATCH)) {
char *newColData = taosMemoryCalloc(info->cunits[uidx].dataSize * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE, 1); char *newColData = taosMemoryCalloc(info->cunits[uidx].dataSize * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE, 1);
if (newColData == NULL) { if (newColData == NULL) {
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_RET(terrno);
} }
int32_t len = taosUcs4ToMbs((TdUcs4 *)varDataVal(colData), varDataLen(colData), varDataVal(newColData)); int32_t len = taosUcs4ToMbs((TdUcs4 *)varDataVal(colData), varDataLen(colData), varDataVal(newColData));
if (len < 0) { if (len < 0) {
@ -3657,7 +3657,7 @@ int32_t filterExecuteImpl(void *pinfo, int32_t numOfRows, SColumnInfoData *pRes,
(cunit->optr == OP_TYPE_MATCH || cunit->optr == OP_TYPE_NMATCH)) { (cunit->optr == OP_TYPE_MATCH || cunit->optr == OP_TYPE_NMATCH)) {
char *newColData = taosMemoryCalloc(cunit->dataSize * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE, 1); char *newColData = taosMemoryCalloc(cunit->dataSize * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE, 1);
if (newColData == NULL) { if (newColData == NULL) {
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_RET(terrno);
} }
int32_t len = taosUcs4ToMbs((TdUcs4 *)varDataVal(colData), varDataLen(colData), varDataVal(newColData)); int32_t len = taosUcs4ToMbs((TdUcs4 *)varDataVal(colData), varDataLen(colData), varDataVal(newColData));
if (len < 0) { if (len < 0) {
@ -3738,7 +3738,7 @@ int32_t filterPreprocess(SFilterInfo *info) {
int32_t gResNum = 0; int32_t gResNum = 0;
SFilterGroupCtx **gRes = taosMemoryCalloc(info->groupNum, sizeof(SFilterGroupCtx *)); SFilterGroupCtx **gRes = taosMemoryCalloc(info->groupNum, sizeof(SFilterGroupCtx *));
if (gRes == NULL) { if (gRes == NULL) {
FLT_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_JRET(terrno);
} }
FLT_ERR_JRET(filterMergeGroupUnits(info, gRes, &gResNum)); FLT_ERR_JRET(filterMergeGroupUnits(info, gRes, &gResNum));
@ -5216,7 +5216,7 @@ int32_t filterInitFromNode(SNode *pNode, SFilterInfo **pInfo, uint32_t options)
*pInfo = taosMemoryCalloc(1, sizeof(SFilterInfo)); *pInfo = taosMemoryCalloc(1, sizeof(SFilterInfo));
if (NULL == *pInfo) { if (NULL == *pInfo) {
fltError("taosMemoryCalloc %d failed", (int32_t)sizeof(SFilterInfo)); fltError("taosMemoryCalloc %d failed", (int32_t)sizeof(SFilterInfo));
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_RET(terrno);
} }
} }

View File

@ -41,7 +41,6 @@ int32_t sclConvertToTsValueNode(int8_t precision, SValueNode *valueNode) {
int32_t sclCreateColumnInfoData(SDataType *pType, int32_t numOfRows, SScalarParam *pParam) { int32_t sclCreateColumnInfoData(SDataType *pType, int32_t numOfRows, SScalarParam *pParam) {
SColumnInfoData *pColumnData = taosMemoryCalloc(1, sizeof(SColumnInfoData)); SColumnInfoData *pColumnData = taosMemoryCalloc(1, sizeof(SColumnInfoData));
if (pColumnData == NULL) { if (pColumnData == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return terrno; return terrno;
} }
@ -99,7 +98,7 @@ int32_t sclExtendResRows(SScalarParam *pDst, SScalarParam *pSrc, SArray *pBlockL
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
if (NULL == pLeft) { if (NULL == pLeft) {
sclError("calloc %d failed", (int32_t)sizeof(SScalarParam)); sclError("calloc %d failed", (int32_t)sizeof(SScalarParam));
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
pLeft->numOfRows = pb->info.rows; pLeft->numOfRows = pb->info.rows;
@ -131,7 +130,7 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
SListCell *cell = nodeList->pNodeList->pHead; SListCell *cell = nodeList->pNodeList->pHead;
SScalarParam out = {.columnData = taosMemoryCalloc(1, sizeof(SColumnInfoData))}; SScalarParam out = {.columnData = taosMemoryCalloc(1, sizeof(SColumnInfoData))};
if (out.columnData == NULL) { if (out.columnData == NULL) {
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_JRET(terrno);
} }
int32_t len = 0; int32_t len = 0;
void *buf = NULL; void *buf = NULL;
@ -485,7 +484,7 @@ int32_t sclInitParamList(SScalarParam **pParams, SNodeList *pParamList, SScalarC
SScalarParam *paramList = taosMemoryCalloc(*paramNum, sizeof(SScalarParam)); SScalarParam *paramList = taosMemoryCalloc(*paramNum, sizeof(SScalarParam));
if (NULL == paramList) { if (NULL == paramList) {
sclError("calloc %d failed", (int32_t)((*paramNum) * sizeof(SScalarParam))); sclError("calloc %d failed", (int32_t)((*paramNum) * sizeof(SScalarParam)));
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
if (pParamList) { if (pParamList) {
@ -581,7 +580,7 @@ int32_t sclInitOperatorParams(SScalarParam **pParams, SOperatorNode *node, SScal
SScalarParam *paramList = taosMemoryCalloc(paramNum, sizeof(SScalarParam)); SScalarParam *paramList = taosMemoryCalloc(paramNum, sizeof(SScalarParam));
if (NULL == paramList) { if (NULL == paramList) {
sclError("calloc %d failed", (int32_t)(paramNum * sizeof(SScalarParam))); sclError("calloc %d failed", (int32_t)(paramNum * sizeof(SScalarParam)));
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
SCL_ERR_JRET(sclSetOperatorValueType(node, ctx)); SCL_ERR_JRET(sclSetOperatorValueType(node, ctx));
@ -608,7 +607,7 @@ int32_t sclGetNodeRes(SNode *node, SScalarCtx *ctx, SScalarParam **res) {
int32_t rowNum = 0; int32_t rowNum = 0;
*res = taosMemoryCalloc(1, sizeof(**res)); *res = taosMemoryCalloc(1, sizeof(**res));
if (NULL == *res) { if (NULL == *res) {
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
SCL_ERR_RET(sclInitParam(node, *res, ctx, &rowNum)); SCL_ERR_RET(sclInitParam(node, *res, ctx, &rowNum));

View File

@ -618,7 +618,7 @@ static int32_t trimHelper(char *orgStr, char* remStr, int32_t orgLen, int32_t re
static int32_t convVarcharToNchar(char *input, char **output, int32_t inputLen, int32_t *outputLen) { static int32_t convVarcharToNchar(char *input, char **output, int32_t inputLen, int32_t *outputLen) {
*output = taosMemoryCalloc(inputLen * TSDB_NCHAR_SIZE, 1); *output = taosMemoryCalloc(inputLen * TSDB_NCHAR_SIZE, 1);
if (NULL == *output) { if (NULL == *output) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
bool ret = taosMbsToUcs4(input, inputLen, (TdUcs4 *)*output, inputLen * TSDB_NCHAR_SIZE, outputLen); bool ret = taosMbsToUcs4(input, inputLen, (TdUcs4 *)*output, inputLen * TSDB_NCHAR_SIZE, outputLen);
if (!ret) { if (!ret) {
@ -631,7 +631,7 @@ static int32_t convVarcharToNchar(char *input, char **output, int32_t inputLen,
static int32_t convNcharToVarchar(char *input, char **output, int32_t inputLen, int32_t *outputLen) { static int32_t convNcharToVarchar(char *input, char **output, int32_t inputLen, int32_t *outputLen) {
*output = taosMemoryCalloc(inputLen, 1); *output = taosMemoryCalloc(inputLen, 1);
if (NULL == *output) { if (NULL == *output) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
*outputLen = taosUcs4ToMbs((TdUcs4 *)input, inputLen, *output); *outputLen = taosUcs4ToMbs((TdUcs4 *)input, inputLen, *output);
if (*outputLen < 0) { if (*outputLen < 0) {
@ -814,7 +814,7 @@ static int32_t concatCopyHelper(const char *input, char *output, bool hasNchar,
if (hasNchar && type == TSDB_DATA_TYPE_VARCHAR) { if (hasNchar && type == TSDB_DATA_TYPE_VARCHAR) {
TdUcs4 *newBuf = taosMemoryCalloc((varDataLen(input) + 1) * TSDB_NCHAR_SIZE, 1); TdUcs4 *newBuf = taosMemoryCalloc((varDataLen(input) + 1) * TSDB_NCHAR_SIZE, 1);
if (NULL == newBuf) { if (NULL == newBuf) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t len = varDataLen(input); int32_t len = varDataLen(input);
bool ret = taosMbsToUcs4(varDataVal(input), len, newBuf, (varDataLen(input) + 1) * TSDB_NCHAR_SIZE, &len); bool ret = taosMbsToUcs4(varDataVal(input), len, newBuf, (varDataLen(input) + 1) * TSDB_NCHAR_SIZE, &len);
@ -853,10 +853,10 @@ int32_t concatFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
char *outputBuf = NULL; char *outputBuf = NULL;
if (NULL == pInputData) { if (NULL == pInputData) {
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_JRET(terrno);
} }
if (NULL == input) { if (NULL == input) {
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_JRET(terrno);
} }
int32_t inputLen = 0; int32_t inputLen = 0;
@ -882,7 +882,7 @@ int32_t concatFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
outputBuf = taosMemoryCalloc(outputLen, 1); outputBuf = taosMemoryCalloc(outputLen, 1);
if (NULL == outputBuf) { if (NULL == outputBuf) {
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_JRET(terrno);
} }
for (int32_t k = 0; k < numOfRows; ++k) { for (int32_t k = 0; k < numOfRows; ++k) {
@ -928,7 +928,7 @@ int32_t concatWsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
char *outputBuf = NULL; char *outputBuf = NULL;
if (NULL == pInputData) { if (NULL == pInputData) {
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_JRET(terrno);
} }
int32_t inputLen = 0; int32_t inputLen = 0;
@ -960,7 +960,7 @@ int32_t concatWsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
outputBuf = taosMemoryCalloc(outputLen, 1); outputBuf = taosMemoryCalloc(outputLen, 1);
if (NULL == outputBuf) { if (NULL == outputBuf) {
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_JRET(terrno);
} }
for (int32_t k = 0; k < numOfRows; ++k) { for (int32_t k = 0; k < numOfRows; ++k) {
@ -1016,7 +1016,7 @@ static int32_t doCaseConvFunction(SScalarParam *pInput, int32_t inputNum, SScala
int32_t outputLen = pInputData->varmeta.length; int32_t outputLen = pInputData->varmeta.length;
char *outputBuf = taosMemoryCalloc(outputLen, 1); char *outputBuf = taosMemoryCalloc(outputLen, 1);
if (outputBuf == NULL) { if (outputBuf == NULL) {
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
char *output = outputBuf; char *output = outputBuf;
@ -1070,7 +1070,7 @@ static int32_t doTrimFunction(SScalarParam *pInput, int32_t inputNum, SScalarPar
} }
char *outputBuf = taosMemoryCalloc(outputLen, 1); char *outputBuf = taosMemoryCalloc(outputLen, 1);
if (outputBuf == NULL) { if (outputBuf == NULL) {
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
char *output = outputBuf; char *output = outputBuf;
@ -1528,7 +1528,7 @@ int32_t replaceFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pO
char *outputBuf = taosMemoryCalloc(outputLen + VARSTR_HEADER_SIZE, 1); char *outputBuf = taosMemoryCalloc(outputLen + VARSTR_HEADER_SIZE, 1);
if (NULL == outputBuf) { if (NULL == outputBuf) {
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
for (int32_t i = 0; i < numOfRows; ++i) { for (int32_t i = 0; i < numOfRows; ++i) {
@ -1643,7 +1643,7 @@ int32_t substrIdxFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *
} }
char *outputBuf = taosMemoryCalloc(outputLen + VARSTR_HEADER_SIZE, 1); char *outputBuf = taosMemoryCalloc(outputLen + VARSTR_HEADER_SIZE, 1);
if (NULL == outputBuf) { if (NULL == outputBuf) {
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
for (int32_t k = 0; k < numOfRows; ++k) { for (int32_t k = 0; k < numOfRows; ++k) {
@ -1741,7 +1741,7 @@ int32_t repeatFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
numOfRows = TMAX(pInput[0].numOfRows, pInput[1].numOfRows); numOfRows = TMAX(pInput[0].numOfRows, pInput[1].numOfRows);
char *outputBuf = taosMemoryCalloc(outputLen, 1); char *outputBuf = taosMemoryCalloc(outputLen, 1);
if (outputBuf == NULL) { if (outputBuf == NULL) {
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
char *output = outputBuf; char *output = outputBuf;
@ -1834,7 +1834,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
char *buf = taosMemoryMalloc(bufSize); char *buf = taosMemoryMalloc(bufSize);
if (convBuf == NULL || output == NULL || buf == NULL) { if (convBuf == NULL || output == NULL || buf == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _end; goto _end;
} }
@ -2403,7 +2403,7 @@ int32_t toCharFunction(SScalarParam* pInput, int32_t inputNum, SScalarParam* pOu
int32_t code = 0; int32_t code = 0;
if (format == NULL || out == NULL) { if (format == NULL || out == NULL) {
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_JRET(terrno);
} }
for (int32_t i = 0; i < pInput[0].numOfRows; ++i) { for (int32_t i = 0; i < pInput[0].numOfRows; ++i) {
if (colDataIsNull_s(pInput[1].columnData, i) || colDataIsNull_s(pInput[0].columnData, i)) { if (colDataIsNull_s(pInput[1].columnData, i) || colDataIsNull_s(pInput[0].columnData, i)) {
@ -4230,7 +4230,7 @@ static int32_t getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *
intervals = taosMemoryCalloc(numOfBins, sizeof(double)); intervals = taosMemoryCalloc(numOfBins, sizeof(double));
if (NULL == intervals) { if (NULL == intervals) {
cJSON_Delete(binDesc); cJSON_Delete(binDesc);
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
if (cJSON_IsNumber(width) && factor == NULL && binType == LINEAR_BIN) { if (cJSON_IsNumber(width) && factor == NULL && binType == LINEAR_BIN) {
// linear bin process // linear bin process
@ -4295,7 +4295,7 @@ static int32_t getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *
intervals = taosMemoryCalloc(numOfBins, sizeof(double)); intervals = taosMemoryCalloc(numOfBins, sizeof(double));
if (NULL == intervals) { if (NULL == intervals) {
cJSON_Delete(binDesc); cJSON_Delete(binDesc);
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
cJSON *bin = binDesc->child; cJSON *bin = binDesc->child;
if (bin == NULL) { if (bin == NULL) {
@ -4327,7 +4327,7 @@ static int32_t getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *
*binNum = numOfBins - 1; *binNum = numOfBins - 1;
*bins = taosMemoryCalloc(numOfBins, sizeof(SHistoFuncBin)); *bins = taosMemoryCalloc(numOfBins, sizeof(SHistoFuncBin));
if (NULL == bins) { if (NULL == bins) {
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
for (int32_t i = 0; i < *binNum; ++i) { for (int32_t i = 0; i < *binNum; ++i) {
(*bins)[i].lower = intervals[i] < intervals[i + 1] ? intervals[i] : intervals[i + 1]; (*bins)[i].lower = intervals[i] < intervals[i + 1] ? intervals[i] : intervals[i + 1];

View File

@ -124,7 +124,7 @@ int32_t convertBinaryToDouble(const void *inData, void *outData) {
char *tmp = taosMemoryCalloc(1, varDataTLen(inData)); char *tmp = taosMemoryCalloc(1, varDataTLen(inData));
if (tmp == NULL) { if (tmp == NULL) {
*((double *)outData) = 0.; *((double *)outData) = 0.;
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
(void)memcpy(tmp, varDataVal(inData), varDataLen(inData)); (void)memcpy(tmp, varDataVal(inData), varDataLen(inData));
double ret = taosStr2Double(tmp, NULL); double ret = taosStr2Double(tmp, NULL);
@ -370,7 +370,7 @@ static FORCE_INLINE int32_t varToVarbinary(char *buf, SScalarParam *pOut, int32_
if (t == NULL) { if (t == NULL) {
sclError("Out of memory"); sclError("Out of memory");
taosMemoryFree(data); taosMemoryFree(data);
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
varDataSetLen(t, size); varDataSetLen(t, size);
(void)memcpy(varDataVal(t), data, size); (void)memcpy(varDataVal(t), data, size);
@ -383,7 +383,7 @@ static FORCE_INLINE int32_t varToVarbinary(char *buf, SScalarParam *pOut, int32_
char *t = taosMemoryCalloc(1, inputLen); char *t = taosMemoryCalloc(1, inputLen);
if (t == NULL) { if (t == NULL) {
sclError("Out of memory"); sclError("Out of memory");
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
(void)memcpy(t, buf, inputLen); (void)memcpy(t, buf, inputLen);
int32_t code = colDataSetVal(pOut->columnData, rowIndex, t, false); int32_t code = colDataSetVal(pOut->columnData, rowIndex, t, false);
@ -401,7 +401,7 @@ static FORCE_INLINE int32_t varToNchar(char *buf, SScalarParam *pOut, int32_t ro
char *t = taosMemoryCalloc(1, outputMaxLen); char *t = taosMemoryCalloc(1, outputMaxLen);
if (NULL == t) { if (NULL == t) {
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
int32_t ret = int32_t ret =
taosMbsToUcs4(varDataVal(buf), inputLen, (TdUcs4 *)varDataVal(t), outputMaxLen - VARSTR_HEADER_SIZE, &len); taosMbsToUcs4(varDataVal(buf), inputLen, (TdUcs4 *)varDataVal(t), outputMaxLen - VARSTR_HEADER_SIZE, &len);
@ -424,7 +424,7 @@ static FORCE_INLINE int32_t ncharToVar(char *buf, SScalarParam *pOut, int32_t ro
char *t = taosMemoryCalloc(1, inputLen + VARSTR_HEADER_SIZE); char *t = taosMemoryCalloc(1, inputLen + VARSTR_HEADER_SIZE);
if (NULL == t) { if (NULL == t) {
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
int32_t len = taosUcs4ToMbs((TdUcs4 *)varDataVal(buf), varDataLen(buf), varDataVal(t)); int32_t len = taosUcs4ToMbs((TdUcs4 *)varDataVal(buf), varDataLen(buf), varDataVal(t));
if (len < 0) { if (len < 0) {
@ -457,7 +457,7 @@ static FORCE_INLINE int32_t varToGeometry(char *buf, SScalarParam *pOut, int32_t
output = taosMemoryCalloc(1, len + VARSTR_HEADER_SIZE); output = taosMemoryCalloc(1, len + VARSTR_HEADER_SIZE);
if (NULL == output) { if (NULL == output) {
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_JRET(terrno);
} }
(void)memcpy(output + VARSTR_HEADER_SIZE, t, len); (void)memcpy(output + VARSTR_HEADER_SIZE, t, len);
varDataSetLen(output, len); varDataSetLen(output, len);
@ -2155,7 +2155,7 @@ int32_t vectorJsonContains(SScalarParam *pLeft, SScalarParam *pRight, SScalarPar
char *pRightData = colDataGetVarData(pRight->columnData, 0); char *pRightData = colDataGetVarData(pRight->columnData, 0);
char *jsonKey = taosMemoryCalloc(1, varDataLen(pRightData) + 1); char *jsonKey = taosMemoryCalloc(1, varDataLen(pRightData) + 1);
if (NULL == jsonKey) { if (NULL == jsonKey) {
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
(void)memcpy(jsonKey, varDataVal(pRightData), varDataLen(pRightData)); (void)memcpy(jsonKey, varDataVal(pRightData), varDataLen(pRightData));
for (; i >= 0 && i < pLeft->numOfRows; i += step) { for (; i >= 0 && i < pLeft->numOfRows; i += step) {
@ -2189,7 +2189,7 @@ int32_t vectorJsonArrow(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam
char *pRightData = colDataGetVarData(pRight->columnData, 0); char *pRightData = colDataGetVarData(pRight->columnData, 0);
char *jsonKey = taosMemoryCalloc(1, varDataLen(pRightData) + 1); char *jsonKey = taosMemoryCalloc(1, varDataLen(pRightData) + 1);
if (NULL == jsonKey) { if (NULL == jsonKey) {
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCL_ERR_RET(terrno);
} }
(void)memcpy(jsonKey, varDataVal(pRightData), varDataLen(pRightData)); (void)memcpy(jsonKey, varDataVal(pRightData), varDataLen(pRightData));
for (; i >= 0 && i < pLeft->numOfRows; i += step) { for (; i >= 0 && i < pLeft->numOfRows; i += step) {

View File

@ -810,7 +810,7 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) {
SSchJob *pJob = taosMemoryCalloc(1, sizeof(SSchJob)); SSchJob *pJob = taosMemoryCalloc(1, sizeof(SSchJob));
if (NULL == pJob) { if (NULL == pJob) {
qError("qid:0x%" PRIx64 " calloc %d failed", pReq->pDag->queryId, (int32_t)sizeof(SSchJob)); qError("qid:0x%" PRIx64 " calloc %d failed", pReq->pDag->queryId, (int32_t)sizeof(SSchJob));
SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_JRET(terrno);
} }
pJob->attr.explainMode = pReq->pDag->explainInfo.mode; pJob->attr.explainMode = pReq->pDag->explainInfo.mode;

View File

@ -583,7 +583,7 @@ int32_t schMakeCallbackParam(SSchJob *pJob, SSchTask *pTask, int32_t msgType, bo
SSchTaskCallbackParam *param = taosMemoryCalloc(1, sizeof(SSchTaskCallbackParam)); SSchTaskCallbackParam *param = taosMemoryCalloc(1, sizeof(SSchTaskCallbackParam));
if (NULL == param) { if (NULL == param) {
SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SSchTaskCallbackParam)); SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SSchTaskCallbackParam));
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_RET(terrno);
} }
param->queryId = pJob->queryId; param->queryId = pJob->queryId;
@ -600,7 +600,7 @@ int32_t schMakeCallbackParam(SSchJob *pJob, SSchTask *pTask, int32_t msgType, bo
SSchHbCallbackParam *param = taosMemoryCalloc(1, sizeof(SSchHbCallbackParam)); SSchHbCallbackParam *param = taosMemoryCalloc(1, sizeof(SSchHbCallbackParam));
if (NULL == param) { if (NULL == param) {
SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SSchHbCallbackParam)); SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SSchHbCallbackParam));
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_RET(terrno);
} }
param->head.isHbParam = true; param->head.isHbParam = true;
@ -625,7 +625,7 @@ int32_t schMakeCallbackParam(SSchJob *pJob, SSchTask *pTask, int32_t msgType, bo
SSchTaskCallbackParam *param = taosMemoryCalloc(1, sizeof(SSchTaskCallbackParam)); SSchTaskCallbackParam *param = taosMemoryCalloc(1, sizeof(SSchTaskCallbackParam));
if (NULL == param) { if (NULL == param) {
qError("calloc SSchTaskCallbackParam failed"); qError("calloc SSchTaskCallbackParam failed");
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_RET(terrno);
} }
param->pTrans = trans->pTrans; param->pTrans = trans->pTrans;
@ -640,7 +640,7 @@ int32_t schGenerateCallBackInfo(SSchJob *pJob, SSchTask *pTask, void *msg, uint3
SMsgSendInfo *msgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); SMsgSendInfo *msgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
if (NULL == msgSendInfo) { if (NULL == msgSendInfo) {
SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SMsgSendInfo)); SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SMsgSendInfo));
SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_JRET(terrno);
} }
msgSendInfo->paramFreeFp = taosMemoryFree; msgSendInfo->paramFreeFp = taosMemoryFree;
@ -797,13 +797,13 @@ int32_t schMakeHbRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) {
pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
if (NULL == pMsgSendInfo) { if (NULL == pMsgSendInfo) {
SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SMsgSendInfo)); SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SMsgSendInfo));
SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_JRET(terrno);
} }
param = taosMemoryCalloc(1, sizeof(SSchHbCallbackParam)); param = taosMemoryCalloc(1, sizeof(SSchHbCallbackParam));
if (NULL == param) { if (NULL == param) {
SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SSchHbCallbackParam)); SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SSchHbCallbackParam));
SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_JRET(terrno);
} }
int32_t msgType = TDMT_SCH_QUERY_HEARTBEAT_RSP; int32_t msgType = TDMT_SCH_QUERY_HEARTBEAT_RSP;
@ -927,7 +927,7 @@ int32_t schCloneSMsgSendInfo(void *src, void **dst) {
SMsgSendInfo *pDst = taosMemoryCalloc(1, sizeof(*pSrc)); SMsgSendInfo *pDst = taosMemoryCalloc(1, sizeof(*pSrc));
if (NULL == pDst) { if (NULL == pDst) {
qError("malloc SMsgSendInfo for rpcCtx failed, len:%d", (int32_t)sizeof(*pSrc)); qError("malloc SMsgSendInfo for rpcCtx failed, len:%d", (int32_t)sizeof(*pSrc));
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_RET(terrno);
} }
TAOS_MEMCPY(pDst, pSrc, sizeof(*pSrc)); TAOS_MEMCPY(pDst, pSrc, sizeof(*pSrc));
@ -1059,7 +1059,7 @@ int32_t schBuildAndSendHbMsg(SQueryNodeEpId *nodeEpId, SArray *taskAction) {
void *msg = taosMemoryCalloc(1, msgSize); void *msg = taosMemoryCalloc(1, msgSize);
if (NULL == msg) { if (NULL == msg) {
qError("calloc hb req %d failed", msgSize); qError("calloc hb req %d failed", msgSize);
SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_JRET(terrno);
} }
if (tSerializeSSchedulerHbReq(msg, msgSize, &req) < 0) { if (tSerializeSSchedulerHbReq(msg, msgSize, &req) < 0) {
@ -1116,7 +1116,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
msg = taosMemoryCalloc(1, msgSize); msg = taosMemoryCalloc(1, msgSize);
if (NULL == msg) { if (NULL == msg) {
SCH_TASK_ELOG("calloc %d failed", msgSize); SCH_TASK_ELOG("calloc %d failed", msgSize);
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_RET(terrno);
} }
TAOS_MEMCPY(msg, pTask->msg, msgSize); TAOS_MEMCPY(msg, pTask->msg, msgSize);
@ -1142,7 +1142,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
msg = taosMemoryCalloc(1, msgSize); msg = taosMemoryCalloc(1, msgSize);
if (NULL == msg) { if (NULL == msg) {
SCH_TASK_ELOG("calloc %d failed", msgSize); SCH_TASK_ELOG("calloc %d failed", msgSize);
SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_JRET(terrno);
} }
msgSize = tSerializeSVDeleteReq(msg, msgSize, &req); msgSize = tSerializeSVDeleteReq(msg, msgSize, &req);
@ -1190,7 +1190,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
msg = taosMemoryCalloc(1, msgSize); msg = taosMemoryCalloc(1, msgSize);
if (NULL == msg) { if (NULL == msg) {
SCH_TASK_ELOG("calloc %d failed", msgSize); SCH_TASK_ELOG("calloc %d failed", msgSize);
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_RET(terrno);
} }
if (tSerializeSSubQueryMsg(msg, msgSize, &qMsg) < 0) { if (tSerializeSSubQueryMsg(msg, msgSize, &qMsg) < 0) {
@ -1228,7 +1228,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
msg = taosMemoryCalloc(1, msgSize); msg = taosMemoryCalloc(1, msgSize);
if (NULL == msg) { if (NULL == msg) {
SCH_TASK_ELOG("calloc %d failed", msgSize); SCH_TASK_ELOG("calloc %d failed", msgSize);
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_RET(terrno);
} }
if (tSerializeSResFetchReq(msg, msgSize, &req) < 0) { if (tSerializeSResFetchReq(msg, msgSize, &req) < 0) {
@ -1256,7 +1256,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
msg = taosMemoryCalloc(1, msgSize); msg = taosMemoryCalloc(1, msgSize);
if (NULL == msg) { if (NULL == msg) {
SCH_TASK_ELOG("calloc %d failed", msgSize); SCH_TASK_ELOG("calloc %d failed", msgSize);
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_RET(terrno);
} }
if (tSerializeSTaskDropReq(msg, msgSize, &qMsg) < 0) { if (tSerializeSTaskDropReq(msg, msgSize, &qMsg) < 0) {
@ -1283,7 +1283,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
msg = taosMemoryCalloc(1, msgSize); msg = taosMemoryCalloc(1, msgSize);
if (NULL == msg) { if (NULL == msg) {
SCH_JOB_ELOG("calloc %d failed", msgSize); SCH_JOB_ELOG("calloc %d failed", msgSize);
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_RET(terrno);
} }
if (tSerializeSSchedulerHbReq(msg, msgSize, &req) < 0) { if (tSerializeSSchedulerHbReq(msg, msgSize, &req) < 0) {
SCH_JOB_ELOG("tSerializeSSchedulerHbReq hbReq failed, size:%d", msgSize); SCH_JOB_ELOG("tSerializeSSchedulerHbReq hbReq failed, size:%d", msgSize);
@ -1314,7 +1314,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
msg = taosMemoryCalloc(1, msgSize); msg = taosMemoryCalloc(1, msgSize);
if (NULL == msg) { if (NULL == msg) {
SCH_TASK_ELOG("calloc %d failed", msgSize); SCH_TASK_ELOG("calloc %d failed", msgSize);
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_RET(terrno);
} }
if (tSerializeSTaskNotifyReq(msg, msgSize, &qMsg) < 0) { if (tSerializeSTaskNotifyReq(msg, msgSize, &qMsg) < 0) {

View File

@ -1237,7 +1237,7 @@ _return:
int32_t schAsyncLaunchTaskImpl(SSchJob *pJob, SSchTask *pTask) { int32_t schAsyncLaunchTaskImpl(SSchJob *pJob, SSchTask *pTask) {
SSchTaskCtx *param = taosMemoryCalloc(1, sizeof(SSchTaskCtx)); SSchTaskCtx *param = taosMemoryCalloc(1, sizeof(SSchTaskCtx));
if (NULL == param) { if (NULL == param) {
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_RET(terrno);
} }
param->jobRid = pJob->refId; param->jobRid = pJob->refId;

View File

@ -213,7 +213,7 @@ int32_t rebuildDirFromCheckpoint(const char* path, int64_t chkpId, char** dst) {
char* state = taosMemoryCalloc(1, cap); char* state = taosMemoryCalloc(1, cap);
if (state == NULL) { if (state == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
nBytes = snprintf(state, cap, "%s%s%s", path, TD_DIRSEP, "state"); nBytes = snprintf(state, cap, "%s%s%s", path, TD_DIRSEP, "state");
@ -226,7 +226,7 @@ int32_t rebuildDirFromCheckpoint(const char* path, int64_t chkpId, char** dst) {
char* chkp = taosMemoryCalloc(1, cap); char* chkp = taosMemoryCalloc(1, cap);
if (chkp == NULL) { if (chkp == NULL) {
taosMemoryFree(state); taosMemoryFree(state);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
nBytes = snprintf(chkp, cap, "%s%s%s%scheckpoint%" PRId64 "", path, TD_DIRSEP, "checkpoints", TD_DIRSEP, chkpId); nBytes = snprintf(chkp, cap, "%s%s%s%scheckpoint%" PRId64 "", path, TD_DIRSEP, "checkpoints", TD_DIRSEP, chkpId);
@ -279,7 +279,7 @@ int32_t remoteChkp_readMetaData(char* path, SSChkpMetaOnS3** pMeta) {
char* metaPath = taosMemoryCalloc(1, cap); char* metaPath = taosMemoryCalloc(1, cap);
if (metaPath == NULL) { if (metaPath == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t n = snprintf(metaPath, cap, "%s%s%s", path, TD_DIRSEP, "META"); int32_t n = snprintf(metaPath, cap, "%s%s%s", path, TD_DIRSEP, "META");
@ -302,7 +302,7 @@ int32_t remoteChkp_readMetaData(char* path, SSChkpMetaOnS3** pMeta) {
SSChkpMetaOnS3* p = taosMemoryCalloc(1, sizeof(SSChkpMetaOnS3)); SSChkpMetaOnS3* p = taosMemoryCalloc(1, sizeof(SSChkpMetaOnS3));
if (p == NULL) { if (p == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _EXIT; goto _EXIT;
} }
n = sscanf(buf, META_ON_S3_FORMATE, p->pCurrName, &p->currChkptId, p->pManifestName, &p->manifestChkptId, n = sscanf(buf, META_ON_S3_FORMATE, p->pCurrName, &p->currChkptId, p->pManifestName, &p->manifestChkptId,
@ -334,7 +334,7 @@ int32_t remoteChkp_validAndCvtMeta(char* path, SSChkpMetaOnS3* pMeta, int64_t ch
char* src = taosMemoryCalloc(1, cap); char* src = taosMemoryCalloc(1, cap);
char* dst = taosMemoryCalloc(1, cap); char* dst = taosMemoryCalloc(1, cap);
if (src == NULL || dst == NULL) { if (src == NULL || dst == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _EXIT; goto _EXIT;
} }
@ -400,7 +400,7 @@ int32_t remoteChkpGetDelFile(char* path, SArray* toDel) {
char* p = taosMemoryCalloc(1, cap); char* p = taosMemoryCalloc(1, cap);
if (p == NULL) { if (p == NULL) {
taosMemoryFree(pMeta); taosMemoryFree(pMeta);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
nBytes = snprintf(p, cap, "%s_%" PRId64 "", key, pMeta->currChkptId); nBytes = snprintf(p, cap, "%s_%" PRId64 "", key, pMeta->currChkptId);
@ -494,7 +494,7 @@ int32_t rebuildFromRemoteChkp_s3(const char* key, char* chkpPath, int64_t chkpId
char* defaultTmp = taosMemoryCalloc(1, cap); char* defaultTmp = taosMemoryCalloc(1, cap);
if (defaultTmp == NULL) { if (defaultTmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t nBytes = snprintf(defaultPath, cap, "%s%s", defaultPath, "_tmp"); int32_t nBytes = snprintf(defaultPath, cap, "%s%s", defaultPath, "_tmp");
@ -592,8 +592,7 @@ int32_t backendFileCopyFilesImpl(const char* src, const char* dst) {
if (srcName == NULL || dstName == NULL) { if (srcName == NULL || dstName == NULL) {
taosMemoryFree(srcName); taosMemoryFree(srcName);
taosMemoryFree(dstName); taosMemoryFree(dstName);
code = TSDB_CODE_OUT_OF_MEMORY; return terrno;
return code;
} }
// copy file to dst // copy file to dst
@ -711,7 +710,7 @@ int32_t restoreCheckpointData(const char* path, const char* key, int64_t chkptId
checkpointPath = taosMemoryCalloc(1, cap); checkpointPath = taosMemoryCalloc(1, cap);
checkpointRoot = taosMemoryCalloc(1, cap); checkpointRoot = taosMemoryCalloc(1, cap);
if (prefixPath == NULL || defaultPath == NULL || checkpointPath == NULL || checkpointRoot == NULL) { if (prefixPath == NULL || defaultPath == NULL || checkpointPath == NULL || checkpointRoot == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _EXIT; goto _EXIT;
} }
@ -1343,7 +1342,7 @@ int32_t chkpGetAllDbCfHandle2(STaskDbWrapper* pBackend, rocksdb_column_family_ha
rocksdb_column_family_handle_t** ppCf = taosMemoryCalloc(nCf, sizeof(rocksdb_column_family_handle_t*)); rocksdb_column_family_handle_t** ppCf = taosMemoryCalloc(nCf, sizeof(rocksdb_column_family_handle_t*));
if (ppCf == NULL) { if (ppCf == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception); TAOS_CHECK_GOTO(terrno, NULL, _exception);
} }
for (int i = 0; i < nCf; i++) { for (int i = 0; i < nCf; i++) {
ppCf[i] = taosArrayGetP(pHandle, i); ppCf[i] = taosArrayGetP(pHandle, i);
@ -1410,7 +1409,7 @@ int32_t chkpPreBuildDir(char* path, int64_t chkpId, char** chkpDir, char** chkpI
char* pChkpDir = taosMemoryCalloc(1, cap); char* pChkpDir = taosMemoryCalloc(1, cap);
char* pChkpIdDir = taosMemoryCalloc(1, cap); char* pChkpIdDir = taosMemoryCalloc(1, cap);
if (pChkpDir == NULL || pChkpIdDir == NULL) { if (pChkpDir == NULL || pChkpIdDir == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _EXIT; goto _EXIT;
} }
@ -1587,7 +1586,7 @@ int32_t chkpLoadExtraInfo(char* pChkpIdDir, int64_t* chkpId, int64_t* processId)
int32_t cap = len + 64; int32_t cap = len + 64;
char* pDst = taosMemoryCalloc(1, cap); char* pDst = taosMemoryCalloc(1, cap);
if (pDst == NULL) { if (pDst == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
stError("failed to alloc memory to load extra info, dir:%s", pChkpIdDir); stError("failed to alloc memory to load extra info, dir:%s", pChkpIdDir);
goto _EXIT; goto _EXIT;
} }
@ -1643,7 +1642,7 @@ int32_t chkpAddExtraInfo(char* pChkpIdDir, int64_t chkpId, int64_t processId) {
int32_t cap = len + 64; int32_t cap = len + 64;
char* pDst = taosMemoryCalloc(1, cap); char* pDst = taosMemoryCalloc(1, cap);
if (pDst == NULL) { if (pDst == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
stError("failed to alloc memory to add extra info, dir:%s", pChkpIdDir); stError("failed to alloc memory to add extra info, dir:%s", pChkpIdDir);
goto _EXIT; goto _EXIT;
} }
@ -2119,7 +2118,7 @@ int32_t valueEncode(void* value, int32_t vlen, int64_t ttl, char** dest) {
if (vlen > 512) { if (vlen > 512) {
dst = taosMemoryCalloc(1, vlen + 128); dst = taosMemoryCalloc(1, vlen + 128);
if (dst == NULL) { if (dst == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t dstCap = vlen + 128; int32_t dstCap = vlen + 128;
int32_t compressedSize = LZ4_compress_default((char*)value, dst, vlen, dstCap); int32_t compressedSize = LZ4_compress_default((char*)value, dst, vlen, dstCap);
@ -2134,7 +2133,7 @@ int32_t valueEncode(void* value, int32_t vlen, int64_t ttl, char** dest) {
size_t size = sizeof(key.unixTimestamp) + sizeof(key.len) + sizeof(key.rawLen) + sizeof(key.compress) + key.len; size_t size = sizeof(key.unixTimestamp) + sizeof(key.len) + sizeof(key.rawLen) + sizeof(key.compress) + key.len;
char* p = taosMemoryCalloc(1, size); char* p = taosMemoryCalloc(1, size);
if (p == NULL) { if (p == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exception; goto _exception;
} }
char* buf = p; char* buf = p;
@ -2210,7 +2209,7 @@ int32_t valueDecode(void* value, int32_t vlen, int64_t* ttl, char** dest) {
} }
pOutput = taosMemoryCalloc(1, key.rawLen); pOutput = taosMemoryCalloc(1, key.rawLen);
if (pOutput == NULL) { if (pOutput == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _EXCEPT; goto _EXCEPT;
} }
@ -2530,7 +2529,7 @@ int32_t taskDbBuildFullPath(char* path, char* key, char** dbFullPath, char** sta
int32_t code = 0; int32_t code = 0;
char* statePath = taosMemoryCalloc(1, strlen(path) + 128); char* statePath = taosMemoryCalloc(1, strlen(path) + 128);
if (statePath == NULL) { if (statePath == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
sprintf(statePath, "%s%s%s", path, TD_DIRSEP, key); sprintf(statePath, "%s%s%s", path, TD_DIRSEP, key);
@ -2547,7 +2546,7 @@ int32_t taskDbBuildFullPath(char* path, char* key, char** dbFullPath, char** sta
char* dbPath = taosMemoryCalloc(1, strlen(statePath) + 128); char* dbPath = taosMemoryCalloc(1, strlen(statePath) + 128);
if (dbPath == NULL) { if (dbPath == NULL) {
taosMemoryFree(statePath); taosMemoryFree(statePath);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
sprintf(dbPath, "%s%s%s", statePath, TD_DIRSEP, "state"); sprintf(dbPath, "%s%s%s", statePath, TD_DIRSEP, "state");
@ -2765,7 +2764,7 @@ int32_t taskDbGenChkpUploadData__rsync(STaskDbWrapper* pDb, int64_t chkpId, char
char* buf = taosMemoryCalloc(1, cap); char* buf = taosMemoryCalloc(1, cap);
if (buf == NULL) { if (buf == NULL) {
(void)taosReleaseRef(taskDbWrapperId, refId); (void)taosReleaseRef(taskDbWrapperId, refId);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
nBytes = nBytes =
@ -2795,7 +2794,7 @@ int32_t taskDbGenChkpUploadData__s3(STaskDbWrapper* pDb, void* bkdChkpMgt, int64
char* temp = taosMemoryCalloc(1, cap); char* temp = taosMemoryCalloc(1, cap);
if (temp == NULL) { if (temp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t nBytes = snprintf(temp, cap, "%s%s%s%" PRId64, pDb->path, TD_DIRSEP, "tmp", chkpId); int32_t nBytes = snprintf(temp, cap, "%s%s%s%" PRId64, pDb->path, TD_DIRSEP, "tmp", chkpId);
@ -4555,7 +4554,7 @@ int32_t compareHashTableImpl(SHashObj* p1, SHashObj* p2, SArray* diff) {
if (!isBkdDataMeta(name, len) && !taosHashGet(p1, name, len)) { if (!isBkdDataMeta(name, len) && !taosHashGet(p1, name, len)) {
char* fname = taosMemoryCalloc(1, len + 1); char* fname = taosMemoryCalloc(1, len + 1);
if (fname == NULL) { if (fname == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
(void)strncpy(fname, name, len); (void)strncpy(fname, name, len);
if (taosArrayPush(diff, &fname) == NULL) { if (taosArrayPush(diff, &fname) == NULL) {
@ -4716,7 +4715,7 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
char* fname = taosMemoryCalloc(1, len + 1); char* fname = taosMemoryCalloc(1, len + 1);
if (fname == NULL) { if (fname == NULL) {
(void)taosThreadRwlockUnlock(&p->rwLock); (void)taosThreadRwlockUnlock(&p->rwLock);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
(void)strncpy(fname, name, len); (void)strncpy(fname, name, len);
@ -4767,7 +4766,7 @@ int32_t dbChkpCreate(char* path, int64_t initChkpId, SDbChkp** ppChkp) {
int32_t code = 0; int32_t code = 0;
SDbChkp* p = taosMemoryCalloc(1, sizeof(SDbChkp)); SDbChkp* p = taosMemoryCalloc(1, sizeof(SDbChkp));
if (p == NULL) { if (p == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _EXIT; goto _EXIT;
} }
@ -4784,7 +4783,7 @@ int32_t dbChkpCreate(char* path, int64_t initChkpId, SDbChkp** ppChkp) {
p->len = strlen(path) + 128; p->len = strlen(path) + 128;
p->buf = taosMemoryCalloc(1, p->len); p->buf = taosMemoryCalloc(1, p->len);
if (p->buf == NULL) { if (p->buf == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _EXIT; goto _EXIT;
} }
@ -4861,7 +4860,7 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) {
char* buffer = taosMemoryCalloc(4, cap); char* buffer = taosMemoryCalloc(4, cap);
if (buffer == NULL) { if (buffer == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _ERROR; goto _ERROR;
} }
@ -5026,8 +5025,7 @@ int32_t bkdMgtCreate(char* path, SBkdMgt** mgt) {
int32_t code = 0; int32_t code = 0;
SBkdMgt* p = taosMemoryCalloc(1, sizeof(SBkdMgt)); SBkdMgt* p = taosMemoryCalloc(1, sizeof(SBkdMgt));
if (p == NULL) { if (p == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; return terrno;
return code;
} }
p->pDbChkpTbl = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); p->pDbChkpTbl = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
@ -5081,7 +5079,7 @@ int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list,
char* path = taosMemoryCalloc(1, cap); char* path = taosMemoryCalloc(1, cap);
if (path == NULL) { if (path == NULL) {
(void)taosThreadRwlockUnlock(&bm->rwLock); (void)taosThreadRwlockUnlock(&bm->rwLock);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t nBytes = snprintf(path, cap, "%s%s%s", bm->path, TD_DIRSEP, taskId); int32_t nBytes = snprintf(path, cap, "%s%s%s", bm->path, TD_DIRSEP, taskId);

View File

@ -49,7 +49,7 @@ int32_t createChkptTriggerBlock(SStreamTask* pTask, int32_t checkpointType, int6
SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock)); SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock));
if (pBlock == NULL) { if (pBlock == NULL) {
taosFreeQitem(pChkpoint); taosFreeQitem(pChkpoint);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pBlock->info.type = STREAM_CHECKPOINT; pBlock->info.type = STREAM_CHECKPOINT;
@ -704,7 +704,7 @@ static int32_t getCheckpointDataMeta(const char* id, const char* path, SArray* l
char* filePath = taosMemoryCalloc(1, cap); char* filePath = taosMemoryCalloc(1, cap);
if (filePath == NULL) { if (filePath == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t nBytes = snprintf(filePath, cap, "%s%s%s", path, TD_DIRSEP, "META_TMP"); int32_t nBytes = snprintf(filePath, cap, "%s%s%s", path, TD_DIRSEP, "META_TMP");
@ -1296,7 +1296,7 @@ int32_t downloadCheckpointByNameS3(const char* id, const char* fname, const char
char* buf = taosMemoryCalloc(1, cap); char* buf = taosMemoryCalloc(1, cap);
if (buf == NULL) { if (buf == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
nBytes = snprintf(buf, cap, "%s/%s", id, fname); nBytes = snprintf(buf, cap, "%s/%s", id, fname);

View File

@ -143,7 +143,7 @@ static int32_t buildStreamRetrieveReq(SStreamTask* pTask, const SSDataBlock* pBl
int32_t len = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock) + PAYLOAD_PREFIX_LEN; int32_t len = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock) + PAYLOAD_PREFIX_LEN;
pRetrieve = taosMemoryCalloc(1, len); pRetrieve = taosMemoryCalloc(1, len);
if (pRetrieve == NULL) return TSDB_CODE_OUT_OF_MEMORY; if (pRetrieve == NULL) return terrno;
int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
pRetrieve->useconds = 0; pRetrieve->useconds = 0;

View File

@ -314,7 +314,7 @@ int32_t createMetaHbInfo(int64_t* pRid, SMetaHbInfo** pRes) {
*pRes = NULL; *pRes = NULL;
SMetaHbInfo* pInfo = taosMemoryCalloc(1, sizeof(SMetaHbInfo)); SMetaHbInfo* pInfo = taosMemoryCalloc(1, sizeof(SMetaHbInfo));
if (pInfo == NULL) { if (pInfo == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pInfo->hbTmr = taosTmrStart(streamMetaHbToMnode, META_HB_CHECK_INTERVAL, pRid, streamTimer); pInfo->hbTmr = taosTmrStart(streamMetaHbToMnode, META_HB_CHECK_INTERVAL, pRid, streamTimer);

View File

@ -357,13 +357,13 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn,
SStreamMeta* pMeta = taosMemoryCalloc(1, sizeof(SStreamMeta)); SStreamMeta* pMeta = taosMemoryCalloc(1, sizeof(SStreamMeta));
if (pMeta == NULL) { if (pMeta == NULL) {
stError("vgId:%d failed to prepare stream meta, alloc size:%" PRIzu ", out of memory", vgId, sizeof(SStreamMeta)); stError("vgId:%d failed to prepare stream meta, alloc size:%" PRIzu ", out of memory", vgId, sizeof(SStreamMeta));
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t len = strlen(path) + 64; int32_t len = strlen(path) + 64;
char* tpath = taosMemoryCalloc(1, len); char* tpath = taosMemoryCalloc(1, len);
if (tpath == NULL) { if (tpath == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _err; goto _err;
} }
@ -630,7 +630,7 @@ int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask) {
buf = taosMemoryCalloc(1, len); buf = taosMemoryCalloc(1, len);
if (buf == NULL) { if (buf == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
if (pTask->ver < SSTREAM_TASK_SUBTABLE_CHANGED_VER) { if (pTask->ver < SSTREAM_TASK_SUBTABLE_CHANGED_VER) {

View File

@ -51,7 +51,7 @@ int32_t streamQueueOpen(int64_t cap, SStreamQueue** pQ) {
SStreamQueue* pQueue = taosMemoryCalloc(1, sizeof(SStreamQueue)); SStreamQueue* pQueue = taosMemoryCalloc(1, sizeof(SStreamQueue));
if (pQueue == NULL) { if (pQueue == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
code = taosOpenQueue(&pQueue->pQueue); code = taosOpenQueue(&pQueue->pQueue);
@ -372,7 +372,7 @@ int32_t streamTaskPutTranstateIntoInputQ(SStreamTask* pTask) {
pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock)); pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock));
if (pBlock == NULL) { if (pBlock == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _err; goto _err;
} }

View File

@ -347,7 +347,7 @@ int32_t streamBackendSnapInitFile(char* metaPath, SStreamTaskSnap* pSnap, SBacke
char* path = taosMemoryCalloc(1, cap); char* path = taosMemoryCalloc(1, cap);
if (path == NULL) { if (path == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
nBytes = snprintf(path, cap, "%s%s%s%s%s%" PRId64 "", pSnap->dbPrefixPath, TD_DIRSEP, "checkpoints", TD_DIRSEP, nBytes = snprintf(path, cap, "%s%s%s%s%s%" PRId64 "", pSnap->dbPrefixPath, TD_DIRSEP, "checkpoints", TD_DIRSEP,
@ -492,7 +492,7 @@ int32_t streamSnapReaderOpen(void* pMeta, int64_t sver, int64_t chkpId, char* pa
// impl later // impl later
SStreamSnapReader* pReader = taosMemoryCalloc(1, sizeof(SStreamSnapReader)); SStreamSnapReader* pReader = taosMemoryCalloc(1, sizeof(SStreamSnapReader));
if (pReader == NULL) { if (pReader == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t code = streamSnapHandleInit(&pReader->handle, (char*)path, pMeta); int32_t code = streamSnapHandleInit(&pReader->handle, (char*)path, pMeta);
@ -632,7 +632,7 @@ int32_t streamSnapWriterOpen(void* pMeta, int64_t sver, int64_t ever, char* path
int32_t code = 0; int32_t code = 0;
SStreamSnapWriter* pWriter = taosMemoryCalloc(1, sizeof(SStreamSnapWriter)); SStreamSnapWriter* pWriter = taosMemoryCalloc(1, sizeof(SStreamSnapWriter));
if (pWriter == NULL) { if (pWriter == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
SStreamSnapHandle* pHandle = &pWriter->handle; SStreamSnapHandle* pHandle = &pWriter->handle;

View File

@ -432,7 +432,7 @@ int32_t createHTaskLaunchInfo(SStreamMeta* pMeta, STaskId* pTaskId, int64_t hStr
SLaunchHTaskInfo** pInfo) { SLaunchHTaskInfo** pInfo) {
*pInfo = taosMemoryCalloc(1, sizeof(SLaunchHTaskInfo)); *pInfo = taosMemoryCalloc(1, sizeof(SLaunchHTaskInfo));
if ((*pInfo) == NULL) { if ((*pInfo) == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
(*pInfo)->id.streamId = pTaskId->streamId; (*pInfo)->id.streamId = pTaskId->streamId;

View File

@ -483,7 +483,7 @@ int32_t streamStateGetParName(SStreamState* pState, int64_t groupId, void** pVal
} }
*pVal = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN); *pVal = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN);
if (!(*pVal)) { if (!(*pVal)) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }

View File

@ -111,7 +111,7 @@ int32_t tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset, bool
if (pTask == NULL) { if (pTask == NULL) {
stError("s-task:0x%" PRIx64 " failed malloc new stream task, size:%d, code:%s", streamId, stError("s-task:0x%" PRIx64 " failed malloc new stream task, size:%d, code:%s", streamId,
(int32_t)sizeof(SStreamTask), tstrerror(terrno)); (int32_t)sizeof(SStreamTask), tstrerror(terrno));
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pTask->ver = SSTREAM_TASK_VER; pTask->ver = SSTREAM_TASK_VER;
@ -489,7 +489,7 @@ int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, i
if (pOutputInfo->pTokenBucket == NULL) { if (pOutputInfo->pTokenBucket == NULL) {
stError("s-task:%s failed to prepare the tokenBucket, code:%s", pTask->id.idStr, stError("s-task:%s failed to prepare the tokenBucket, code:%s", pTask->id.idStr,
tstrerror(TSDB_CODE_OUT_OF_MEMORY)); tstrerror(TSDB_CODE_OUT_OF_MEMORY));
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
// 2MiB per second for sink task // 2MiB per second for sink task
@ -1196,7 +1196,7 @@ void streamTaskSetFailedChkptInfo(SStreamTask* pTask, int32_t transId, int64_t c
int32_t streamTaskCreateActiveChkptInfo(SActiveCheckpointInfo** pRes) { int32_t streamTaskCreateActiveChkptInfo(SActiveCheckpointInfo** pRes) {
SActiveCheckpointInfo* pInfo = taosMemoryCalloc(1, sizeof(SActiveCheckpointInfo)); SActiveCheckpointInfo* pInfo = taosMemoryCalloc(1, sizeof(SActiveCheckpointInfo));
if (pInfo == NULL) { if (pInfo == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t code = taosThreadMutexInit(&pInfo->lock, NULL); int32_t code = taosThreadMutexInit(&pInfo->lock, NULL);

View File

@ -286,7 +286,7 @@ int32_t streamCreateStateMachine(SStreamTask* pTask) {
if (pSM == NULL) { if (pSM == NULL) {
stError("s-task:%s failed to create task stateMachine, size:%d, code:%s", id, (int32_t)sizeof(SStreamTaskSM), stError("s-task:%s failed to create task stateMachine, size:%d, code:%s", id, (int32_t)sizeof(SStreamTaskSM),
tstrerror(terrno)); tstrerror(terrno));
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pSM->pTask = pTask; pSM->pTask = pTask;

View File

@ -150,7 +150,7 @@ int32_t updateInfoInit(int64_t interval, int32_t precision, int64_t watermark, b
int32_t lino = 0; int32_t lino = 0;
SUpdateInfo* pInfo = taosMemoryCalloc(1, sizeof(SUpdateInfo)); SUpdateInfo* pInfo = taosMemoryCalloc(1, sizeof(SUpdateInfo));
if (pInfo == NULL) { if (pInfo == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }
pInfo->pTsBuckets = NULL; pInfo->pTsBuckets = NULL;
@ -203,12 +203,12 @@ int32_t updateInfoInit(int64_t interval, int32_t precision, int64_t watermark, b
pInfo->pkColType = pkType; pInfo->pkColType = pkType;
pInfo->pKeyBuff = taosMemoryCalloc(1, sizeof(TSKEY) + sizeof(int64_t) + pkLen); pInfo->pKeyBuff = taosMemoryCalloc(1, sizeof(TSKEY) + sizeof(int64_t) + pkLen);
if (!pInfo->pKeyBuff) { if (!pInfo->pKeyBuff) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }
pInfo->pValueBuff = taosMemoryCalloc(1, sizeof(TSKEY) + pkLen); pInfo->pValueBuff = taosMemoryCalloc(1, sizeof(TSKEY) + pkLen);
if (!pInfo->pValueBuff) { if (!pInfo->pValueBuff) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }
if (pkLen != 0) { if (pkLen != 0) {

View File

@ -626,7 +626,7 @@ int32_t getRowBuffByPos(SStreamFileState* pFileState, SRowBuffPos* pPos, void**
if (pFileState->curRowCount < pFileState->maxRowCount) { if (pFileState->curRowCount < pFileState->maxRowCount) {
pPos->pRowBuff = taosMemoryCalloc(1, pFileState->rowSize); pPos->pRowBuff = taosMemoryCalloc(1, pFileState->rowSize);
if (!pPos->pRowBuff) { if (!pPos->pRowBuff) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }
pFileState->curRowCount++; pFileState->curRowCount++;