enh:modify addede rror code passing

This commit is contained in:
lyh250-666 2024-09-24 16:29:28 +08:00
parent e8b50df6ca
commit 5f6802e0a1
21 changed files with 51 additions and 51 deletions

View File

@ -3179,7 +3179,7 @@ static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow, bool *pI
} }
if (!taosArrayAddAll(pInfo->pTombData, pIter->pMemDelData)) { if (!taosArrayAddAll(pInfo->pTombData, pIter->pMemDelData)) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _err); TAOS_CHECK_GOTO(terrno, &lino, _err);
} }
size_t delSize = TARRAY_SIZE(pInfo->pTombData); size_t delSize = TARRAY_SIZE(pInfo->pTombData);

View File

@ -299,7 +299,7 @@ static int32_t filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader, bo
pReader->status.pLDataIterArray = taosArrayInit(4, POINTER_BYTES); pReader->status.pLDataIterArray = taosArrayInit(4, POINTER_BYTES);
if (pReader->status.pLDataIterArray == NULL) { if (pReader->status.pLDataIterArray == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
// check file the time range of coverage // check file the time range of coverage
@ -556,7 +556,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, void
pReader->idStr = (idstr != NULL) ? taosStrdup(idstr) : NULL; pReader->idStr = (idstr != NULL) ? taosStrdup(idstr) : NULL;
if (idstr != NULL && pReader->idStr == NULL) { if (idstr != NULL && pReader->idStr == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _end; goto _end;
} }
@ -2918,7 +2918,7 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, int32_t orde
} else { } else {
void* p1 = taosArrayAddAll(pSource, pBlockScanInfo->pMemDelData); void* p1 = taosArrayAddAll(pSource, pBlockScanInfo->pMemDelData);
if (p1 == NULL) { if (p1 == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
} }

View File

@ -1461,7 +1461,7 @@ int32_t catalogGetAllMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SCatalo
pRsp->pTableMeta = taosArrayInit(tbNum, POINTER_BYTES); pRsp->pTableMeta = taosArrayInit(tbNum, POINTER_BYTES);
if (NULL == pRsp->pTableMeta) { if (NULL == pRsp->pTableMeta) {
ctgError("taosArrayInit %d failed", tbNum); ctgError("taosArrayInit %d failed", tbNum);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
for (int32_t i = 0; i < tbNum; ++i) { for (int32_t i = 0; i < tbNum; ++i) {
@ -1476,7 +1476,7 @@ int32_t catalogGetAllMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SCatalo
if (NULL == taosArrayPush(pRsp->pTableMeta, &pTableMeta)) { if (NULL == taosArrayPush(pRsp->pTableMeta, &pTableMeta)) {
ctgError("taosArrayPush failed, idx:%d", i); ctgError("taosArrayPush failed, idx:%d", i);
taosMemoryFreeClear(pTableMeta); taosMemoryFreeClear(pTableMeta);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
} }
} }

View File

@ -236,7 +236,7 @@ static SSDataBlock* doLoadRemoteDataImpl(SOperatorInfo* pOperator) {
taosArrayRemove(pExchangeInfo->pResultBlockList, 0); taosArrayRemove(pExchangeInfo->pResultBlockList, 0);
void* tmp = taosArrayPush(pExchangeInfo->pRecycledBlocks, &p); void* tmp = taosArrayPush(pExchangeInfo->pRecycledBlocks, &p);
if (!tmp) { if (!tmp) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code)); qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
pTaskInfo->code = code; pTaskInfo->code = code;
T_LONG_JMP(pTaskInfo->env, code); T_LONG_JMP(pTaskInfo->env, code);
@ -590,7 +590,7 @@ int32_t buildTableScanOperatorParam(SOperatorParam** ppRes, SArray* pUidList, in
if (NULL == pScan->pUidList) { if (NULL == pScan->pUidList) {
taosMemoryFree(pScan); taosMemoryFree(pScan);
taosMemoryFreeClear(*ppRes); taosMemoryFreeClear(*ppRes);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pScan->tableSeq = tableSeq; pScan->tableSeq = tableSeq;

View File

@ -73,7 +73,7 @@ int32_t doCreateTask(uint64_t queryId, uint64_t taskId, int32_t vgId, EOPTR_EXEC
p->schemaInfos = taosArrayInit(1, sizeof(SSchemaInfo)); p->schemaInfos = taosArrayInit(1, sizeof(SSchemaInfo));
if (p->id.str == NULL || p->schemaInfos == NULL) { if (p->id.str == NULL || p->schemaInfos == NULL) {
doDestroyTask(p); doDestroyTask(p);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
*pTaskInfo = p; *pTaskInfo = p;

View File

@ -46,7 +46,7 @@ int32_t qCloneCurrentTbData(STableDataCxt* pDataBlock, SSubmitTbData** pData) {
} }
pNew->aCol = taosArrayDup(pDataBlock->pData->aCol, NULL); pNew->aCol = taosArrayDup(pDataBlock->pData->aCol, NULL);
if (!pNew->aCol) { if (!pNew->aCol) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
taosMemoryFreeClear(*pData); taosMemoryFreeClear(*pData);
return code; return code;
} }
@ -951,7 +951,7 @@ int32_t qResetStmtColumns(SArray* pCols, bool deepClear) {
SColData* pCol = (SColData*)taosArrayGet(pCols, i); SColData* pCol = (SColData*)taosArrayGet(pCols, i);
if (pCol == NULL) { if (pCol == NULL) {
qError("qResetStmtColumns column is NULL"); qError("qResetStmtColumns column is NULL");
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
if (deepClear) { if (deepClear) {
tColDataDeepClear(pCol); tColDataDeepClear(pCol);
@ -971,7 +971,7 @@ int32_t qResetStmtDataBlock(STableDataCxt* block, bool deepClear) {
SColData* pCol = (SColData*)taosArrayGet(pBlock->pData->aCol, i); SColData* pCol = (SColData*)taosArrayGet(pBlock->pData->aCol, i);
if (pCol == NULL) { if (pCol == NULL) {
qError("qResetStmtDataBlock column is NULL"); qError("qResetStmtDataBlock column is NULL");
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
if (deepClear) { if (deepClear) {
tColDataDeepClear(pCol); tColDataDeepClear(pCol);
@ -1033,7 +1033,7 @@ int32_t qCloneStmtDataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, bool rese
pNewTb->aCol = taosArrayDup(pCxt->pData->aCol, NULL); pNewTb->aCol = taosArrayDup(pCxt->pData->aCol, NULL);
if (NULL == pNewTb->aCol) { if (NULL == pNewTb->aCol) {
insDestroyTableDataCxt(*pDst); insDestroyTableDataCxt(*pDst);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pNewCxt->pData = pNewTb; pNewCxt->pData = pNewTb;

View File

@ -856,7 +856,7 @@ int32_t insBuildVgDataBlocks(SHashObj* pVgroupsHashObj, SArray* pVgDataCxtList,
code = buildSubmitReq(src->vgId, src->pData, &dst->pData, &dst->size); code = buildSubmitReq(src->vgId, src->pData, &dst->pData, &dst->size);
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = (NULL == taosArrayPush(pDataBlocks, &dst) ? TSDB_CODE_OUT_OF_MEMORY : TSDB_CODE_SUCCESS); code = (NULL == taosArrayPush(pDataBlocks, &dst) ? terrno : TSDB_CODE_SUCCESS);
} }
} }

View File

@ -522,7 +522,7 @@ static int32_t rewriteDropTableWithMetaCache(STranslateContext* pCxt) {
if (!pMetaCache->pTableMeta && if (!pMetaCache->pTableMeta &&
!(pMetaCache->pTableMeta = !(pMetaCache->pTableMeta =
taosHashInit(tbMetaExSize, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK))) { taosHashInit(tbMetaExSize, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK))) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
SMetaRes** ppMetaRes = NULL; SMetaRes** ppMetaRes = NULL;
@ -2087,7 +2087,7 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal,
pVal->datum.p = taosMemoryCalloc(1, size + VARSTR_HEADER_SIZE); pVal->datum.p = taosMemoryCalloc(1, size + VARSTR_HEADER_SIZE);
if (NULL == pVal->datum.p) { if (NULL == pVal->datum.p) {
if (isHexChar) taosMemoryFree(data); if (isHexChar) taosMemoryFree(data);
return generateDealNodeErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); return generateDealNodeErrMsg(pCxt, terrno);
} }
varDataSetLen(pVal->datum.p, size); varDataSetLen(pVal->datum.p, size);
memcpy(varDataVal(pVal->datum.p), data, size); memcpy(varDataVal(pVal->datum.p), data, size);
@ -2103,7 +2103,7 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal,
int32_t len = TMIN(targetDt.bytes - VARSTR_HEADER_SIZE, vlen); int32_t len = TMIN(targetDt.bytes - VARSTR_HEADER_SIZE, vlen);
pVal->datum.p = taosMemoryCalloc(1, len + VARSTR_HEADER_SIZE + 1); pVal->datum.p = taosMemoryCalloc(1, len + VARSTR_HEADER_SIZE + 1);
if (NULL == pVal->datum.p) { if (NULL == pVal->datum.p) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); return generateDealNodeErrMsg(pCxt, terrno);
} }
varDataSetLen(pVal->datum.p, len); varDataSetLen(pVal->datum.p, len);
strncpy(varDataVal(pVal->datum.p), pVal->literal, len); strncpy(varDataVal(pVal->datum.p), pVal->literal, len);
@ -2119,7 +2119,7 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal,
case TSDB_DATA_TYPE_NCHAR: { case TSDB_DATA_TYPE_NCHAR: {
pVal->datum.p = taosMemoryCalloc(1, targetDt.bytes + 1); pVal->datum.p = taosMemoryCalloc(1, targetDt.bytes + 1);
if (NULL == pVal->datum.p) { if (NULL == pVal->datum.p) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); return generateDealNodeErrMsg(pCxt, terrno);
} }
int32_t len = 0; int32_t len = 0;
@ -6264,7 +6264,7 @@ static int32_t unionEqualCondTbnamesOfSameTable(SArray* aTableTbnames, SEqCondTb
SEqCondTbNameTableInfo* info = taosArrayGet(aTableTbnames, i); SEqCondTbNameTableInfo* info = taosArrayGet(aTableTbnames, i);
if (info->pRealTable == pInfo->pRealTable) { if (info->pRealTable == pInfo->pRealTable) {
if (NULL == taosArrayAddAll(info->aTbnames, pInfo->aTbnames)) { if (NULL == taosArrayAddAll(info->aTbnames, pInfo->aTbnames)) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
break; break;
} }
taosArrayDestroy(pInfo->aTbnames); taosArrayDestroy(pInfo->aTbnames);

View File

@ -1124,7 +1124,7 @@ int32_t getDbVgInfoFromCache(SParseMetaCache* pMetaCache, const char* pDbFName,
if (TSDB_CODE_SUCCESS == code && NULL != pVgList) { if (TSDB_CODE_SUCCESS == code && NULL != pVgList) {
*pVgInfo = taosArrayDup(pVgList, NULL); *pVgInfo = taosArrayDup(pVgList, NULL);
if (NULL == *pVgInfo) { if (NULL == *pVgInfo) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
} }
} }
return code; return code;
@ -1439,7 +1439,7 @@ int32_t getDnodeListFromCache(SParseMetaCache* pMetaCache, SArray** pDnodes) {
*pDnodes = taosArrayDup((SArray*)pRes->pRes, NULL); *pDnodes = taosArrayDup((SArray*)pRes->pRes, NULL);
if (NULL == *pDnodes) { if (NULL == *pDnodes) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }

View File

@ -2190,7 +2190,7 @@ int32_t valueDecode(void* value, int32_t vlen, int64_t* ttl, char** dest) {
// compatiable with previous data // compatiable with previous data
p = taosDecodeBinary(p, (void**)&pOutput, key.len); p = taosDecodeBinary(p, (void**)&pOutput, key.len);
if (p == NULL) { if (p == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _EXCEPT; goto _EXCEPT;
} }
@ -2205,7 +2205,7 @@ int32_t valueDecode(void* value, int32_t vlen, int64_t* ttl, char** dest) {
if (key.compress == 1) { if (key.compress == 1) {
p = taosDecodeBinary(p, (void**)&pCompressData, key.len); p = taosDecodeBinary(p, (void**)&pCompressData, key.len);
if (p == NULL) { if (p == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _EXCEPT; goto _EXCEPT;
} }
pOutput = taosMemoryCalloc(1, key.rawLen); pOutput = taosMemoryCalloc(1, key.rawLen);
@ -2224,7 +2224,7 @@ int32_t valueDecode(void* value, int32_t vlen, int64_t* ttl, char** dest) {
} else { } else {
p = taosDecodeBinary(p, (void**)&pOutput, key.len); p = taosDecodeBinary(p, (void**)&pOutput, key.len);
if (p == NULL) { if (p == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _EXCEPT; goto _EXCEPT;
} }
} }
@ -3464,7 +3464,7 @@ int32_t streamStateAddIfNotExist_rocksdb(SStreamState* pState, const SWinKey* ke
} }
*pVal = taosMemoryMalloc(size); *pVal = taosMemoryMalloc(size);
if (*pVal == NULL) { if (*pVal == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
memset(*pVal, 0, size); memset(*pVal, 0, size);
return 0; return 0;
@ -4154,7 +4154,7 @@ int32_t streamStateSessionAddIfNotExist_rocksdb(SStreamState* pState, SSessionKe
void* tmp = taosMemoryMalloc(valSize); void* tmp = taosMemoryMalloc(valSize);
if (tmp == NULL) { if (tmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
SStreamStateCur* pCur = streamStateSessionSeekKeyCurrentPrev_rocksdb(pState, key); SStreamStateCur* pCur = streamStateSessionSeekKeyCurrentPrev_rocksdb(pState, key);

View File

@ -62,7 +62,7 @@ int32_t createChkptTriggerBlock(SStreamTask* pTask, int32_t checkpointType, int6
if (pChkpoint->blocks == NULL) { if (pChkpoint->blocks == NULL) {
taosMemoryFree(pBlock); taosMemoryFree(pBlock);
taosFreeQitem(pChkpoint); taosFreeQitem(pChkpoint);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
void* p = taosArrayPush(pChkpoint->blocks, pBlock); void* p = taosArrayPush(pChkpoint->blocks, pBlock);
@ -70,7 +70,7 @@ int32_t createChkptTriggerBlock(SStreamTask* pTask, int32_t checkpointType, int6
taosArrayDestroy(pChkpoint->blocks); taosArrayDestroy(pChkpoint->blocks);
taosMemoryFree(pBlock); taosMemoryFree(pBlock);
taosFreeQitem(pChkpoint); taosFreeQitem(pChkpoint);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
*pRes = pChkpoint; *pRes = pChkpoint;
@ -740,7 +740,7 @@ int32_t uploadCheckpointData(SStreamTask* pTask, int64_t checkpointId, int64_t d
SArray* toDelFiles = taosArrayInit(4, POINTER_BYTES); SArray* toDelFiles = taosArrayInit(4, POINTER_BYTES);
if (toDelFiles == NULL) { if (toDelFiles == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
if ((code = taskDbGenChkpUploadData(pTask->pBackend, pMeta->bkdChkptMgt, checkpointId, type, &path, toDelFiles, if ((code = taskDbGenChkpUploadData(pTask->pBackend, pMeta->bkdChkptMgt, checkpointId, type, &path, toDelFiles,
@ -1077,7 +1077,7 @@ int32_t doSendRetrieveTriggerMsg(SStreamTask* pTask, SArray* pNotSendList) {
SRetrieveChkptTriggerReq* pReq = rpcMallocCont(sizeof(SRetrieveChkptTriggerReq)); SRetrieveChkptTriggerReq* pReq = rpcMallocCont(sizeof(SRetrieveChkptTriggerReq));
if (pReq == NULL) { if (pReq == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
stError("vgId:%d failed to create msg to retrieve trigger msg for task:%s exec, code:out of memory", vgId, pId); stError("vgId:%d failed to create msg to retrieve trigger msg for task:%s exec, code:out of memory", vgId, pId);
continue; continue;
} }

View File

@ -191,7 +191,7 @@ int32_t streamMergedSubmitNew(SStreamMergedSubmit** pSubmit) {
if ((*pSubmit)->submits == NULL) { if ((*pSubmit)->submits == NULL) {
taosFreeQitem(*pSubmit); taosFreeQitem(*pSubmit);
*pSubmit = NULL; *pSubmit = NULL;
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
(*pSubmit)->type = STREAM_INPUT__MERGED_SUBMIT; (*pSubmit)->type = STREAM_INPUT__MERGED_SUBMIT;

View File

@ -73,7 +73,7 @@ static int32_t tInitStreamDispatchReq(SStreamDispatchReq* pReq, const SStreamTas
if (pReq->data == NULL || pReq->dataLen == NULL) { if (pReq->data == NULL || pReq->dataLen == NULL) {
taosArrayDestroyP(pReq->data, taosMemoryFree); taosArrayDestroyP(pReq->data, taosMemoryFree);
taosArrayDestroy(pReq->dataLen); taosArrayDestroy(pReq->dataLen);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
@ -110,7 +110,7 @@ int32_t streamTaskBroadcastRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* r
buf = rpcMallocCont(sizeof(SMsgHead) + len); buf = rpcMallocCont(sizeof(SMsgHead) + len);
if (buf == NULL) { if (buf == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
((SMsgHead*)buf)->vgId = htonl(pEpInfo->nodeId); ((SMsgHead*)buf)->vgId = htonl(pEpInfo->nodeId);
@ -209,7 +209,7 @@ int32_t streamSendCheckMsg(SStreamTask* pTask, const SStreamTaskCheckReq* pReq,
buf = rpcMallocCont(sizeof(SMsgHead) + tlen); buf = rpcMallocCont(sizeof(SMsgHead) + tlen);
if (buf == NULL) { if (buf == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
((SMsgHead*)buf)->vgId = htonl(nodeId); ((SMsgHead*)buf)->vgId = htonl(nodeId);

View File

@ -295,7 +295,7 @@ int32_t tfsMkdirRecurAt(STfs *pTfs, const char *rname, SDiskID diskId) {
// https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dirname.3.html // https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dirname.3.html
if ((dir = taosStrdup(taosDirName(s))) == NULL) { if ((dir = taosStrdup(taosDirName(s))) == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); TAOS_CHECK_GOTO(terrno, &lino, _exit);
} }
if (strlen(dir) >= strlen(rname)) { // TODO: check if it is necessary for equal length if (strlen(dir) >= strlen(rname)) { // TODO: check if it is necessary for equal length

View File

@ -2324,8 +2324,8 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
pThrd->pool = createConnPool(4); pThrd->pool = createConnPool(4);
if (pThrd->pool == NULL) { if (pThrd->pool == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end); TAOS_CHECK_GOTO(terrno, NULL, _end);
} }
if ((code = transDQCreate(pThrd->loop, &pThrd->delayQueue)) != 0) { if ((code = transDQCreate(pThrd->loop, &pThrd->delayQueue)) != 0) {
TAOS_CHECK_GOTO(code, NULL, _end); TAOS_CHECK_GOTO(code, NULL, _end);
@ -2368,7 +2368,7 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
} }
(void)uv_timer_init(pThrd->loop, timer); (void)uv_timer_init(pThrd->loop, timer);
if (taosArrayPush(pThrd->timerList, &timer) == NULL) { if (taosArrayPush(pThrd->timerList, &timer) == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end); TAOS_CHECK_GOTO(terrno, NULL, _end);
} }
} }
pThrd->nextTimeout = taosGetTimestampMs() + CONN_PERSIST_TIME(pTransInst->idleTime); pThrd->nextTimeout = taosGetTimestampMs() + CONN_PERSIST_TIME(pTransInst->idleTime);

View File

@ -601,7 +601,7 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy
wError("vgId:%d, file:%" PRId64 ".log, failed to malloc since %s", pWal->cfg.vgId, walGetLastFileFirstVer(pWal), wError("vgId:%d, file:%" PRId64 ".log, failed to malloc since %s", pWal->cfg.vgId, walGetLastFileFirstVer(pWal),
strerror(errno)); strerror(errno));
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); TAOS_CHECK_GOTO(terrno, &lino, _exit);
} }
TAOS_UNUSED(memset(newBody, 0, cyptedBodyLen)); TAOS_UNUSED(memset(newBody, 0, cyptedBodyLen));
TAOS_UNUSED(memcpy(newBody, body, plainBodyLen)); TAOS_UNUSED(memcpy(newBody, body, plainBodyLen));
@ -613,7 +613,7 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy
if (newBody != NULL) taosMemoryFreeClear(newBody); if (newBody != NULL) taosMemoryFreeClear(newBody);
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); TAOS_CHECK_GOTO(terrno, &lino, _exit);
} }
SCryptOpts opts; SCryptOpts opts;

View File

@ -335,7 +335,7 @@ int32_t taosheapadjust(void *base, int32_t size, int32_t start, int32_t end, con
if (buf == NULL) { if (buf == NULL) {
tmp = taosMemoryMalloc(size); tmp = taosMemoryMalloc(size);
if (NULL == tmp) { if (NULL == tmp) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
} else { } else {
tmp = buf; tmp = buf;
@ -467,7 +467,7 @@ static int32_t taosMergeSortHelper(void *src, int64_t numOfElem, int64_t size, c
int32_t currSize; int32_t currSize;
void *tmp = taosMemoryMalloc(numOfElem * size); void *tmp = taosMemoryMalloc(numOfElem * size);
if (tmp == NULL) { if (tmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
for (currSize = THRESHOLD_SIZE; currSize <= numOfElem - 1; currSize = 2 * currSize) { for (currSize = THRESHOLD_SIZE; currSize <= numOfElem - 1; currSize = 2 * currSize) {

View File

@ -22,7 +22,7 @@ int32_t base64_encode(const uint8_t *value, int32_t vlen, char **result) {
uint8_t oval = 0; uint8_t oval = 0;
*result = (char *)taosMemoryMalloc((size_t)(vlen * 4) / 3 + 10); *result = (char *)taosMemoryMalloc((size_t)(vlen * 4) / 3 + 10);
if (*result == NULL) { if (*result == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
char *out = *result; char *out = *result;
while (vlen >= 3) { while (vlen >= 3) {
@ -58,7 +58,7 @@ int32_t base64_decode(const char *value, int32_t inlen, int32_t *outlen, uint8_t
int32_t c1, c2, c3, c4; int32_t c1, c2, c3, c4;
*result = (uint8_t *)taosMemoryMalloc((size_t)(inlen * 3) / 4 + 1); *result = (uint8_t *)taosMemoryMalloc((size_t)(inlen * 3) / 4 + 1);
if (*result == NULL) { if (*result == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
uint8_t *out = *result; uint8_t *out = *result;

View File

@ -78,7 +78,7 @@ int32_t tStartEncode(SEncoder* pCoder) {
pNode = tEncoderMalloc(pCoder, sizeof(*pNode)); pNode = tEncoderMalloc(pCoder, sizeof(*pNode));
if (pNode == NULL) { if (pNode == NULL) {
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); TAOS_RETURN(terrno);
} }
pNode->data = pCoder->data; pNode->data = pCoder->data;
@ -126,7 +126,7 @@ int32_t tStartDecode(SDecoder* pCoder) {
pNode = tDecoderMalloc(pCoder, sizeof(*pNode)); pNode = tDecoderMalloc(pCoder, sizeof(*pNode));
if (pNode == NULL) { if (pNode == NULL) {
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); TAOS_RETURN(terrno);
} }
pNode->data = pCoder->data; pNode->data = pCoder->data;

View File

@ -46,7 +46,7 @@ int32_t tScalableBfInit(uint64_t expectedEntries, double errorRate, SScalableBf*
pSBf->numBits = 0; pSBf->numBits = 0;
pSBf->bfArray = taosArrayInit(defaultSize, sizeof(void*)); pSBf->bfArray = taosArrayInit(defaultSize, sizeof(void*));
if (!pSBf->bfArray) { if (!pSBf->bfArray) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _error); QUERY_CHECK_CODE(code, lino, _error);
} }
@ -76,7 +76,7 @@ int32_t tScalableBfPutNoCheck(SScalableBf* pSBf, const void* keyBuf, uint32_t le
int32_t size = taosArrayGetSize(pSBf->bfArray); int32_t size = taosArrayGetSize(pSBf->bfArray);
SBloomFilter* pNormalBf = taosArrayGetP(pSBf->bfArray, size - 1); SBloomFilter* pNormalBf = taosArrayGetP(pSBf->bfArray, size - 1);
if (!pNormalBf) { if (!pNormalBf) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _error); QUERY_CHECK_CODE(code, lino, _error);
} }
if (tBloomFilterIsFull(pNormalBf)) { if (tBloomFilterIsFull(pNormalBf)) {
@ -236,7 +236,7 @@ int32_t tScalableBfDecode(SDecoder* pDecoder, SScalableBf** ppSBf) {
} }
pSBf->bfArray = taosArrayInit(size * 2, POINTER_BYTES); pSBf->bfArray = taosArrayInit(size * 2, POINTER_BYTES);
if (!pSBf->bfArray) { if (!pSBf->bfArray) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _error); QUERY_CHECK_CODE(code, lino, _error);
} }
@ -246,7 +246,7 @@ int32_t tScalableBfDecode(SDecoder* pDecoder, SScalableBf** ppSBf) {
QUERY_CHECK_CODE(code, lino, _error); QUERY_CHECK_CODE(code, lino, _error);
void* tmpRes = taosArrayPush(pSBf->bfArray, &pBF); void* tmpRes = taosArrayPush(pSBf->bfArray, &pBF);
if (!tmpRes) { if (!tmpRes) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _error); QUERY_CHECK_CODE(code, lino, _error);
} }
} }

View File

@ -178,7 +178,7 @@ int32_t tAutoQWorkerInit(SAutoQWorkerPool *pool) {
pool->workers = taosArrayInit(2, sizeof(SQueueWorker *)); pool->workers = taosArrayInit(2, sizeof(SQueueWorker *));
if (pool->workers == NULL) { if (pool->workers == NULL) {
taosCloseQset(pool->qset); taosCloseQset(pool->qset);
return terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
(void)taosThreadMutexInit(&pool->mutex, NULL); (void)taosThreadMutexInit(&pool->mutex, NULL);