modify error code passing

This commit is contained in:
lyh250-666 2024-09-12 20:57:36 +08:00
parent 41dfc643b7
commit c8ee66eee2
16 changed files with 66 additions and 68 deletions

View File

@ -170,7 +170,7 @@ int32_t cos_cp_load(char const* filepath, SCheckpoint* checkpoint) {
cp_body = taosMemoryMalloc(size + 1); cp_body = taosMemoryMalloc(size + 1);
if (!cp_body) { if (!cp_body) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); TAOS_CHECK_GOTO(terrno, &lino, _exit);
} }
int64_t n = taosReadFile(fd, cp_body, size); int64_t n = taosReadFile(fd, cp_body, size);

View File

@ -124,7 +124,7 @@ int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const
char* buf = taosMemoryRealloc(pColumnInfoData->pData, newSize); char* buf = taosMemoryRealloc(pColumnInfoData->pData, newSize);
if (buf == NULL) { if (buf == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pColumnInfoData->pData = buf; pColumnInfoData->pData = buf;
@ -170,7 +170,7 @@ static int32_t colDataReserve(SColumnInfoData* pColumnInfoData, size_t newSize)
if (pColumnInfoData->varmeta.allocLen < newSize) { if (pColumnInfoData->varmeta.allocLen < newSize) {
char* buf = taosMemoryRealloc(pColumnInfoData->pData, newSize); char* buf = taosMemoryRealloc(pColumnInfoData->pData, newSize);
if (buf == NULL) { if (buf == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pColumnInfoData->pData = buf; pColumnInfoData->pData = buf;
@ -388,7 +388,7 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int
if (finalNumOfRows > (*capacity)) { if (finalNumOfRows > (*capacity)) {
char* p = taosMemoryRealloc(pColumnInfoData->varmeta.offset, sizeof(int32_t) * (numOfRow1 + numOfRow2)); char* p = taosMemoryRealloc(pColumnInfoData->varmeta.offset, sizeof(int32_t) * (numOfRow1 + numOfRow2));
if (p == NULL) { if (p == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
*capacity = finalNumOfRows; *capacity = finalNumOfRows;
@ -409,7 +409,7 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int
if (pColumnInfoData->varmeta.allocLen < len + oldLen) { if (pColumnInfoData->varmeta.allocLen < len + oldLen) {
char* tmp = taosMemoryRealloc(pColumnInfoData->pData, len + oldLen); char* tmp = taosMemoryRealloc(pColumnInfoData->pData, len + oldLen);
if (tmp == NULL) { if (tmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pColumnInfoData->pData = tmp; pColumnInfoData->pData = tmp;
@ -425,14 +425,14 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int
// all data may be null, when the pColumnInfoData->info.type == 0, bytes == 0; // all data may be null, when the pColumnInfoData->info.type == 0, bytes == 0;
char* tmp = taosMemoryRealloc(pColumnInfoData->pData, finalNumOfRows * pColumnInfoData->info.bytes); char* tmp = taosMemoryRealloc(pColumnInfoData->pData, finalNumOfRows * pColumnInfoData->info.bytes);
if (tmp == NULL) { if (tmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pColumnInfoData->pData = tmp; pColumnInfoData->pData = tmp;
if (BitmapLen(numOfRow1) < BitmapLen(finalNumOfRows)) { if (BitmapLen(numOfRow1) < BitmapLen(finalNumOfRows)) {
char* btmp = taosMemoryRealloc(pColumnInfoData->nullbitmap, BitmapLen(finalNumOfRows)); char* btmp = taosMemoryRealloc(pColumnInfoData->nullbitmap, BitmapLen(finalNumOfRows));
if (btmp == NULL) { if (btmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
uint32_t extend = BitmapLen(finalNumOfRows) - BitmapLen(numOfRow1); uint32_t extend = BitmapLen(finalNumOfRows) - BitmapLen(numOfRow1);
memset(btmp + BitmapLen(numOfRow1), 0, extend); memset(btmp + BitmapLen(numOfRow1), 0, extend);
@ -469,7 +469,7 @@ int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* p
if (pColumnInfoData->varmeta.allocLen < newLen) { if (pColumnInfoData->varmeta.allocLen < newLen) {
char* tmp = taosMemoryRealloc(pColumnInfoData->pData, newLen); char* tmp = taosMemoryRealloc(pColumnInfoData->pData, newLen);
if (tmp == NULL) { if (tmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pColumnInfoData->pData = tmp; pColumnInfoData->pData = tmp;
@ -545,7 +545,7 @@ int32_t colDataAssignNRows(SColumnInfoData* pDst, int32_t dstIdx, const SColumnI
if (pDst->varmeta.allocLen < pDst->varmeta.length + allLen) { if (pDst->varmeta.allocLen < pDst->varmeta.length + allLen) {
char* tmp = taosMemoryRealloc(pDst->pData, pDst->varmeta.length + allLen); char* tmp = taosMemoryRealloc(pDst->pData, pDst->varmeta.length + allLen);
if (tmp == NULL) { if (tmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pDst->pData = tmp; pDst->pData = tmp;
@ -995,7 +995,7 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
size_t metaSize = pBlock->info.rows * sizeof(int32_t); size_t metaSize = pBlock->info.rows * sizeof(int32_t);
char* tmp = taosMemoryRealloc(pCol->varmeta.offset, metaSize); // preview calloc is too small char* tmp = taosMemoryRealloc(pCol->varmeta.offset, metaSize); // preview calloc is too small
if (tmp == NULL) { if (tmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pCol->varmeta.offset = (int32_t*)tmp; pCol->varmeta.offset = (int32_t*)tmp;
@ -1013,7 +1013,7 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
if (pCol->varmeta.allocLen < colLength) { if (pCol->varmeta.allocLen < colLength) {
char* tmp = taosMemoryRealloc(pCol->pData, colLength); char* tmp = taosMemoryRealloc(pCol->pData, colLength);
if (tmp == NULL) { if (tmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pCol->pData = tmp; pCol->pData = tmp;
@ -1094,7 +1094,7 @@ int32_t blockDataFromBuf1(SSDataBlock* pBlock, const char* buf, size_t capacity)
if (pCol->varmeta.allocLen < colLength) { if (pCol->varmeta.allocLen < colLength) {
char* tmp = taosMemoryRealloc(pCol->pData, colLength); char* tmp = taosMemoryRealloc(pCol->pData, colLength);
if (tmp == NULL) { if (tmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pCol->pData = tmp; pCol->pData = tmp;
@ -1417,7 +1417,6 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) {
int32_t* index = createTupleIndex(rows); int32_t* index = createTupleIndex(rows);
if (index == NULL) { if (index == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return terrno; return terrno;
} }
@ -1540,7 +1539,7 @@ int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* pBlockI
if (IS_VAR_DATA_TYPE(pColumn->info.type)) { if (IS_VAR_DATA_TYPE(pColumn->info.type)) {
char* tmp = taosMemoryRealloc(pColumn->varmeta.offset, sizeof(int32_t) * numOfRows); char* tmp = taosMemoryRealloc(pColumn->varmeta.offset, sizeof(int32_t) * numOfRows);
if (tmp == NULL) { if (tmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pColumn->varmeta.offset = (int32_t*)tmp; pColumn->varmeta.offset = (int32_t*)tmp;
@ -1549,7 +1548,7 @@ int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* pBlockI
// prepare for the null bitmap // prepare for the null bitmap
char* tmp = taosMemoryRealloc(pColumn->nullbitmap, BitmapLen(numOfRows)); char* tmp = taosMemoryRealloc(pColumn->nullbitmap, BitmapLen(numOfRows));
if (tmp == NULL) { if (tmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t oldLen = BitmapLen(existedRows); int32_t oldLen = BitmapLen(existedRows);
@ -1563,7 +1562,7 @@ int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* pBlockI
// to MALLOC_ALIGN_BYTES // to MALLOC_ALIGN_BYTES
tmp = taosMemoryMallocAlign(MALLOC_ALIGN_BYTES, numOfRows * pColumn->info.bytes); tmp = taosMemoryMallocAlign(MALLOC_ALIGN_BYTES, numOfRows * pColumn->info.bytes);
if (tmp == NULL) { if (tmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
// memset(tmp, 0, numOfRows * pColumn->info.bytes); // memset(tmp, 0, numOfRows * pColumn->info.bytes);

View File

@ -489,7 +489,7 @@ int32_t tRowBuildFromBind(SBindInfo *infos, int32_t numOfInfos, bool infoSorted,
colVal = COL_VAL_VALUE(infos[iInfo].columnId, value); colVal = COL_VAL_VALUE(infos[iInfo].columnId, value);
} }
if (taosArrayPush(colValArray, &colVal) == NULL) { if (taosArrayPush(colValArray, &colVal) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
} }
@ -500,7 +500,7 @@ int32_t tRowBuildFromBind(SBindInfo *infos, int32_t numOfInfos, bool infoSorted,
} }
if ((taosArrayPush(rowArray, &row)) == NULL) { if ((taosArrayPush(rowArray, &row)) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
} }
@ -702,7 +702,7 @@ static int32_t tRowMergeImpl(SArray *aRowP, STSchema *pTSchema, int32_t iStart,
if (pColVal) { if (pColVal) {
if (taosArrayPush(aColVal, pColVal) == NULL) { if (taosArrayPush(aColVal, pColVal) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
} }
@ -1756,7 +1756,7 @@ int32_t tTagToValArray(const STag *pTag, SArray **ppArray) {
} }
(void)tGetTagVal(p + offset, &tv, pTag->flags & TD_TAG_JSON); (void)tGetTagVal(p + offset, &tv, pTag->flags & TD_TAG_JSON);
if (taosArrayPush(*ppArray, &tv) == NULL) { if (taosArrayPush(*ppArray, &tv) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _err; goto _err;
} }
} }
@ -3251,13 +3251,13 @@ int32_t tRowBuildFromBind2(SBindInfo2 *infos, int32_t numOfInfos, bool infoSorte
} }
if ((bufArray = taosArrayInit(numOfInfos, sizeof(uint8_t *))) == NULL) { if ((bufArray = taosArrayInit(numOfInfos, sizeof(uint8_t *))) == NULL) {
taosArrayDestroy(colValArray); taosArrayDestroy(colValArray);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
for (int i = 0; i < numOfInfos; ++i) { for (int i = 0; i < numOfInfos; ++i) {
if (!taosArrayPush(bufArray, &infos[i].bind->buffer)) { if (!taosArrayPush(bufArray, &infos[i].bind->buffer)) {
taosArrayDestroy(colValArray); taosArrayDestroy(colValArray);
taosArrayDestroy(bufArray); taosArrayDestroy(bufArray);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
} }
@ -3294,7 +3294,7 @@ int32_t tRowBuildFromBind2(SBindInfo2 *infos, int32_t numOfInfos, bool infoSorte
colVal = COL_VAL_VALUE(infos[iInfo].columnId, value); colVal = COL_VAL_VALUE(infos[iInfo].columnId, value);
} }
if (taosArrayPush(colValArray, &colVal) == NULL) { if (taosArrayPush(colValArray, &colVal) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
} }
@ -3305,7 +3305,7 @@ int32_t tRowBuildFromBind2(SBindInfo2 *infos, int32_t numOfInfos, bool infoSorte
} }
if ((taosArrayPush(rowArray, &row)) == NULL) { if ((taosArrayPush(rowArray, &row)) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
} }
@ -3502,7 +3502,7 @@ static int32_t tColDataMerge(SArray **colArr) {
dst = taosArrayInit(taosArrayGetSize(src), sizeof(SColData)); dst = taosArrayInit(taosArrayGetSize(src), sizeof(SColData));
if (dst == NULL) { if (dst == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
for (int32_t i = 0; i < taosArrayGetSize(src); i++) { for (int32_t i = 0; i < taosArrayGetSize(src); i++) {

View File

@ -179,7 +179,7 @@ int32_t epsetToStr(const SEpSet* pEpSet, char* pBuf, int32_t cap) {
int32_t taosGenCrashJsonMsg(int signum, char** pMsg, int64_t clusterId, int64_t startTime) { int32_t taosGenCrashJsonMsg(int signum, char** pMsg, int64_t clusterId, int64_t startTime) {
int32_t code = 0; int32_t code = 0;
SJson* pJson = tjsonCreateObject(); SJson* pJson = tjsonCreateObject();
if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY; if (pJson == NULL) return terrno;
char tmp[4096] = {0}; char tmp[4096] = {0};
@ -242,7 +242,7 @@ int32_t taosGenCrashJsonMsg(int signum, char** pMsg, int64_t clusterId, int64_t
char* pCont = tjsonToString(pJson); char* pCont = tjsonToString(pJson);
if (pCont == NULL) { if (pCont == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
TAOS_CHECK_GOTO(code, NULL, _exit); TAOS_CHECK_GOTO(code, NULL, _exit);
goto _exit; goto _exit;
} }

View File

@ -12026,19 +12026,19 @@ int32_t tCloneTbTSMAInfo(STableTSMAInfo *pInfo, STableTSMAInfo **pRes) {
*pRet = *pInfo; *pRet = *pInfo;
if (pInfo->pFuncs) { if (pInfo->pFuncs) {
pRet->pFuncs = taosArrayDup(pInfo->pFuncs, NULL); pRet->pFuncs = taosArrayDup(pInfo->pFuncs, NULL);
if (!pRet->pFuncs) code = TSDB_CODE_OUT_OF_MEMORY; if (!pRet->pFuncs) code = terrno;
} }
if (pInfo->pTags && code == TSDB_CODE_SUCCESS) { if (pInfo->pTags && code == TSDB_CODE_SUCCESS) {
pRet->pTags = taosArrayDup(pInfo->pTags, NULL); pRet->pTags = taosArrayDup(pInfo->pTags, NULL);
if (!pRet->pTags) code = TSDB_CODE_OUT_OF_MEMORY; if (!pRet->pTags) code = terrno;
} }
if (pInfo->pUsedCols && code == TSDB_CODE_SUCCESS) { if (pInfo->pUsedCols && code == TSDB_CODE_SUCCESS) {
pRet->pUsedCols = taosArrayDup(pInfo->pUsedCols, NULL); pRet->pUsedCols = taosArrayDup(pInfo->pUsedCols, NULL);
if (!pRet->pUsedCols) code = TSDB_CODE_OUT_OF_MEMORY; if (!pRet->pUsedCols) code = terrno;
} }
if (pInfo->ast && code == TSDB_CODE_SUCCESS) { if (pInfo->ast && code == TSDB_CODE_SUCCESS) {
pRet->ast = taosStrdup(pInfo->ast); pRet->ast = taosStrdup(pInfo->ast);
if (!pRet->ast) code = TSDB_CODE_OUT_OF_MEMORY; if (!pRet->ast) code = terrno;
} }
if (code) { if (code) {
tFreeAndClearTableTSMAInfo(pRet); tFreeAndClearTableTSMAInfo(pRet);

View File

@ -482,7 +482,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow, int8_t r
if (isAlloc) { if (isAlloc) {
taosMemoryFreeClear(*ppRow); taosMemoryFreeClear(*ppRow);
} }
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); TAOS_RETURN(terrno);
} }
} }

View File

@ -1247,7 +1247,7 @@ static int32_t parseTsFormat(const char* formatStr, SArray* formats) {
const TSFormatKeyWord* key = keywordSearch(formatStr); const TSFormatKeyWord* key = keywordSearch(formatStr);
if (key) { if (key) {
TSFormatNode format = {.key = key, .type = TS_FORMAT_NODE_TYPE_KEYWORD}; TSFormatNode format = {.key = key, .type = TS_FORMAT_NODE_TYPE_KEYWORD};
if (NULL == taosArrayPush(formats, &format)) TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); if (NULL == taosArrayPush(formats, &format)) TAOS_RETURN(terrno);
formatStr += key->len; formatStr += key->len;
lastOtherFormat = NULL; lastOtherFormat = NULL;
} else { } else {
@ -1274,7 +1274,7 @@ static int32_t parseTsFormat(const char* formatStr, SArray* formats) {
TSFormatNode format = {.type = TS_FORMAT_NODE_TYPE_CHAR, .key = NULL}; TSFormatNode format = {.type = TS_FORMAT_NODE_TYPE_CHAR, .key = NULL};
format.c = formatStr; format.c = formatStr;
format.len = 1; format.len = 1;
if (NULL == taosArrayPush(formats, &format)) TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); if (NULL == taosArrayPush(formats, &format)) TAOS_RETURN(terrno);
formatStr++; formatStr++;
last = taosArrayGetLast(formats); last = taosArrayGetLast(formats);
} }
@ -1301,7 +1301,7 @@ static int32_t parseTsFormat(const char* formatStr, SArray* formats) {
.key = NULL}; .key = NULL};
format.c = formatStr; format.c = formatStr;
format.len = 1; format.len = 1;
if (NULL == taosArrayPush(formats, &format)) TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); if (NULL == taosArrayPush(formats, &format)) TAOS_RETURN(terrno);
formatStr++; formatStr++;
if (format.type == TS_FORMAT_NODE_TYPE_CHAR) lastOtherFormat = taosArrayGetLast(formats); if (format.type == TS_FORMAT_NODE_TYPE_CHAR) lastOtherFormat = taosArrayGetLast(formats);
} }
@ -1910,7 +1910,7 @@ int32_t taosTs2Char(const char* format, SArray** formats, int64_t ts, int32_t pr
if (!*formats) { if (!*formats) {
*formats = taosArrayInit(8, sizeof(TSFormatNode)); *formats = taosArrayInit(8, sizeof(TSFormatNode));
if (!*formats) { if (!*formats) {
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); TAOS_RETURN(terrno);
} }
TAOS_CHECK_RETURN(parseTsFormat(format, *formats)); TAOS_CHECK_RETURN(parseTsFormat(format, *formats));
} }
@ -1926,7 +1926,7 @@ int32_t taosChar2Ts(const char* format, SArray** formats, const char* tsStr, int
if (!*formats) { if (!*formats) {
*formats = taosArrayInit(4, sizeof(TSFormatNode)); *formats = taosArrayInit(4, sizeof(TSFormatNode));
if (!*formats) { if (!*formats) {
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); TAOS_RETURN(terrno);
} }
TAOS_CHECK_RETURN(parseTsFormat(format, *formats)); TAOS_CHECK_RETURN(parseTsFormat(format, *formats));
} }
@ -1951,7 +1951,7 @@ int32_t TEST_ts2char(const char* format, int64_t ts, int32_t precision, char* ou
SArray* formats = taosArrayInit(4, sizeof(TSFormatNode)); SArray* formats = taosArrayInit(4, sizeof(TSFormatNode));
if (!formats) { if (!formats) {
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); TAOS_RETURN(terrno);
} }
TAOS_CHECK_RETURN(parseTsFormat(format, formats)); TAOS_CHECK_RETURN(parseTsFormat(format, formats));
struct STm tm; struct STm tm;

View File

@ -345,7 +345,7 @@ int32_t dmProcessServerRunStatus(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
void *pRsp = rpcMallocCont(rspLen); void *pRsp = rpcMallocCont(rspLen);
if (pRsp == NULL) { if (pRsp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
// rspMsg.code = TSDB_CODE_OUT_OF_MEMORY; // rspMsg.code = TSDB_CODE_OUT_OF_MEMORY;
// return rspMsg.code; // return rspMsg.code;
} }
@ -383,7 +383,7 @@ int32_t dmBuildVariablesBlock(SSDataBlock **ppBlock) {
pBlock->pDataBlock = taosArrayInit(pMeta[index].colNum, sizeof(SColumnInfoData)); pBlock->pDataBlock = taosArrayInit(pMeta[index].colNum, sizeof(SColumnInfoData));
if (pBlock->pDataBlock == NULL) { if (pBlock->pDataBlock == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
@ -393,7 +393,7 @@ int32_t dmBuildVariablesBlock(SSDataBlock **ppBlock) {
colInfoData.info.type = pMeta[index].schema[i].type; colInfoData.info.type = pMeta[index].schema[i].type;
colInfoData.info.bytes = pMeta[index].schema[i].bytes; colInfoData.info.bytes = pMeta[index].schema[i].bytes;
if (taosArrayPush(pBlock->pDataBlock, &colInfoData) == NULL) { if (taosArrayPush(pBlock->pDataBlock, &colInfoData) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
} }
@ -457,7 +457,7 @@ int32_t dmProcessRetrieve(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
SRetrieveMetaTableRsp *pRsp = rpcMallocCont(size); SRetrieveMetaTableRsp *pRsp = rpcMallocCont(size);
if (pRsp == NULL) { if (pRsp == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
dError("failed to retrieve data since %s", tstrerror(code)); dError("failed to retrieve data since %s", tstrerror(code));
blockDataDestroy(pBlock); blockDataDestroy(pBlock);
return code; return code;

View File

@ -54,7 +54,7 @@ static int32_t dmOpenMgmt(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
int32_t code = 0; int32_t code = 0;
SDnodeMgmt *pMgmt = taosMemoryCalloc(1, sizeof(SDnodeMgmt)); SDnodeMgmt *pMgmt = taosMemoryCalloc(1, sizeof(SDnodeMgmt));
if (pMgmt == NULL) { if (pMgmt == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pMgmt->pData = pInput->pData; pMgmt->pData = pInput->pData;

View File

@ -91,7 +91,7 @@ int32_t mmReadFile(const char *path, SMnodeOpt *pOption) {
pData = taosMemoryMalloc(size + 1); pData = taosMemoryMalloc(size + 1);
if (pData == NULL) { if (pData == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _OVER; goto _OVER;
} }
@ -134,14 +134,14 @@ static int32_t mmEncodeOption(SJson *pJson, const SMnodeOpt *pOption) {
SJson *replicas = tjsonCreateArray(); SJson *replicas = tjsonCreateArray();
if (replicas == NULL) { if (replicas == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
if ((code = tjsonAddItemToObject(pJson, "replicas", replicas)) < 0) return code; if ((code = tjsonAddItemToObject(pJson, "replicas", replicas)) < 0) return code;
for (int32_t i = 0; i < pOption->numOfTotalReplicas; ++i) { for (int32_t i = 0; i < pOption->numOfTotalReplicas; ++i) {
SJson *replica = tjsonCreateObject(); SJson *replica = tjsonCreateObject();
if (replica == NULL) { if (replica == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
const SReplica *pReplica = pOption->replicas + i; const SReplica *pReplica = pOption->replicas + i;
@ -183,7 +183,7 @@ int32_t mmWriteFile(const char *path, const SMnodeOpt *pOption) {
// terrno = TSDB_CODE_OUT_OF_MEMORY; // terrno = TSDB_CODE_OUT_OF_MEMORY;
pJson = tjsonCreateObject(); pJson = tjsonCreateObject();
if (pJson == NULL) { if (pJson == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _OVER; goto _OVER;
} }

View File

@ -71,14 +71,14 @@ int32_t smStartWorker(SSnodeMgmt *pMgmt) {
int32_t code = 0; int32_t code = 0;
pMgmt->writeWroker = taosArrayInit(0, sizeof(SMultiWorker *)); pMgmt->writeWroker = taosArrayInit(0, sizeof(SMultiWorker *));
if (pMgmt->writeWroker == NULL) { if (pMgmt->writeWroker == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
return code; return code;
} }
for (int32_t i = 0; i < tsNumOfSnodeWriteThreads; i++) { for (int32_t i = 0; i < tsNumOfSnodeWriteThreads; i++) {
SMultiWorker *pWriteWorker = taosMemoryMalloc(sizeof(SMultiWorker)); SMultiWorker *pWriteWorker = taosMemoryMalloc(sizeof(SMultiWorker));
if (pWriteWorker == NULL) { if (pWriteWorker == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
return code; return code;
} }
@ -93,7 +93,7 @@ int32_t smStartWorker(SSnodeMgmt *pMgmt) {
return code; return code;
} }
if (taosArrayPush(pMgmt->writeWroker, &pWriteWorker) == NULL) { if (taosArrayPush(pMgmt->writeWroker, &pWriteWorker) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
return code; return code;
} }
} }

View File

@ -128,7 +128,7 @@ int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t
pData = taosMemoryMalloc(size + 1); pData = taosMemoryMalloc(size + 1);
if (pData == NULL) { if (pData == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _OVER; goto _OVER;
} }
@ -169,7 +169,7 @@ static int32_t vmEncodeVnodeList(SJson *pJson, SVnodeObj **ppVnodes, int32_t num
int32_t code = 0; int32_t code = 0;
SJson *vnodes = tjsonCreateArray(); SJson *vnodes = tjsonCreateArray();
if (vnodes == NULL) { if (vnodes == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
if ((code = tjsonAddItemToObject(pJson, "vnodes", vnodes)) < 0) { if ((code = tjsonAddItemToObject(pJson, "vnodes", vnodes)) < 0) {
tjsonDelete(vnodes); tjsonDelete(vnodes);
@ -181,7 +181,7 @@ static int32_t vmEncodeVnodeList(SJson *pJson, SVnodeObj **ppVnodes, int32_t num
if (pVnode == NULL) continue; if (pVnode == NULL) continue;
SJson *vnode = tjsonCreateObject(); SJson *vnode = tjsonCreateObject();
if (vnode == NULL) return TSDB_CODE_OUT_OF_MEMORY; if (vnode == NULL) return terrno;
if ((code = tjsonAddDoubleToObject(vnode, "vgId", pVnode->vgId)) < 0) return code; if ((code = tjsonAddDoubleToObject(vnode, "vgId", pVnode->vgId)) < 0) return code;
if ((code = tjsonAddDoubleToObject(vnode, "dropped", pVnode->dropped)) < 0) return code; if ((code = tjsonAddDoubleToObject(vnode, "dropped", pVnode->dropped)) < 0) return code;
if ((code = tjsonAddDoubleToObject(vnode, "vgVersion", pVnode->vgVersion)) < 0) return code; if ((code = tjsonAddDoubleToObject(vnode, "vgVersion", pVnode->vgVersion)) < 0) return code;
@ -221,7 +221,7 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
// terrno = TSDB_CODE_OUT_OF_MEMORY; // terrno = TSDB_CODE_OUT_OF_MEMORY;
pJson = tjsonCreateObject(); pJson = tjsonCreateObject();
if (pJson == NULL) { if (pJson == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _OVER; goto _OVER;
} }
if ((code = vmEncodeVnodeList(pJson, ppVnodes, numOfVnodes)) != 0) goto _OVER; if ((code = vmEncodeVnodeList(pJson, ppVnodes, numOfVnodes)) != 0) goto _OVER;

View File

@ -921,7 +921,7 @@ int32_t vmProcessArbHeartBeatReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
void *pRsp = rpcMallocCont(rspLen); void *pRsp = rpcMallocCont(rspLen);
if (pRsp == NULL) { if (pRsp == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = terrno;
goto _OVER; goto _OVER;
} }

View File

@ -161,8 +161,7 @@ int32_t dmInitVars(SDnode *pDnode) {
pData->dnodeHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); pData->dnodeHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK);
if (pData->dnodeHash == NULL) { if (pData->dnodeHash == NULL) {
dError("failed to init dnode hash"); dError("failed to init dnode hash");
code = TSDB_CODE_OUT_OF_MEMORY; return terrno;
return terrno = code;
} }
if ((code = dmReadEps(pData)) != 0) { if ((code = dmReadEps(pData)) != 0) {

View File

@ -217,7 +217,7 @@ int32_t dmReadEps(SDnodeData *pData) {
content = taosMemoryMalloc(size + 1); content = taosMemoryMalloc(size + 1);
if (content == NULL) { if (content == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _OVER; goto _OVER;
} }
@ -321,7 +321,7 @@ int32_t dmWriteEps(SDnodeData *pData) {
TAOS_CHECK_GOTO(dmInitDndInfo(pData), NULL, _OVER); TAOS_CHECK_GOTO(dmInitDndInfo(pData), NULL, _OVER);
pJson = tjsonCreateObject(); pJson = tjsonCreateObject();
if (pJson == NULL) TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _OVER); if (pJson == NULL) TAOS_CHECK_GOTO(terrno, NULL, _OVER);
pData->engineVer = tsVersion; pData->engineVer = tsVersion;
@ -329,7 +329,7 @@ int32_t dmWriteEps(SDnodeData *pData) {
buffer = tjsonToString(pJson); buffer = tjsonToString(pJson);
if (buffer == NULL) { if (buffer == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _OVER); TAOS_CHECK_GOTO(terrno, NULL, _OVER);
} }
pFile = taosOpenFile(file, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH); pFile = taosOpenFile(file, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH);
@ -575,7 +575,7 @@ static int32_t dmDecodeEpPairs(SJson *pJson, SDnodeData *pData) {
tjsonGetUInt16ValueFromDouble(dnode, "new_port", pair.newPort, code); tjsonGetUInt16ValueFromDouble(dnode, "new_port", pair.newPort, code);
if (code < 0) return TSDB_CODE_INVALID_CFG_VALUE; if (code < 0) return TSDB_CODE_INVALID_CFG_VALUE;
if (taosArrayPush(pData->oldDnodeEps, &pair) == NULL) return TSDB_CODE_OUT_OF_MEMORY; if (taosArrayPush(pData->oldDnodeEps, &pair) == NULL) return terrno;
} }
return code; return code;
@ -621,7 +621,7 @@ static int32_t dmReadDnodePairs(SDnodeData *pData) {
content = taosMemoryMalloc(size + 1); content = taosMemoryMalloc(size + 1);
if (content == NULL) { if (content == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _OVER; goto _OVER;
} }
@ -641,7 +641,7 @@ static int32_t dmReadDnodePairs(SDnodeData *pData) {
pData->oldDnodeEps = taosArrayInit(1, sizeof(SDnodeEpPair)); pData->oldDnodeEps = taosArrayInit(1, sizeof(SDnodeEpPair));
if (pData->oldDnodeEps == NULL) { if (pData->oldDnodeEps == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
dError("failed to calloc dnodeEp array since %s", strerror(errno)); dError("failed to calloc dnodeEp array since %s", strerror(errno));
goto _OVER; goto _OVER;
} }

View File

@ -70,7 +70,7 @@ int32_t dmReadFile(const char *path, const char *name, bool *pDeployed) {
content = taosMemoryMalloc(size + 1); content = taosMemoryMalloc(size + 1);
if (content == NULL) { if (content == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _OVER; goto _OVER;
} }
@ -134,7 +134,7 @@ int32_t dmWriteFile(const char *path, const char *name, bool deployed) {
pJson = tjsonCreateObject(); pJson = tjsonCreateObject();
if (pJson == NULL) { if (pJson == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _OVER; goto _OVER;
} }
@ -230,7 +230,7 @@ static int32_t dmWriteCheckCodeFile(char *file, char *realfile, char *key, bool
int32_t len = ENCRYPTED_LEN(sizeof(DM_KEY_INDICATOR)); int32_t len = ENCRYPTED_LEN(sizeof(DM_KEY_INDICATOR));
result = taosMemoryMalloc(len); result = taosMemoryMalloc(len);
if (result == NULL) { if (result == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
SCryptOpts opts; SCryptOpts opts;
@ -338,7 +338,7 @@ static int32_t dmCompareEncryptKey(char *file, char *key, bool toLogFile) {
content = taosMemoryMalloc(size); content = taosMemoryMalloc(size);
if (content == NULL) { if (content == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _OVER; goto _OVER;
} }
@ -479,7 +479,7 @@ static int32_t dmReadEncryptCodeFile(char *file, char **output) {
content = taosMemoryMalloc(size + 1); content = taosMemoryMalloc(size + 1);
if (content == NULL) { if (content == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _OVER; goto _OVER;
} }