enh:modify error code passing
This commit is contained in:
parent
288e9adebb
commit
3db73b7244
|
@ -547,7 +547,7 @@ int32_t streamTaskGetNumOfUpstream(const SStreamTask* pTask) { return taosArrayG
|
|||
int32_t streamTaskSetUpstreamInfo(SStreamTask* pTask, const SStreamTask* pUpstreamTask) {
|
||||
SStreamUpstreamEpInfo* pEpInfo = createStreamTaskEpInfo(pUpstreamTask);
|
||||
if (pEpInfo == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (pTask->upstreamInfo.pList == NULL) {
|
||||
|
|
|
@ -154,7 +154,7 @@ static int32_t taosCompressHttpRport(char* pSrc, int32_t srcLen) {
|
|||
void* pDest = taosMemoryMalloc(destLen);
|
||||
|
||||
if (pDest == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ static int32_t httpCreateMsg(const char* server, const char* uri, uint16_t port,
|
|||
SHttpMsg* msg = taosMemoryMalloc(sizeof(SHttpMsg));
|
||||
if (msg == NULL) {
|
||||
*httpMsg = NULL;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
msg->seq = seqNum;
|
||||
|
@ -273,7 +273,7 @@ static int32_t httpCreateMsg(const char* server, const char* uri, uint16_t port,
|
|||
if (msg->server == NULL || msg->uri == NULL || msg->cont == NULL) {
|
||||
httpDestroyMsg(msg);
|
||||
*httpMsg = NULL;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
memcpy(msg->cont, pCont, contLen);
|
||||
|
@ -585,7 +585,7 @@ static void httpHandleReq(SHttpMsg* msg) {
|
|||
int32_t cap = 2048;
|
||||
header = taosMemoryCalloc(1, cap);
|
||||
if (header == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
|
||||
|
@ -597,7 +597,7 @@ static void httpHandleReq(SHttpMsg* msg) {
|
|||
|
||||
uv_buf_t* wb = taosMemoryCalloc(2, sizeof(uv_buf_t));
|
||||
if (wb == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
|
||||
|
@ -607,7 +607,7 @@ static void httpHandleReq(SHttpMsg* msg) {
|
|||
SHttpClient* cli = taosMemoryCalloc(1, sizeof(SHttpClient));
|
||||
if (cli == NULL) {
|
||||
taosMemoryFree(wb);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
cli->seq = msg->seq;
|
||||
|
@ -784,13 +784,13 @@ int64_t transInitHttpChanImpl() {
|
|||
|
||||
http->connStatusTable = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||
if (http->connStatusTable == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _ERROR;
|
||||
}
|
||||
|
||||
http->loop = taosMemoryMalloc(sizeof(uv_loop_t));
|
||||
if (http->loop == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ void* rpcOpen(const SRpcInit* pInit) {
|
|||
|
||||
SRpcInfo* pRpc = taosMemoryCalloc(1, sizeof(SRpcInfo));
|
||||
if (pRpc == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _end);
|
||||
}
|
||||
if (pInit->label) {
|
||||
int len = strlen(pInit->label) > sizeof(pRpc->label) ? sizeof(pRpc->label) : strlen(pInit->label);
|
||||
|
|
|
@ -984,7 +984,7 @@ static int32_t cliCreateConn(SCliThrd* pThrd, SCliConn** pCliConn) {
|
|||
// read/write stream handle
|
||||
conn->stream = (uv_stream_t*)taosMemoryMalloc(sizeof(uv_tcp_t));
|
||||
if (conn->stream == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_CHECK_GOTO(code, NULL, _failed);
|
||||
}
|
||||
|
||||
|
@ -1167,7 +1167,7 @@ void cliSendBatch(SCliConn* pConn) {
|
|||
|
||||
uv_buf_t* wb = taosMemoryCalloc(wLen, sizeof(uv_buf_t));
|
||||
if (wb == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
tError("%s conn %p failed to send batch msg since:%s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(code));
|
||||
goto _exception;
|
||||
}
|
||||
|
@ -1221,7 +1221,7 @@ void cliSendBatch(SCliConn* pConn) {
|
|||
|
||||
uv_write_t* req = taosMemoryCalloc(1, sizeof(uv_write_t));
|
||||
if (req == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
tError("%s conn %p failed to send batch msg since:%s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(code));
|
||||
goto _exception;
|
||||
}
|
||||
|
@ -1971,7 +1971,7 @@ static int32_t createBatchList(SCliBatchList** ppBatchList, char* key, char* ip,
|
|||
taosMemoryFree(pBatchList->dst);
|
||||
taosMemoryFree(pBatchList);
|
||||
tError("failed to create batch list, reason:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
*ppBatchList = pBatchList;
|
||||
return 0;
|
||||
|
@ -2205,7 +2205,7 @@ void* transInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads,
|
|||
int32_t code = 0;
|
||||
SCliObj* cli = taosMemoryCalloc(1, sizeof(SCliObj));
|
||||
if (cli == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _err);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _err);
|
||||
}
|
||||
|
||||
STrans* pTransInst = shandle;
|
||||
|
@ -2214,7 +2214,7 @@ void* transInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads,
|
|||
|
||||
cli->pThreadObj = (SCliThrd**)taosMemoryCalloc(cli->numOfThreads, sizeof(SCliThrd*));
|
||||
if (cli->pThreadObj == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _err);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _err);
|
||||
}
|
||||
|
||||
for (int i = 0; i < cli->numOfThreads; i++) {
|
||||
|
@ -2342,29 +2342,29 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
|
|||
pThrd->destroyAhandleFp = pTransInst->destroyFp;
|
||||
pThrd->fqdn2ipCache = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
if (pThrd->fqdn2ipCache == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _end);
|
||||
}
|
||||
pThrd->failFastCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
if (pThrd->failFastCache == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _end);
|
||||
}
|
||||
|
||||
pThrd->batchCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
if (pThrd->batchCache == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _end);
|
||||
}
|
||||
|
||||
int32_t timerSize = 64;
|
||||
pThrd->timerList = taosArrayInit(timerSize, sizeof(void*));
|
||||
if (pThrd->timerList == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
|
||||
code = terrno;
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _end);
|
||||
}
|
||||
|
||||
for (int i = 0; i < timerSize; i++) {
|
||||
uv_timer_t* timer = taosMemoryCalloc(1, sizeof(uv_timer_t));
|
||||
if (timer == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _end);
|
||||
}
|
||||
(void)uv_timer_init(pThrd->loop, timer);
|
||||
if (taosArrayPush(pThrd->timerList, &timer) == NULL) {
|
||||
|
|
|
@ -128,7 +128,7 @@ int32_t transClearBuffer(SConnBuffer* buf) {
|
|||
p->cap = BUFFER_CAP;
|
||||
p->buf = taosMemoryRealloc(p->buf, BUFFER_CAP);
|
||||
if (p->buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
p->left = -1;
|
||||
|
@ -179,7 +179,7 @@ int32_t transResetBuffer(SConnBuffer* connBuf, int8_t resetBuf) {
|
|||
p->cap = BUFFER_CAP;
|
||||
p->buf = taosMemoryRealloc(p->buf, p->cap);
|
||||
if (p->buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ int32_t transAllocBuffer(SConnBuffer* connBuf, uv_buf_t* uvBuf) {
|
|||
if (p->buf == NULL) {
|
||||
uvBuf->base = NULL;
|
||||
uvBuf->len = 0;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
uvBuf->base = p->buf + p->len;
|
||||
uvBuf->len = p->left;
|
||||
|
@ -443,7 +443,7 @@ void transReqQueueClear(queue* q) {
|
|||
int32_t transQueueInit(STransQueue* queue, void (*freeFunc)(const void* arg)) {
|
||||
queue->q = taosArrayInit(2, sizeof(void*));
|
||||
if (queue->q == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
queue->freeFunc = (void (*)(const void*))freeFunc;
|
||||
|
||||
|
@ -565,12 +565,12 @@ int32_t transDQCreate(uv_loop_t* loop, SDelayQueue** queue) {
|
|||
|
||||
heap = heapCreate(timeCompare);
|
||||
if (heap == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _return1);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _return1);
|
||||
}
|
||||
|
||||
q = taosMemoryCalloc(1, sizeof(SDelayQueue));
|
||||
if (q == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _return1);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _return1);
|
||||
}
|
||||
q->heap = heap;
|
||||
q->timer = timer;
|
||||
|
|
|
@ -636,7 +636,7 @@ static int uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
|
|||
if (pMsg->pCont == 0) {
|
||||
pMsg->pCont = (void*)rpcMallocCont(0);
|
||||
if (pMsg->pCont == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pMsg->contLen = 0;
|
||||
|
@ -1027,7 +1027,7 @@ static int32_t addHandleToWorkloop(SWorkThrd* pThrd, char* pipeName) {
|
|||
int32_t code = 0;
|
||||
pThrd->loop = (uv_loop_t*)taosMemoryMalloc(sizeof(uv_loop_t));
|
||||
if (pThrd->loop == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if ((code = uv_loop_init(pThrd->loop)) != 0) {
|
||||
|
@ -1135,7 +1135,7 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) {
|
|||
|
||||
SSvrConn* pConn = (SSvrConn*)taosMemoryCalloc(1, sizeof(SSvrConn));
|
||||
if (pConn == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _end);
|
||||
}
|
||||
|
||||
transReqQueueInit(&pConn->wreqQueue);
|
||||
|
@ -1156,7 +1156,7 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) {
|
|||
|
||||
SExHandle* exh = taosMemoryMalloc(sizeof(SExHandle));
|
||||
if (exh == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _end);
|
||||
}
|
||||
|
||||
exh->handle = pConn;
|
||||
|
@ -1187,7 +1187,7 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) {
|
|||
// init client handle
|
||||
pConn->pTcp = (uv_tcp_t*)taosMemoryMalloc(sizeof(uv_tcp_t));
|
||||
if (pConn->pTcp == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _end);
|
||||
}
|
||||
|
||||
code = uv_tcp_init(pThrd->loop, pConn->pTcp);
|
||||
|
@ -1236,7 +1236,7 @@ static int32_t reallocConnRef(SSvrConn* conn) {
|
|||
// avoid app continue to send msg on invalid handle
|
||||
SExHandle* exh = taosMemoryMalloc(sizeof(SExHandle));
|
||||
if (exh == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
exh->handle = conn;
|
||||
|
@ -1335,7 +1335,7 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
|
|||
|
||||
SServerObj* srv = taosMemoryCalloc(1, sizeof(SServerObj));
|
||||
if (srv == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
tError("failed to init server since: %s", tstrerror(code));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1349,7 +1349,7 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
|
|||
srv->pThreadObj = (SWorkThrd**)taosMemoryCalloc(srv->numOfThreads, sizeof(SWorkThrd*));
|
||||
srv->pipe = (uv_pipe_t**)taosMemoryCalloc(srv->numOfThreads, sizeof(uv_pipe_t*));
|
||||
if (srv->loop == NULL || srv->pThreadObj == NULL || srv->pipe == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto End;
|
||||
}
|
||||
|
||||
|
@ -1400,14 +1400,14 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
|
|||
thrd->pWhiteList = uvWhiteListCreate();
|
||||
if (thrd->pWhiteList == NULL) {
|
||||
destroyWorkThrdObj(thrd);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto End;
|
||||
}
|
||||
|
||||
srv->pipe[i] = (uv_pipe_t*)taosMemoryCalloc(2, sizeof(uv_pipe_t));
|
||||
if (srv->pipe[i] == NULL) {
|
||||
destroyWorkThrdObj(thrd);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto End;
|
||||
}
|
||||
|
||||
|
@ -1433,7 +1433,7 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
|
|||
for (int i = 0; i < srv->numOfThreads; i++) {
|
||||
SWorkThrd* thrd = (SWorkThrd*)taosMemoryCalloc(1, sizeof(SWorkThrd));
|
||||
if (thrd == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto End;
|
||||
}
|
||||
srv->pThreadObj[i] = thrd;
|
||||
|
@ -1444,13 +1444,13 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
|
|||
thrd->pWhiteList = uvWhiteListCreate();
|
||||
if (thrd->pWhiteList == NULL) {
|
||||
destroyWorkThrdObj(thrd);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto End;
|
||||
}
|
||||
|
||||
srv->pipe[i] = (uv_pipe_t*)taosMemoryCalloc(2, sizeof(uv_pipe_t));
|
||||
if (srv->pipe[i] == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto End;
|
||||
}
|
||||
|
||||
|
@ -1599,7 +1599,7 @@ void uvHandleUpdate(SSvrMsg* msg, SWorkThrd* thrd) {
|
|||
SIpWhiteList* pList = taosMemoryCalloc(1, sz + sizeof(SIpWhiteList));
|
||||
if (pList == NULL) {
|
||||
tError("failed to create ip-white-list since %s", tstrerror(code));
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
pList->num = pUser->numOfRange;
|
||||
|
|
|
@ -99,7 +99,7 @@ static FORCE_INLINE int32_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx, in
|
|||
|
||||
ptr = taosMemoryRealloc(buf, capacity);
|
||||
if (ptr == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _err);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _err);
|
||||
}
|
||||
buf = ptr;
|
||||
|
||||
|
@ -163,7 +163,7 @@ static FORCE_INLINE int32_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx, in
|
|||
capacity += extraSize;
|
||||
void* ptr = taosMemoryRealloc(buf, capacity);
|
||||
if (ptr == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _err);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _err);
|
||||
}
|
||||
buf = ptr;
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ static int32_t walRebuildFileInfoSet(SArray* metaLogList, SArray* actualLogList)
|
|||
for (int i = 0; i < actualFileNum; i++) {
|
||||
SWalFileInfo* pFileInfo = taosArrayGet(actualLogList, i);
|
||||
if (NULL == taosArrayPush(metaLogList, pFileInfo)) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -728,7 +728,7 @@ int32_t walRollFileInfo(SWal* pWal) {
|
|||
// TODO: change to emplace back
|
||||
SWalFileInfo* pNewInfo = taosMemoryMalloc(sizeof(SWalFileInfo));
|
||||
if (pNewInfo == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
pNewInfo->firstVer = pWal->vers.lastVer + 1;
|
||||
pNewInfo->lastVer = -1;
|
||||
|
@ -738,7 +738,7 @@ int32_t walRollFileInfo(SWal* pWal) {
|
|||
pNewInfo->syncedOffset = 0;
|
||||
if (!taosArrayPush(pArray, pNewInfo)) {
|
||||
taosMemoryFree(pNewInfo);
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
taosMemoryFree(pNewInfo);
|
||||
|
@ -1015,7 +1015,7 @@ int32_t walLoadMeta(SWal* pWal) {
|
|||
int size = (int)fileSize;
|
||||
char* buf = taosMemoryMalloc(size + 5);
|
||||
if (buf == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
(void)memset(buf, 0, size + 5);
|
||||
TdFilePtr pFile = taosOpenFile(fnameStr, TD_FILE_READ);
|
||||
|
|
|
@ -212,7 +212,7 @@ static int32_t walReadSeekVerImpl(SWalReader *pReader, int64_t ver) {
|
|||
if (pRet == NULL) {
|
||||
wError("failed to allocate memory for localRet");
|
||||
TAOS_UNUSED(taosThreadRwlockUnlock(&pWal->mutex));
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
TAOS_MEMCPY(pRet, gloablPRet, sizeof(SWalFileInfo));
|
||||
TAOS_UNUSED(taosThreadRwlockUnlock(&pWal->mutex));
|
||||
|
@ -341,7 +341,7 @@ int32_t walFetchBody(SWalReader *pRead) {
|
|||
if (pRead->capacity < cryptedBodyLen) {
|
||||
SWalCkHead *ptr = (SWalCkHead *)taosMemoryRealloc(pRead->pHead, sizeof(SWalCkHead) + cryptedBodyLen);
|
||||
if (ptr == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
pRead->pHead = ptr;
|
||||
pReadHead = &pRead->pHead->head;
|
||||
|
@ -463,7 +463,7 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) {
|
|||
if (ptr == NULL) {
|
||||
TAOS_UNUSED(taosThreadMutexUnlock(&pReader->mutex));
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
pReader->pHead = ptr;
|
||||
pReader->capacity = cryptedBodyLen;
|
||||
|
@ -523,7 +523,7 @@ int32_t decryptBody(SWalCfg *cfg, SWalCkHead *pHead, int32_t plainBodyLen, const
|
|||
int32_t cryptedBodyLen = ENCRYPTED_LEN(plainBodyLen);
|
||||
char *newBody = taosMemoryMalloc(cryptedBodyLen);
|
||||
if (!newBody) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
SCryptOpts opts;
|
||||
|
|
|
@ -51,7 +51,7 @@ int32_t cfgInit(SConfig **ppCfg) {
|
|||
pCfg->array = taosArrayInit(32, sizeof(SConfigItem));
|
||||
if (pCfg->array == NULL) {
|
||||
taosMemoryFree(pCfg);
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
TAOS_CHECK_RETURN(taosThreadMutexInit(&pCfg->lock, NULL));
|
||||
|
@ -127,7 +127,7 @@ static int32_t cfgCheckAndSetConf(SConfigItem *pItem, const char *conf) {
|
|||
|
||||
pItem->str = taosStrdup(conf);
|
||||
if (pItem->str == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||
|
@ -144,7 +144,7 @@ static int32_t cfgCheckAndSetDir(SConfigItem *pItem, const char *inputDir) {
|
|||
taosMemoryFreeClear(pItem->str);
|
||||
pItem->str = taosStrdup(fullDir);
|
||||
if (pItem->str == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||
|
@ -211,7 +211,7 @@ static int32_t cfgSetString(SConfigItem *pItem, const char *value, ECfgSrcType s
|
|||
if (tmp == NULL) {
|
||||
uError("cfg:%s, type:%s src:%s value:%s failed to dup since %s", pItem->name, cfgDtypeStr(pItem->dtype),
|
||||
cfgStypeStr(stype), value, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
taosMemoryFreeClear(pItem->str);
|
||||
|
@ -272,7 +272,7 @@ static int32_t cfgSetTfsItem(SConfig *pCfg, const char *name, const char *value,
|
|||
if (pItem->array == NULL) {
|
||||
(void)taosThreadMutexUnlock(&pCfg->lock);
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ static int32_t cfgSetTfsItem(SConfig *pCfg, const char *name, const char *value,
|
|||
if (ret == NULL) {
|
||||
(void)taosThreadMutexUnlock(&pCfg->lock);
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
pItem->stype = stype;
|
||||
|
@ -304,7 +304,7 @@ static int32_t cfgUpdateDebugFlagItem(SConfig *pCfg, const char *name, bool rese
|
|||
if (pDebugFlagItem->array == NULL) {
|
||||
pDebugFlagItem->array = taosArrayInit(16, sizeof(SLogVar));
|
||||
if (pDebugFlagItem->array == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
}
|
||||
taosArrayClear(pDebugFlagItem->array);
|
||||
|
@ -317,7 +317,7 @@ static int32_t cfgUpdateDebugFlagItem(SConfig *pCfg, const char *name, bool rese
|
|||
SLogVar logVar = {0};
|
||||
(void)strncpy(logVar.name, name, TSDB_LOG_VAR_LEN - 1);
|
||||
if (NULL == taosArrayPush(pDebugFlagItem->array, &logVar)) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
}
|
||||
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||
|
@ -505,7 +505,7 @@ static int32_t cfgAddItem(SConfig *pCfg, SConfigItem *pItem, const char *name) {
|
|||
pItem->stype = CFG_STYPE_DEFAULT;
|
||||
pItem->name = taosStrdup(name);
|
||||
if (pItem->name == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
int32_t size = taosArrayGetSize(pCfg->array);
|
||||
|
@ -527,7 +527,7 @@ static int32_t cfgAddItem(SConfig *pCfg, SConfigItem *pItem, const char *name) {
|
|||
}
|
||||
|
||||
taosMemoryFree(pItem->name);
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||
|
@ -587,7 +587,7 @@ int32_t cfgAddString(SConfig *pCfg, const char *name, const char *defaultVal, in
|
|||
SConfigItem item = {.dtype = CFG_DTYPE_STRING, .scope = scope, .dynScope = dynScope};
|
||||
item.str = taosStrdup(defaultVal);
|
||||
if (item.str == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
return cfgAddItem(pCfg, &item, name);
|
||||
}
|
||||
|
@ -1309,7 +1309,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) {
|
|||
size_t itemValueStringLen = strlen(itemValueString);
|
||||
void *px = taosMemoryRealloc(cfgLineBuf, itemNameLen + itemValueStringLen + 3);
|
||||
if (NULL == px) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
|
||||
cfgLineBuf = px;
|
||||
|
|
|
@ -352,7 +352,7 @@ int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, const vo
|
|||
// no data in hash table with the specified key, add it into hash table
|
||||
SHashNode *pNewNode = doCreateHashNode(key, keyLen, data, size, hashVal);
|
||||
if (pNewNode == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
// terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, const vo
|
|||
if (pHashObj->enableUpdate) {
|
||||
SHashNode *pNewNode = doCreateHashNode(key, keyLen, data, size, hashVal);
|
||||
if (pNewNode == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
// terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ int32_t tjsonAddArray(SJson* pJson, const char* pName, FToJson func, const void*
|
|||
if (num > 0) {
|
||||
SJson* pJsonArray = tjsonAddArrayToObject(pJson, pName);
|
||||
if (NULL == pJsonArray) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
for (size_t i = 0; i < num; ++i) {
|
||||
int32_t code = tjsonAddItem(pJsonArray, func, (const char*)pArray + itemSize * i);
|
||||
|
@ -148,7 +148,7 @@ int32_t tjsonAddTArray(SJson* pJson, const char* pName, FToJson func, const SArr
|
|||
if (num > 0) {
|
||||
SJson* pJsonArray = tjsonAddArrayToObject(pJson, pName);
|
||||
if (NULL == pJsonArray) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
for (int32_t i = 0; i < num; ++i) {
|
||||
int32_t code = tjsonAddItem(pJsonArray, func, taosArrayGet(pArray, i));
|
||||
|
@ -343,7 +343,7 @@ int32_t tjsonToTArray(const SJson* pJson, const char* pName, FToObject func, SAr
|
|||
if (size > 0) {
|
||||
*pArray = taosArrayInit_s(itemSize, size);
|
||||
if (NULL == *pArray) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
for (int32_t i = 0; i < size; ++i) {
|
||||
int32_t code = func(tjsonGetArrayItem(jArray, i), taosArrayGet(*pArray, i));
|
||||
|
|
|
@ -57,7 +57,7 @@ static int32_t createDiskFile(SDiskbasedBuf* pBuf) {
|
|||
taosGetTmpfilePath(pBuf->prefix, "paged-buf", path);
|
||||
pBuf->path = taosStrdup(path);
|
||||
if (pBuf->path == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -803,11 +803,11 @@ int32_t tQueryAutoQWorkerInit(SQueryAutoQWorkerPool *pool) {
|
|||
code = taosOpenQset(&pool->qset);
|
||||
if (code) return terrno = code;
|
||||
pool->workers = tdListNew(sizeof(SQueryAutoQWorker));
|
||||
if (!pool->workers) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!pool->workers) return terrno;
|
||||
pool->backupWorkers = tdListNew(sizeof(SQueryAutoQWorker));
|
||||
if (!pool->backupWorkers) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!pool->backupWorkers) return terrno;
|
||||
pool->exitedWorkers = tdListNew(sizeof(SQueryAutoQWorker));
|
||||
if (!pool->exitedWorkers) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!pool->exitedWorkers) return terrno;
|
||||
pool->maxInUse = pool->max * 2 + 2;
|
||||
|
||||
if (!pool->pCb) {
|
||||
|
|
Loading…
Reference in New Issue