Merge pull request #27809 from taosdata/enh/TD-31691
enh:modify error code passing
This commit is contained in:
commit
19de8651b6
|
@ -1279,7 +1279,7 @@ int32_t syncLogBufferCreate(SSyncLogBuffer** ppBuf) {
|
|||
int32_t code = 0;
|
||||
SSyncLogBuffer* pBuf = taosMemoryCalloc(1, sizeof(SSyncLogBuffer));
|
||||
if (pBuf == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _exit);
|
||||
}
|
||||
|
||||
pBuf->size = sizeof(pBuf->entries) / sizeof(pBuf->entries[0]);
|
||||
|
|
|
@ -25,7 +25,7 @@ int32_t syncRespMgrCreate(void *data, int64_t ttl, SSyncRespMgr **ppObj) {
|
|||
*ppObj = NULL;
|
||||
|
||||
if ((pObj = taosMemoryCalloc(1, sizeof(SSyncRespMgr))) == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
pObj->pRespHash =
|
||||
|
|
|
@ -54,7 +54,7 @@ static int32_t syncSnapBufferCreate(SSyncSnapBuffer **ppBuf) {
|
|||
SSyncSnapBuffer *pBuf = taosMemoryCalloc(1, sizeof(SSyncSnapBuffer));
|
||||
if (pBuf == NULL) {
|
||||
*ppBuf = NULL;
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
pBuf->size = sizeof(pBuf->entries) / sizeof(void *);
|
||||
if (pBuf->size != TSDB_SYNC_SNAP_BUFFER_SIZE) return TSDB_CODE_SYN_INTERNAL_ERROR;
|
||||
|
@ -74,7 +74,7 @@ int32_t snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaIndex, SSyncSn
|
|||
|
||||
SSyncSnapshotSender *pSender = taosMemoryCalloc(1, sizeof(SSyncSnapshotSender));
|
||||
if (pSender == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
pSender->start = false;
|
||||
|
@ -285,7 +285,7 @@ static int32_t snapshotSend(SSyncSnapshotSender *pSender) {
|
|||
if (pSender->seq > SYNC_SNAPSHOT_SEQ_BEGIN) {
|
||||
pBlk = taosMemoryCalloc(1, sizeof(SyncSnapBlock));
|
||||
if (pBlk == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OUT;
|
||||
}
|
||||
|
||||
|
@ -422,7 +422,7 @@ int32_t snapshotReceiverCreate(SSyncNode *pSyncNode, SRaftId fromId, SSyncSnapsh
|
|||
|
||||
SSyncSnapshotReceiver *pReceiver = taosMemoryCalloc(1, sizeof(SSyncSnapshotReceiver));
|
||||
if (pReceiver == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
pReceiver->start = false;
|
||||
|
@ -697,7 +697,7 @@ static int32_t syncSnapReceiverExchgSnapInfo(SSyncNode *pSyncNode, SSyncSnapshot
|
|||
// copy snap info from leader
|
||||
void *data = taosMemoryCalloc(1, pMsg->dataLen);
|
||||
if (data == NULL) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
pInfo->data = data;
|
||||
data = NULL;
|
||||
|
|
|
@ -36,7 +36,7 @@ int32_t tfsOpen(SDiskCfg *pCfg, int32_t ndisk, STfs **ppTfs) {
|
|||
|
||||
pTfs = taosMemoryCalloc(1, sizeof(STfs));
|
||||
if (pTfs == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
|
||||
if (taosThreadSpinInit(&pTfs->lock, 0) != 0) {
|
||||
|
@ -429,7 +429,7 @@ int32_t tfsOpendir(STfs *pTfs, const char *rname, STfsDir **ppDir) {
|
|||
int32_t code = 0;
|
||||
STfsDir *pDir = taosMemoryCalloc(1, sizeof(STfsDir));
|
||||
if (pDir == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _exit);
|
||||
}
|
||||
|
||||
SDiskID diskId = {.id = 0, .level = 0};
|
||||
|
|
|
@ -22,7 +22,7 @@ int32_t tfsNewDisk(int32_t level, int32_t id, int8_t disable, const char *path,
|
|||
STfsDisk *pDisk = NULL;
|
||||
|
||||
if ((pDisk = taosMemoryCalloc(1, sizeof(STfsDisk))) == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
|
||||
if ((pDisk->path = taosStrdup(path)) == NULL) {
|
||||
|
|
|
@ -446,7 +446,7 @@ static void clientConnCb(uv_connect_t* req, int32_t status) {
|
|||
int32_t httpSendQuit(SHttpModule* http, int64_t chanId) {
|
||||
SHttpMsg* msg = taosMemoryCalloc(1, sizeof(SHttpMsg));
|
||||
if (msg == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
msg->seq = atomic_fetch_add_64(&httpSeqNum, 1);
|
||||
msg->quit = 1;
|
||||
|
@ -744,7 +744,7 @@ int64_t transInitHttpChanImpl() {
|
|||
int32_t code = 0;
|
||||
SHttpModule* http = taosMemoryCalloc(1, sizeof(SHttpModule));
|
||||
if (http == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -874,7 +874,7 @@ static int32_t allocConnRef(SCliConn* conn, bool update) {
|
|||
|
||||
SExHandle* exh = taosMemoryCalloc(1, sizeof(SExHandle));
|
||||
if (exh == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
exh->refId = transAddExHandle(transGetRefMgt(), exh);
|
||||
|
@ -974,7 +974,7 @@ static int32_t cliCreateConn(SCliThrd* pThrd, SCliConn** pCliConn) {
|
|||
int32_t code = 0;
|
||||
SCliConn* conn = taosMemoryCalloc(1, sizeof(SCliConn));
|
||||
if (conn == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
// read/write stream handle
|
||||
|
@ -996,7 +996,7 @@ static int32_t cliCreateConn(SCliThrd* pThrd, SCliConn** pCliConn) {
|
|||
if (timer == NULL) {
|
||||
timer = taosMemoryCalloc(1, sizeof(uv_timer_t));
|
||||
if (timer == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _failed);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _failed);
|
||||
}
|
||||
|
||||
tDebug("no available timer, create a timer %p", timer);
|
||||
|
@ -1951,7 +1951,7 @@ static int32_t createBatchList(SCliBatchList** ppBatchList, char* key, char* ip,
|
|||
SCliBatchList* pBatchList = taosMemoryCalloc(1, sizeof(SCliBatchList));
|
||||
if (pBatchList == NULL) {
|
||||
tError("failed to create batch list, reason:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
QUEUE_INIT(&pBatchList->wq);
|
||||
pBatchList->port = port;
|
||||
|
@ -1991,7 +1991,7 @@ static int32_t createBatch(SCliBatch** ppBatch, SCliBatchList* pList, SCliMsg* p
|
|||
SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch));
|
||||
if (pBatch == NULL) {
|
||||
tError("failed to create batch, reason:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
QUEUE_INIT(&pBatch->wq);
|
||||
|
@ -2315,7 +2315,7 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
|
|||
|
||||
SCliThrd* pThrd = (SCliThrd*)taosMemoryCalloc(1, sizeof(SCliThrd));
|
||||
if (pThrd == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _end);
|
||||
}
|
||||
|
||||
QUEUE_INIT(&pThrd->msg);
|
||||
|
@ -2323,7 +2323,7 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
|
|||
|
||||
pThrd->loop = (uv_loop_t*)taosMemoryMalloc(sizeof(uv_loop_t));
|
||||
if (pThrd->loop == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _end);
|
||||
}
|
||||
|
||||
code = uv_loop_init(pThrd->loop);
|
||||
|
@ -2362,7 +2362,7 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
|
|||
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) {
|
||||
|
@ -2486,7 +2486,7 @@ int32_t cliSendQuit(SCliThrd* thrd) {
|
|||
int32_t code = 0;
|
||||
SCliMsg* msg = taosMemoryCalloc(1, sizeof(SCliMsg));
|
||||
if (msg == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
msg->type = Quit;
|
||||
|
@ -2894,7 +2894,7 @@ int32_t transReleaseCliHandle(void* handle) {
|
|||
|
||||
STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx));
|
||||
if (pCtx == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pCtx->ahandle = tmsg.info.ahandle;
|
||||
|
@ -2902,7 +2902,7 @@ int32_t transReleaseCliHandle(void* handle) {
|
|||
SCliMsg* cmsg = taosMemoryCalloc(1, sizeof(SCliMsg));
|
||||
if (cmsg == NULL) {
|
||||
taosMemoryFree(pCtx);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
cmsg->msg = tmsg;
|
||||
cmsg->st = taosGetTimestampUs();
|
||||
|
@ -2923,7 +2923,7 @@ static int32_t transInitMsg(void* shandle, const SEpSet* pEpSet, STransMsg* pReq
|
|||
if (pReq->info.traceId.msgId == 0) TRACE_SET_MSGID(&pReq->info.traceId, tGenIdPI64());
|
||||
STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx));
|
||||
if (pCtx == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
epsetAssign(&pCtx->epSet, pEpSet);
|
||||
|
@ -2937,7 +2937,7 @@ static int32_t transInitMsg(void* shandle, const SEpSet* pEpSet, STransMsg* pReq
|
|||
SCliMsg* cliMsg = taosMemoryCalloc(1, sizeof(SCliMsg));
|
||||
if (cliMsg == NULL) {
|
||||
taosMemoryFree(pCtx);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
cliMsg->ctx = pCtx;
|
||||
|
@ -3071,7 +3071,7 @@ int32_t transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STra
|
|||
|
||||
STransMsg* pTransRsp = taosMemoryCalloc(1, sizeof(STransMsg));
|
||||
if (pTransRsp == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _RETURN1);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _RETURN1);
|
||||
}
|
||||
|
||||
SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle);
|
||||
|
@ -3081,7 +3081,7 @@ int32_t transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STra
|
|||
|
||||
tsem_t* sem = taosMemoryCalloc(1, sizeof(tsem_t));
|
||||
if (sem == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _RETURN1);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _RETURN1);
|
||||
}
|
||||
|
||||
code = tsem_init(sem, 0, 0);
|
||||
|
@ -3096,7 +3096,7 @@ int32_t transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STra
|
|||
if (pCtx == NULL) {
|
||||
(void)tsem_destroy(sem);
|
||||
taosMemoryFree(sem);
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _RETURN1);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _RETURN1);
|
||||
}
|
||||
|
||||
epsetAssign(&pCtx->epSet, pEpSet);
|
||||
|
@ -3111,7 +3111,7 @@ int32_t transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STra
|
|||
(void)tsem_destroy(sem);
|
||||
taosMemoryFree(sem);
|
||||
taosMemoryFree(pCtx);
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _RETURN1);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _RETURN1);
|
||||
}
|
||||
|
||||
cliMsg->ctx = pCtx;
|
||||
|
@ -3150,7 +3150,7 @@ int32_t transCreateSyncMsg(STransMsg* pTransMsg, int64_t* refId) {
|
|||
int32_t code = 0;
|
||||
tsem2_t* sem = taosMemoryCalloc(1, sizeof(tsem2_t));
|
||||
if (sem == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (tsem2_init(sem, 0, 0) != 0) {
|
||||
|
@ -3159,7 +3159,7 @@ int32_t transCreateSyncMsg(STransMsg* pTransMsg, int64_t* refId) {
|
|||
|
||||
STransSyncMsg* pSyncMsg = taosMemoryCalloc(1, sizeof(STransSyncMsg));
|
||||
if (pSyncMsg == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _EXIT);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _EXIT);
|
||||
}
|
||||
|
||||
taosInitRWLatch(&pSyncMsg->latch);
|
||||
|
@ -3194,7 +3194,7 @@ int32_t transSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, STransMsg* pReq,
|
|||
|
||||
STransMsg* pTransMsg = taosMemoryCalloc(1, sizeof(STransMsg));
|
||||
if (pTransMsg == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _RETURN2);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _RETURN2);
|
||||
}
|
||||
|
||||
SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle);
|
||||
|
@ -3206,7 +3206,7 @@ int32_t transSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, STransMsg* pReq,
|
|||
|
||||
STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx));
|
||||
if (pCtx == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _RETURN2);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _RETURN2);
|
||||
}
|
||||
|
||||
epsetAssign(&pCtx->epSet, pEpSet);
|
||||
|
@ -3229,7 +3229,7 @@ int32_t transSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, STransMsg* pReq,
|
|||
SCliMsg* cliMsg = taosMemoryCalloc(1, sizeof(SCliMsg));
|
||||
if (cliMsg == NULL) {
|
||||
taosMemoryFree(pCtx);
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _RETURN2);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _RETURN2);
|
||||
}
|
||||
|
||||
cliMsg->ctx = pCtx;
|
||||
|
@ -3294,7 +3294,7 @@ int32_t transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) {
|
|||
for (int8_t i = 0; i < pTransInst->numOfThreads; i++) {
|
||||
STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx));
|
||||
if (pCtx == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3303,7 +3303,7 @@ int32_t transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) {
|
|||
SCliMsg* cliMsg = taosMemoryCalloc(1, sizeof(SCliMsg));
|
||||
if (cliMsg == NULL) {
|
||||
taosMemoryFree(pCtx);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3330,7 +3330,7 @@ int32_t transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) {
|
|||
int32_t transAllocHandle(int64_t* refId) {
|
||||
SExHandle* exh = taosMemoryCalloc(1, sizeof(SExHandle));
|
||||
if (exh == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
exh->refId = transAddExHandle(transGetRefMgt(), exh);
|
||||
|
@ -3369,7 +3369,7 @@ int32_t transFreeConnById(void* shandle, int64_t transpointId) {
|
|||
|
||||
SCliMsg* pCli = taosMemoryCalloc(1, sizeof(SCliMsg));
|
||||
if (pCli == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _exception);
|
||||
}
|
||||
pCli->type = FreeById;
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ int32_t transDecompressMsg(char** msg, int32_t len) {
|
|||
|
||||
char* buf = taosMemoryCalloc(1, oriLen + sizeof(STransMsgHead));
|
||||
if (buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
STransMsgHead* pNewHead = (STransMsgHead*)buf;
|
||||
|
@ -106,7 +106,7 @@ int transSockInfo2Str(struct sockaddr* sockname, char* dst) {
|
|||
int32_t transInitBuffer(SConnBuffer* buf) {
|
||||
buf->buf = taosMemoryCalloc(1, BUFFER_CAP);
|
||||
if (buf->buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
buf->cap = BUFFER_CAP;
|
||||
|
@ -149,7 +149,7 @@ int32_t transDumpFromBuffer(SConnBuffer* connBuf, char** buf, int8_t resetBuf) {
|
|||
if (total >= HEADSIZE && !p->invalid) {
|
||||
*buf = taosMemoryCalloc(1, total);
|
||||
if (*buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
memcpy(*buf, p->buf, total);
|
||||
if ((code = transResetBuffer(connBuf, resetBuf)) < 0) {
|
||||
|
@ -249,7 +249,7 @@ int32_t transSetConnOption(uv_tcp_t* stream, int keepalive) {
|
|||
int32_t transAsyncPoolCreate(uv_loop_t* loop, int sz, void* arg, AsyncCB cb, SAsyncPool** pPool) {
|
||||
SAsyncPool* pool = taosMemoryCalloc(1, sizeof(SAsyncPool));
|
||||
if (pool == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
// return NULL;
|
||||
}
|
||||
int32_t code = 0;
|
||||
|
@ -258,7 +258,7 @@ int32_t transAsyncPoolCreate(uv_loop_t* loop, int sz, void* arg, AsyncCB cb, SAs
|
|||
pool->asyncs = taosMemoryCalloc(1, sizeof(uv_async_t) * pool->nAsync);
|
||||
if (pool->asyncs == NULL) {
|
||||
taosMemoryFree(pool);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int i = 0, err = 0;
|
||||
|
@ -267,7 +267,7 @@ int32_t transAsyncPoolCreate(uv_loop_t* loop, int sz, void* arg, AsyncCB cb, SAs
|
|||
|
||||
SAsyncItem* item = taosMemoryCalloc(1, sizeof(SAsyncItem));
|
||||
if (item == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
item->pThrd = arg;
|
||||
|
@ -560,7 +560,7 @@ int32_t transDQCreate(uv_loop_t* loop, SDelayQueue** queue) {
|
|||
|
||||
timer = taosMemoryCalloc(1, sizeof(uv_timer_t));
|
||||
if (timer == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
heap = heapCreate(timeCompare);
|
||||
|
@ -852,7 +852,7 @@ int32_t transUtilSWhiteListToStr(SIpWhiteList* pList, char** ppBuf) {
|
|||
int32_t len = 0;
|
||||
char* pBuf = taosMemoryCalloc(1, pList->num * 36);
|
||||
if (pBuf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int i = 0; i < pList->num; i++) {
|
||||
|
|
|
@ -260,7 +260,7 @@ int32_t uvWhiteListToStr(SWhiteUserList* plist, char* user, char** ppBuf) {
|
|||
|
||||
char* pBuf = taosMemoryCalloc(1, tlen + 64);
|
||||
if (pBuf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t len = sprintf(pBuf, "user: %s, ver: %" PRId64 ", ip: {%s}", user, plist->ver, tmp);
|
||||
|
@ -299,7 +299,7 @@ int32_t uvWhiteListAdd(SIpWhiteListTab* pWhite, char* user, SIpWhiteList* plist,
|
|||
if (ppUserList == NULL || *ppUserList == NULL) {
|
||||
SWhiteUserList* pUserList = taosMemoryCalloc(1, sizeof(SWhiteUserList));
|
||||
if (pUserList == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pUserList->ver = ver;
|
||||
|
@ -1104,7 +1104,7 @@ static int32_t addHandleToWorkloop(SWorkThrd* pThrd, char* pipeName) {
|
|||
pThrd->prepare = taosMemoryCalloc(1, sizeof(uv_prepare_t));
|
||||
if (pThrd->prepare == NULL) {
|
||||
tError("failed to init prepare");
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
code = uv_prepare_init(pThrd->loop, pThrd->prepare);
|
||||
|
@ -1155,7 +1155,7 @@ static int32_t addHandleToAcceptloop(void* arg) {
|
|||
srv->pAcceptAsync = taosMemoryCalloc(1, sizeof(uv_async_t));
|
||||
if (srv->pAcceptAsync == NULL) {
|
||||
tError("failed to create async since %s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
code = uv_async_init(srv->loop, srv->pAcceptAsync, uvAcceptAsyncCb);
|
||||
|
@ -1749,7 +1749,7 @@ int32_t transReleaseSrvHandle(void* handle) {
|
|||
|
||||
SSvrMsg* m = taosMemoryCalloc(1, sizeof(SSvrMsg));
|
||||
if (m == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _return1;
|
||||
}
|
||||
|
||||
|
@ -1799,7 +1799,7 @@ int32_t transSendResponse(const STransMsg* msg) {
|
|||
|
||||
SSvrMsg* m = taosMemoryCalloc(1, sizeof(SSvrMsg));
|
||||
if (m == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _return1;
|
||||
}
|
||||
|
||||
|
@ -1844,7 +1844,7 @@ int32_t transRegisterMsg(const STransMsg* msg) {
|
|||
|
||||
SSvrMsg* m = taosMemoryCalloc(1, sizeof(SSvrMsg));
|
||||
if (m == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _return1;
|
||||
}
|
||||
|
||||
|
@ -1888,7 +1888,7 @@ int32_t transSetIpWhiteList(void* thandle, void* arg, FilteFunc* func) {
|
|||
|
||||
SSvrMsg* msg = taosMemoryCalloc(1, sizeof(SSvrMsg));
|
||||
if (msg == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ static void tqsortImpl(void *src, int32_t start, int32_t end, int64_t size, cons
|
|||
int32_t taosqsort(void *src, int64_t numOfElem, int64_t size, const void *param, __ext_compar_fn_t comparFn) {
|
||||
char *buf = taosMemoryCalloc(1, size); // prepare the swap buffer
|
||||
if (NULL == buf) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
tqsortImpl(src, 0, (int32_t)numOfElem - 1, (int32_t)size, param, comparFn, buf);
|
||||
taosMemoryFreeClear(buf);
|
||||
|
@ -393,7 +393,7 @@ int32_t taosheapsort(void *base, int32_t size, int32_t len, const void *parcompa
|
|||
|
||||
char *buf = taosMemoryCalloc(1, size);
|
||||
if (buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (base && size > 0) {
|
||||
|
@ -454,7 +454,7 @@ static int32_t taosMergeSortHelper(void *src, int64_t numOfElem, int64_t size, c
|
|||
const int32_t THRESHOLD_SIZE = 6;
|
||||
char *buf = taosMemoryCalloc(1, size); // prepare the swap buffer
|
||||
if (buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int32_t start = 0; start < numOfElem - 1; start += THRESHOLD_SIZE) {
|
||||
|
|
|
@ -43,7 +43,7 @@ int32_t base58_encode(const uint8_t *value, int32_t vlen, char **result) {
|
|||
size = (pe - pb) * 69 / 50 + 1;
|
||||
if (size > TBASE_BUF_SIZE) {
|
||||
if (!(pbuf = taosMemoryCalloc(1, size))) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
bfree = true;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ int32_t base58_encode(const uint8_t *value, int32_t vlen, char **result) {
|
|||
uint8_t *pResult = taosMemoryCalloc(1, nz + (pbuf + size - pi) + 1);
|
||||
if (!pResult) {
|
||||
if (bfree) taosMemoryFree(pbuf);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memset(pResult, '1', nz);
|
||||
while (pi != pbuf + size) pResult[nz++] = basis_58[*pi++];
|
||||
|
@ -117,7 +117,7 @@ int32_t base58_decode(const char *value, size_t inlen, int32_t *outlen, uint8_t
|
|||
size = (int32_t)(pe - pb) * 733 / 1000 + 1;
|
||||
if (size > TBASE_BUF_SIZE) {
|
||||
if (!(pbuf = taosMemoryCalloc(1, size))) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
bfree = true;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ int32_t base58_decode(const char *value, size_t inlen, int32_t *outlen, uint8_t
|
|||
uint8_t *pResult = taosMemoryCalloc(1, nz + (pbuf + size - it) + 1);
|
||||
if (!pResult) {
|
||||
if (bfree) taosMemoryFree(pbuf);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(void)memset(pResult, 0, nz);
|
||||
|
|
|
@ -44,7 +44,7 @@ int32_t tBloomFilterInit(uint64_t expectedEntries, double errorRate, SBloomFilte
|
|||
}
|
||||
SBloomFilter* pBF = taosMemoryCalloc(1, sizeof(SBloomFilter));
|
||||
if (pBF == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
}
|
||||
pBF->expectedEntries = expectedEntries;
|
||||
|
@ -65,7 +65,7 @@ int32_t tBloomFilterInit(uint64_t expectedEntries, double errorRate, SBloomFilte
|
|||
pBF->buffer = taosMemoryCalloc(pBF->numUnits, sizeof(uint64_t));
|
||||
if (pBF->buffer == NULL) {
|
||||
tBloomFilterDestroy(pBF);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
}
|
||||
(*ppBF) = pBF;
|
||||
|
@ -152,7 +152,7 @@ int32_t tBloomFilterDecode(SDecoder* pDecoder, SBloomFilter** ppBF) {
|
|||
int32_t lino = 0;
|
||||
SBloomFilter* pBF = taosMemoryCalloc(1, sizeof(SBloomFilter));
|
||||
if (!pBF) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
}
|
||||
pBF->buffer = NULL;
|
||||
|
|
|
@ -45,7 +45,7 @@ extern char **environ;
|
|||
int32_t cfgInit(SConfig **ppCfg) {
|
||||
SConfig *pCfg = taosMemoryCalloc(1, sizeof(SConfig));
|
||||
if (pCfg == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
pCfg->array = taosArrayInit(32, sizeof(SConfigItem));
|
||||
|
@ -1458,7 +1458,7 @@ struct SConfigIter {
|
|||
int32_t cfgCreateIter(SConfig *pConf, SConfigIter **ppIter) {
|
||||
SConfigIter *pIter = taosMemoryCalloc(1, sizeof(SConfigIter));
|
||||
if (pIter == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
pIter->pConf = pConf;
|
||||
|
|
|
@ -93,7 +93,7 @@ int32_t getThreadLocalGeosCtx(SGeosContext **ppCtx) {
|
|||
|
||||
SGeosContext *tlGeosCtxObj = (SGeosContext *)taosMemoryCalloc(1, sizeof(SGeosContext));
|
||||
if (!tlGeosCtxObj) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
if ((taosThreadSetSpecific(tlGeosCtxKey, (const void *)tlGeosCtxObj)) != 0) {
|
||||
taosMemoryFreeClear(tlGeosCtxObj);
|
||||
|
|
|
@ -320,7 +320,7 @@ int32_t tjsonMakeObject(const SJson* pJson, const char* pName, FToObject func, v
|
|||
}
|
||||
*pObj = taosMemoryCalloc(1, objSize);
|
||||
if (NULL == *pObj) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
return func(pJsonObj, *pObj);
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ int32_t tdListPrepend(SList *list, void *data) {
|
|||
int32_t tdListAppend(SList *list, const void *data) {
|
||||
SListNode *node = (SListNode *)taosMemoryCalloc(1, sizeof(SListNode) + list->eleSize);
|
||||
if (node == NULL) {
|
||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
memcpy((void *)(node->data), data, list->eleSize);
|
||||
|
|
|
@ -112,7 +112,7 @@ static int taosLRUEntryTableInit(SLRUEntryTable *table, int maxUpperHashBits) {
|
|||
table->lengthBits = 4;
|
||||
table->list = taosMemoryCalloc(1 << table->lengthBits, sizeof(SLRUEntry *));
|
||||
if (!table->list) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
table->elems = 0;
|
||||
|
|
|
@ -62,7 +62,7 @@ void taosSetQueueCapacity(STaosQueue *queue, int64_t size) { queue->itemLimit =
|
|||
int32_t taosOpenQueue(STaosQueue **queue) {
|
||||
*queue = taosMemoryCalloc(1, sizeof(STaosQueue));
|
||||
if (*queue == NULL) {
|
||||
return (terrno = TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = taosThreadMutexInit(&(*queue)->mutex, NULL);
|
||||
|
@ -162,7 +162,7 @@ int32_t taosAllocateQitem(int32_t size, EQItype itype, int64_t dataSize, void **
|
|||
STaosQnode *pNode = taosMemoryCalloc(1, sizeof(STaosQnode) + size);
|
||||
if (pNode == NULL) {
|
||||
(void)atomic_sub_fetch_64(&tsQueueMemoryUsed, size + dataSize);
|
||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pNode->dataSize = dataSize;
|
||||
|
@ -260,7 +260,7 @@ int32_t taosReadQitem(STaosQueue *queue, void **ppItem) {
|
|||
int32_t taosAllocateQall(STaosQall **qall) {
|
||||
*qall = taosMemoryCalloc(1, sizeof(STaosQall));
|
||||
if (*qall == NULL) {
|
||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ int32_t taosGetQitem(STaosQall *qall, void **ppItem) {
|
|||
int32_t taosOpenQset(STaosQset **qset) {
|
||||
*qset = taosMemoryCalloc(sizeof(STaosQset), 1);
|
||||
if (*qset == NULL) {
|
||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(void)taosThreadMutexInit(&(*qset)->mutex, NULL);
|
||||
|
|
|
@ -67,13 +67,13 @@ int32_t taosOpenRef(int32_t max, RefFp fp) {
|
|||
|
||||
nodeList = taosMemoryCalloc(sizeof(SRefNode *), (size_t)max);
|
||||
if (nodeList == NULL) {
|
||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
lockedBy = taosMemoryCalloc(sizeof(int64_t), (size_t)max);
|
||||
if (lockedBy == NULL) {
|
||||
taosMemoryFree(nodeList);
|
||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(void)taosThreadMutexLock(&tsRefMutex);
|
||||
|
@ -157,7 +157,7 @@ int64_t taosAddRef(int32_t rsetId, void *p) {
|
|||
|
||||
pNode = taosMemoryCalloc(sizeof(SRefNode), 1);
|
||||
if (pNode == NULL) {
|
||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
rid = atomic_add_fetch_64(&pSet->rid, 1);
|
||||
|
|
|
@ -38,7 +38,7 @@ int32_t tScalableBfInit(uint64_t expectedEntries, double errorRate, SScalableBf*
|
|||
}
|
||||
SScalableBf* pSBf = taosMemoryCalloc(1, sizeof(SScalableBf));
|
||||
if (pSBf == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
}
|
||||
pSBf->maxBloomFilters = DEFAULT_MAX_BLOOMFILTERS;
|
||||
|
@ -218,7 +218,7 @@ int32_t tScalableBfDecode(SDecoder* pDecoder, SScalableBf** ppSBf) {
|
|||
int32_t lino = 0;
|
||||
SScalableBf* pSBf = taosMemoryCalloc(1, sizeof(SScalableBf));
|
||||
if (!pSBf) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
}
|
||||
pSBf->hashFn1 = HASH_FUNCTION_1;
|
||||
|
|
|
@ -31,7 +31,7 @@ int32_t tQWorkerInit(SQWorkerPool *pool) {
|
|||
pool->workers = taosMemoryCalloc(pool->max, sizeof(SQueueWorker));
|
||||
if (pool->workers == NULL) {
|
||||
taosCloseQset(pool->qset);
|
||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(void)taosThreadMutexInit(&pool->mutex, NULL);
|
||||
|
@ -310,7 +310,7 @@ int32_t tWWorkerInit(SWWorkerPool *pool) {
|
|||
pool->nextId = 0;
|
||||
pool->workers = taosMemoryCalloc(pool->max, sizeof(SWWorker));
|
||||
if (pool->workers == NULL) {
|
||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(void)taosThreadMutexInit(&pool->mutex, NULL);
|
||||
|
@ -459,7 +459,7 @@ int32_t tSingleWorkerInit(SSingleWorker *pWorker, const SSingleWorkerCfg *pCfg)
|
|||
case QWORKER_POOL: {
|
||||
SQWorkerPool *pPool = taosMemoryCalloc(1, sizeof(SQWorkerPool));
|
||||
if (!pPool) {
|
||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pPool->name = pCfg->name;
|
||||
pPool->min = pCfg->min;
|
||||
|
@ -477,7 +477,7 @@ int32_t tSingleWorkerInit(SSingleWorker *pWorker, const SSingleWorkerCfg *pCfg)
|
|||
case QUERY_AUTO_QWORKER_POOL: {
|
||||
SQueryAutoQWorkerPool *pPool = taosMemoryCalloc(1, sizeof(SQueryAutoQWorkerPool));
|
||||
if (!pPool) {
|
||||
return (terrno = TSDB_CODE_OUT_OF_MEMORY);
|
||||
return terrno;
|
||||
}
|
||||
pPool->name = pCfg->name;
|
||||
pPool->min = pCfg->min;
|
||||
|
@ -812,7 +812,7 @@ int32_t tQueryAutoQWorkerInit(SQueryAutoQWorkerPool *pool) {
|
|||
|
||||
if (!pool->pCb) {
|
||||
pool->pCb = taosMemoryCalloc(1, sizeof(SQueryAutoQWorkerPoolCB));
|
||||
if (!pool->pCb) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!pool->pCb) return terrno;
|
||||
pool->pCb->pPool = pool;
|
||||
pool->pCb->beforeBlocking = tQueryAutoQWorkerBeforeBlocking;
|
||||
pool->pCb->afterRecoverFromBlocking = tQueryAutoQWorkerRecoverFromBlocking;
|
||||
|
|
Loading…
Reference in New Issue