Merge pull request #26824 from taosdata/enh/TD-30988-3.0
enh: refactor return code
This commit is contained in:
commit
cc1e18ae18
|
@ -33,7 +33,7 @@ void executeSQL(TAOS *taos, const char *sql) {
|
|||
void checkErrorCode(TAOS_STMT *stmt, int code, const char *msg) {
|
||||
if (code != 0) {
|
||||
printf("%s. error: %s\n", msg, taos_stmt_errstr(stmt));
|
||||
taos_stmt_close(stmt);
|
||||
(void)taos_stmt_close(stmt);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ void insertData(TAOS *taos) {
|
|||
int affectedRows = taos_stmt_affected_rows(stmt);
|
||||
printf("successfully inserted %d rows\n", affectedRows);
|
||||
// close
|
||||
taos_stmt_close(stmt);
|
||||
(void)taos_stmt_close(stmt);
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
|
|
@ -33,7 +33,7 @@ void executeSQL(TAOS *taos, const char *sql) {
|
|||
void checkErrorCode(TAOS_STMT *stmt, int code, const char* msg) {
|
||||
if (code != 0) {
|
||||
printf("%s. error: %s\n", msg, taos_stmt_errstr(stmt));
|
||||
taos_stmt_close(stmt);
|
||||
(void)taos_stmt_close(stmt);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ void insertData(TAOS *taos) {
|
|||
int affectedRows = taos_stmt_affected_rows(stmt);
|
||||
printf("successfully inserted %d rows\n", affectedRows);
|
||||
// close
|
||||
taos_stmt_close(stmt);
|
||||
(void)taos_stmt_close(stmt);
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
|
|
@ -59,7 +59,7 @@ int main() {
|
|||
|
||||
printf("total rows consumed: %d\n", nTotalRows);
|
||||
int keep = 0; // whether to keep subscribe process
|
||||
taos_unsubscribe(tsub, keep);
|
||||
(void)taos_unsubscribe(tsub, keep);
|
||||
|
||||
taos_close(taos);
|
||||
taos_cleanup();
|
||||
|
|
|
@ -238,7 +238,7 @@ const char* columnLevelStr(uint8_t type) {
|
|||
|
||||
bool checkColumnEncode(char encode[TSDB_CL_COMPRESS_OPTION_LEN]) {
|
||||
if (0 == strlen(encode)) return true;
|
||||
strtolower(encode, encode);
|
||||
(void)strtolower(encode, encode);
|
||||
for (int i = 0; i < supportedEncodeNum; ++i) {
|
||||
if (0 == strcmp((const char*)encode, supportedEncode[i])) {
|
||||
return true;
|
||||
|
@ -255,7 +255,7 @@ bool checkColumnEncodeOrSetDefault(uint8_t type, char encode[TSDB_CL_COMPRESS_OP
|
|||
}
|
||||
bool checkColumnCompress(char compress[TSDB_CL_COMPRESS_OPTION_LEN]) {
|
||||
if (0 == strlen(compress)) return true;
|
||||
strtolower(compress, compress);
|
||||
(void)strtolower(compress, compress);
|
||||
for (int i = 0; i < supportedCompressNum; ++i) {
|
||||
if (0 == strcmp((const char*)compress, supportedCompress[i])) {
|
||||
return true;
|
||||
|
@ -273,7 +273,7 @@ bool checkColumnCompressOrSetDefault(uint8_t type, char compress[TSDB_CL_COMPRES
|
|||
}
|
||||
bool checkColumnLevel(char level[TSDB_CL_COMPRESS_OPTION_LEN]) {
|
||||
if (0 == strlen(level)) return true;
|
||||
strtolower(level, level);
|
||||
(void)strtolower(level, level);
|
||||
if (1 == strlen(level)) {
|
||||
if ('h' == level[0] || 'm' == level[0] || 'l' == level[0]) return true;
|
||||
} else {
|
||||
|
|
|
@ -68,7 +68,7 @@ bool tdSTSRowIterFetch(STSRowIter *pIter, col_id_t colId, col_type_t colType, SC
|
|||
return false;
|
||||
}
|
||||
}
|
||||
tdSTSRowIterGetTpVal(pIter, pCol->type, pCol->offset, pVal);
|
||||
(void)tdSTSRowIterGetTpVal(pIter, pCol->type, pCol->offset, pVal);
|
||||
++pIter->colIdx;
|
||||
} else if (TD_IS_KV_ROW(pIter->pRow)) {
|
||||
return tdSTSRowIterGetKvVal(pIter, colId, &pIter->kvIdx, pVal);
|
||||
|
|
|
@ -682,7 +682,7 @@ static void ipRangeToStr(SIpV4Range *range, char *buf) {
|
|||
struct in_addr addr;
|
||||
addr.s_addr = range->ip;
|
||||
|
||||
uv_inet_ntop(AF_INET, &addr, buf, 32);
|
||||
(void)uv_inet_ntop(AF_INET, &addr, buf, 32);
|
||||
if (range->mask != 32) {
|
||||
(void)sprintf(buf + strlen(buf), "/%d", range->mask);
|
||||
}
|
||||
|
@ -2188,7 +2188,7 @@ static int32_t mndProcessAlterUserPrivilegesReq(SAlterUserReq *pAlterReq, SMnode
|
|||
mndReleaseDb(pMnode, pDb);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER); // TODO: refactor the terrno to code
|
||||
}
|
||||
taosHashRemove(pNewUser->readDbs, pAlterReq->objname, len);
|
||||
(void)taosHashRemove(pNewUser->readDbs, pAlterReq->objname, len);
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
} else {
|
||||
taosHashClear(pNewUser->readDbs);
|
||||
|
@ -2204,7 +2204,7 @@ static int32_t mndProcessAlterUserPrivilegesReq(SAlterUserReq *pAlterReq, SMnode
|
|||
mndReleaseDb(pMnode, pDb);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER); // TODO: refactor the terrno to code
|
||||
}
|
||||
taosHashRemove(pNewUser->writeDbs, pAlterReq->objname, len);
|
||||
(void)taosHashRemove(pNewUser->writeDbs, pAlterReq->objname, len);
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
} else {
|
||||
taosHashClear(pNewUser->writeDbs);
|
||||
|
@ -2311,7 +2311,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
|
|||
|
||||
TAOS_CHECK_GOTO(mndAcquireUser(pMnode, alterReq.user, &pUser), &lino, _OVER);
|
||||
|
||||
mndAcquireUser(pMnode, pReq->info.conn.user, &pOperUser);
|
||||
(void)mndAcquireUser(pMnode, pReq->info.conn.user, &pOperUser);
|
||||
if (pOperUser == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_MND_NO_USER_FROM_CONN, &lino, _OVER);
|
||||
}
|
||||
|
@ -2517,7 +2517,7 @@ static int32_t mndDropUser(SMnode *pMnode, SRpcMsg *pReq, SUserObj *pUser) {
|
|||
mndTransDrop(pTrans);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
ipWhiteMgtRemove(pUser->user);
|
||||
(void)ipWhiteMgtRemove(pUser->user);
|
||||
|
||||
mndTransDrop(pTrans);
|
||||
TAOS_RETURN(0);
|
||||
|
@ -2830,7 +2830,10 @@ static int32_t mndLoopHash(SHashObj *hash, char *priType, SSDataBlock *pBlock, i
|
|||
}
|
||||
|
||||
if (nodesStringToNode(value, &pAst) == 0) {
|
||||
nodesNodeToSQL(pAst, *sql, bufSz, &sqlLen);
|
||||
if (nodesNodeToSQL(pAst, *sql, bufSz, &sqlLen) != 0) {
|
||||
sqlLen = 5;
|
||||
(void)sprintf(*sql, "error");
|
||||
}
|
||||
nodesDestroyNode(pAst);
|
||||
} else {
|
||||
sqlLen = 5;
|
||||
|
|
|
@ -194,7 +194,7 @@ typedef enum {
|
|||
|
||||
#define TD_SMA_LOOPS_CHECK(n, limit) \
|
||||
if (++(n) > limit) { \
|
||||
sched_yield(); \
|
||||
(void)sched_yield(); \
|
||||
(n) = 0; \
|
||||
}
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ static int32_t tdProcessRSmaAsyncPostCommitImpl(SSma *pSma) {
|
|||
if (RSMA_INFO_IS_DEL(pRSmaInfo)) {
|
||||
int32_t refVal = T_REF_VAL_GET(pRSmaInfo);
|
||||
if (refVal == 0) {
|
||||
taosHashRemove(RSMA_INFO_HASH(pRSmaStat), pSuid, sizeof(*pSuid));
|
||||
(void)taosHashRemove(RSMA_INFO_HASH(pRSmaStat), pSuid, sizeof(*pSuid));
|
||||
} else {
|
||||
smaDebug(
|
||||
"vgId:%d, rsma async post commit, not free rsma info since ref is %d although already deleted for "
|
||||
|
|
|
@ -46,7 +46,7 @@ int32_t smaInit() {
|
|||
old = atomic_val_compare_exchange_8(&smaMgmt.inited, 0, 2);
|
||||
if (old != 2) break;
|
||||
if (++nLoops > 1000) {
|
||||
sched_yield();
|
||||
(void)sched_yield();
|
||||
nLoops = 0;
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ int32_t smaInit() {
|
|||
|
||||
if (!smaMgmt.refHash || !smaMgmt.tmrHandle) {
|
||||
code = terrno;
|
||||
taosCloseRef(smaMgmt.rsetId);
|
||||
(void)taosCloseRef(smaMgmt.rsetId);
|
||||
if (smaMgmt.refHash) {
|
||||
taosHashCleanup(smaMgmt.refHash);
|
||||
smaMgmt.refHash = NULL;
|
||||
|
@ -97,7 +97,7 @@ void smaCleanUp() {
|
|||
old = atomic_val_compare_exchange_8(&smaMgmt.inited, 1, 2);
|
||||
if (old != 2) break;
|
||||
if (++nLoops > 1000) {
|
||||
sched_yield();
|
||||
(void)sched_yield();
|
||||
nLoops = 0;
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ static int32_t tdNewSmaEnv(SSma *pSma, int8_t smaType, SSmaEnv **ppEnv) {
|
|||
: atomic_store_ptr(&SMA_RSMA_ENV(pSma), *ppEnv);
|
||||
|
||||
if ((code = tdInitSmaStat(&SMA_ENV_STAT(pEnv), smaType, pSma)) != TSDB_CODE_SUCCESS) {
|
||||
tdFreeSmaEnv(pEnv);
|
||||
(void)tdFreeSmaEnv(pEnv);
|
||||
*ppEnv = NULL;
|
||||
(smaType == TSDB_SMA_TYPE_TIME_RANGE) ? atomic_store_ptr(&SMA_TSMA_ENV(pSma), NULL)
|
||||
: atomic_store_ptr(&SMA_RSMA_ENV(pSma), NULL);
|
||||
|
@ -179,7 +179,7 @@ static void tRSmaInfoHashFreeNode(void *data) {
|
|||
if ((pItem = RSMA_INFO_ITEM((SRSmaInfo *)pRSmaInfo, 1)) && pItem->level) {
|
||||
(void)taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES);
|
||||
}
|
||||
tdFreeRSmaInfo(pRSmaInfo->pSma, pRSmaInfo);
|
||||
(void)tdFreeRSmaInfo(pRSmaInfo->pSma, pRSmaInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS
|
|||
SRSmaStat *pRSmaStat = (SRSmaStat *)(*pSmaStat);
|
||||
pRSmaStat->pSma = (SSma *)pSma;
|
||||
atomic_store_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_INIT);
|
||||
tsem_init(&pRSmaStat->notEmpty, 0, 0);
|
||||
(void)tsem_init(&pRSmaStat->notEmpty, 0, 0);
|
||||
if (!(pRSmaStat->blocks = taosArrayInit(1, sizeof(SSDataBlock)))) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
TAOS_CHECK_GOTO(code, &lino, _exit);
|
||||
|
@ -216,7 +216,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS
|
|||
(void)taosArrayPush(pRSmaStat->blocks, &datablock);
|
||||
|
||||
// init smaMgmt
|
||||
smaInit();
|
||||
TAOS_CHECK_GOTO(smaInit(), &lino, _exit);
|
||||
|
||||
int64_t refId = taosAddRef(smaMgmt.rsetId, pRSmaStat);
|
||||
if (refId < 0) {
|
||||
|
@ -285,20 +285,20 @@ static void tdDestroyRSmaStat(void *pRSmaStat) {
|
|||
}
|
||||
|
||||
// step 3:
|
||||
tdRsmaStopExecutor(pSma);
|
||||
(void)tdRsmaStopExecutor(pSma);
|
||||
|
||||
// step 4: destroy the rsma info and associated fetch tasks
|
||||
taosHashCleanup(RSMA_INFO_HASH(pStat));
|
||||
|
||||
// step 5: free pStat
|
||||
tsem_destroy(&(pStat->notEmpty));
|
||||
(void)tsem_destroy(&(pStat->notEmpty));
|
||||
taosArrayDestroy(pStat->blocks);
|
||||
taosMemoryFreeClear(pStat);
|
||||
}
|
||||
}
|
||||
|
||||
static void *tdFreeSmaState(SSmaStat *pSmaStat, int8_t smaType) {
|
||||
tdDestroySmaState(pSmaStat, smaType);
|
||||
(void)tdDestroySmaState(pSmaStat, smaType);
|
||||
if (smaType == TSDB_SMA_TYPE_TIME_RANGE) {
|
||||
taosMemoryFreeClear(pSmaStat);
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ static int32_t tdRsmaStopExecutor(const SSma *pSma) {
|
|||
pthread = (TdThread *)&pStat->data;
|
||||
|
||||
for (int32_t i = 0; i < tsNumOfVnodeRsmaThreads; ++i) {
|
||||
tsem_post(&(pRSmaStat->notEmpty));
|
||||
(void)tsem_post(&(pRSmaStat->notEmpty));
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < tsNumOfVnodeRsmaThreads; ++i) {
|
||||
|
|
|
@ -412,7 +412,7 @@ int32_t tdRSmaProcessCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con
|
|||
|
||||
_exit:
|
||||
if (code != 0) {
|
||||
tdFreeRSmaInfo(pSma, pRSmaInfo);
|
||||
(void)tdFreeRSmaInfo(pSma, pRSmaInfo);
|
||||
} else {
|
||||
smaDebug("vgId:%d, register rsma info succeed for table %" PRIi64, SMA_VID(pSma), suid);
|
||||
}
|
||||
|
@ -1264,7 +1264,7 @@ _checkpoint:
|
|||
if (pItem && pItem->pStreamTask) {
|
||||
SStreamTask *pTask = pItem->pStreamTask;
|
||||
// atomic_store_32(&pTask->pMeta->chkptNotReadyTasks, 1);
|
||||
streamTaskSetActiveCheckpointInfo(pTask, checkpointId);
|
||||
(void)streamTaskSetActiveCheckpointInfo(pTask, checkpointId);
|
||||
|
||||
pTask->chkInfo.checkpointId = checkpointId; // 1pTask->checkpointingId;
|
||||
pTask->chkInfo.checkpointVer = pItem->submitReqVer;
|
||||
|
@ -1373,7 +1373,7 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) {
|
|||
", rsetId:%d refId:%" PRIi64,
|
||||
SMA_VID(pSma), pItem->level, rsmaTriggerStat, smaMgmt.rsetId, pRSmaRef->refId);
|
||||
if (rsmaTriggerStat == TASK_TRIGGER_STAT_PAUSED) {
|
||||
taosTmrReset(tdRSmaFetchTrigger, RSMA_FETCH_INTERVAL, pItem, smaMgmt.tmrHandle, &pItem->tmrId);
|
||||
(void)taosTmrReset(tdRSmaFetchTrigger, RSMA_FETCH_INTERVAL, pItem, smaMgmt.tmrHandle, &pItem->tmrId);
|
||||
}
|
||||
tdReleaseRSmaInfo(pSma, pRSmaInfo);
|
||||
(void)tdReleaseSmaRef(smaMgmt.rsetId, pRSmaRef->refId);
|
||||
|
@ -1629,7 +1629,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
|
|||
batchMax = TMAX(batchMax, 4);
|
||||
}
|
||||
while (occupied || (++batchCnt < batchMax)) { // greedy mode
|
||||
taosReadAllQitems(pInfo->queue, pInfo->qall); // queue has mutex lock
|
||||
(void)taosReadAllQitems(pInfo->queue, pInfo->qall); // queue has mutex lock
|
||||
int32_t qallItemSize = taosQallItemSize(pInfo->qall);
|
||||
if (qallItemSize > 0) {
|
||||
if ((code = tdRSmaBatchExec(pSma, pInfo, pInfo->qall, pSubmitArr, type)) != 0) {
|
||||
|
@ -1663,7 +1663,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
|
|||
}
|
||||
|
||||
if (qallItemSize > 0) {
|
||||
atomic_fetch_sub_64(&pRSmaStat->nBufItems, qallItemSize);
|
||||
(void)atomic_fetch_sub_64(&pRSmaStat->nBufItems, qallItemSize);
|
||||
continue;
|
||||
}
|
||||
if (RSMA_NEED_FETCH(pInfo)) {
|
||||
|
@ -1673,7 +1673,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
atomic_val_compare_exchange_8(&pInfo->assigned, 1, 0);
|
||||
(void)atomic_val_compare_exchange_8(&pInfo->assigned, 1, 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -123,7 +123,7 @@ static int32_t tdProcessTSmaCreateImpl(SSma *pSma, int64_t ver, const char *pMsg
|
|||
TAOS_CHECK_EXIT(metaCreateTSma(SMA_META(pSma), ver, pCfg));
|
||||
|
||||
// create stable to save tsma result in dstVgId
|
||||
tNameFromString(&stbFullName, pCfg->dstTbName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
(void)tNameFromString(&stbFullName, pCfg->dstTbName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
pReq.name = (char *)tNameGetTableName(&stbFullName);
|
||||
pReq.suid = pCfg->dstTbUid;
|
||||
pReq.schemaRow = pCfg->schemaRow;
|
||||
|
@ -283,7 +283,7 @@ static int32_t tsmaProcessDelReq(SSma *pSma, int64_t indexUid, SBatchDeleteReq *
|
|||
|
||||
SEncoder encoder;
|
||||
tEncoderInit(&encoder, POINTER_SHIFT(pBuf, sizeof(SMsgHead)), len);
|
||||
tEncodeSBatchDeleteReq(&encoder, pDelReq);
|
||||
(void)tEncodeSBatchDeleteReq(&encoder, pDelReq);
|
||||
tEncoderClear(&encoder);
|
||||
|
||||
((SMsgHead *)pBuf)->vgId = TD_VID(pSma->pVnode);
|
||||
|
|
|
@ -134,7 +134,7 @@ int32_t syncLogReplGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncI
|
|||
}
|
||||
|
||||
SSnapshot snapshot = {0};
|
||||
(void)pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot); // TODO: check the return code
|
||||
(void)pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot);
|
||||
if (prevIndex == snapshot.lastApplyIndex) {
|
||||
*pSyncTerm = snapshot.lastApplyTerm;
|
||||
return 0;
|
||||
|
@ -184,7 +184,7 @@ int32_t syncLogBufferInitWithoutLock(SSyncLogBuffer* pBuf, SSyncNode* pNode) {
|
|||
|
||||
int32_t code = 0, lino = 0;
|
||||
SSnapshot snapshot = {0};
|
||||
pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot);
|
||||
TAOS_CHECK_EXIT(pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot));
|
||||
|
||||
SyncIndex commitIndex = snapshot.lastApplyIndex;
|
||||
SyncTerm commitTerm = TMAX(snapshot.lastApplyTerm, 0);
|
||||
|
|
|
@ -86,14 +86,17 @@ int32_t snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaIndex, SSyncSn
|
|||
pSender->replicaIndex = replicaIndex;
|
||||
pSender->term = raftStoreGetTerm(pSyncNode);
|
||||
pSender->startTime = -1;
|
||||
pSender->pSyncNode->pFsm->FpGetSnapshotInfo(pSender->pSyncNode->pFsm, &pSender->snapshot);
|
||||
pSender->finish = false;
|
||||
|
||||
code = pSender->pSyncNode->pFsm->FpGetSnapshotInfo(pSender->pSyncNode->pFsm, &pSender->snapshot);
|
||||
if (code != 0) {
|
||||
taosMemoryFreeClear(pSender);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
SSyncSnapBuffer *pSndBuf = NULL;
|
||||
code = syncSnapBufferCreate(&pSndBuf);
|
||||
if (pSndBuf == NULL) {
|
||||
taosMemoryFree(pSender);
|
||||
pSender = NULL;
|
||||
taosMemoryFreeClear(pSender);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
pSndBuf->entryDeleteCb = syncSnapBlockDestroy;
|
||||
|
@ -472,7 +475,7 @@ void snapshotReceiverDestroy(SSyncSnapshotReceiver *pReceiver) {
|
|||
syncSnapBufferDestroy(&pReceiver->pRcvBuf);
|
||||
}
|
||||
|
||||
snapshotReceiverClearInfoData(pReceiver);
|
||||
(void)snapshotReceiverClearInfoData(pReceiver);
|
||||
|
||||
// free receiver
|
||||
taosMemoryFree(pReceiver);
|
||||
|
@ -592,7 +595,7 @@ static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnap
|
|||
code = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, true,
|
||||
&pReceiver->snapshot);
|
||||
if (code != 0) {
|
||||
sRError(pReceiver, "snapshot receiver apply failed since %s", tstrerror(code));
|
||||
sRError(pReceiver, "snapshot receiver apply failed since %s", tstrerror(code));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
pReceiver->pWriter = NULL;
|
||||
|
@ -603,7 +606,11 @@ static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnap
|
|||
|
||||
// get fsmState
|
||||
SSnapshot snapshot = {0};
|
||||
pReceiver->pSyncNode->pFsm->FpGetSnapshotInfo(pReceiver->pSyncNode->pFsm, &snapshot);
|
||||
code = pReceiver->pSyncNode->pFsm->FpGetSnapshotInfo(pReceiver->pSyncNode->pFsm, &snapshot);
|
||||
if (code != 0) {
|
||||
sRError(pReceiver, "snapshot receiver get snapshot info failed since %s", tstrerror(code));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
pReceiver->pSyncNode->fsmState = snapshot.state;
|
||||
|
||||
// reset wal
|
||||
|
@ -1276,13 +1283,13 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, SRpcMsg *pRpcMsg) {
|
|||
if (pMsg->ack == SYNC_SNAPSHOT_SEQ_END) {
|
||||
sSInfo(pSender, "process end rsp");
|
||||
snapshotSenderStop(pSender, true);
|
||||
syncNodeReplicateReset(pSyncNode, &pMsg->srcId);
|
||||
(void)syncNodeReplicateReset(pSyncNode, &pMsg->srcId);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
_ERROR:
|
||||
snapshotSenderStop(pSender, false);
|
||||
syncNodeReplicateReset(pSyncNode, &pMsg->srcId);
|
||||
(void)syncNodeReplicateReset(pSyncNode, &pMsg->srcId);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo
|
|||
|
||||
SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0};
|
||||
if (pNode->pFsm != NULL && pNode->pFsm->FpGetSnapshotInfo != NULL) {
|
||||
pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot);
|
||||
(void)pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot);
|
||||
}
|
||||
|
||||
SyncIndex logLastIndex = SYNC_INDEX_INVALID;
|
||||
|
@ -253,7 +253,7 @@ void syncPrintSnapshotSenderLog(const char* flags, ELogLevel level, int32_t dfla
|
|||
|
||||
SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0};
|
||||
if (pNode->pFsm != NULL && pNode->pFsm->FpGetSnapshotInfo != NULL) {
|
||||
pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot);
|
||||
(void)pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot);
|
||||
}
|
||||
|
||||
SyncIndex logLastIndex = SYNC_INDEX_INVALID;
|
||||
|
@ -302,7 +302,7 @@ void syncPrintSnapshotReceiverLog(const char* flags, ELogLevel level, int32_t df
|
|||
|
||||
SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0};
|
||||
if (pNode->pFsm != NULL && pNode->pFsm->FpGetSnapshotInfo != NULL) {
|
||||
pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot);
|
||||
(void)pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot);
|
||||
}
|
||||
|
||||
SyncIndex logLastIndex = SYNC_INDEX_INVALID;
|
||||
|
|
|
@ -483,7 +483,7 @@ const STfsFile *tfsReaddir(STfsDir *pTfsDir) {
|
|||
void tfsClosedir(STfsDir *pTfsDir) {
|
||||
if (pTfsDir) {
|
||||
if (pTfsDir->pDir != NULL) {
|
||||
taosCloseDir(&pTfsDir->pDir);
|
||||
(void)taosCloseDir(&pTfsDir->pDir);
|
||||
pTfsDir->pDir = NULL;
|
||||
}
|
||||
taosMemoryFree(pTfsDir);
|
||||
|
|
Loading…
Reference in New Issue