fix: coverity issues
This commit is contained in:
parent
a83c69b8cf
commit
adb335467c
|
@ -140,6 +140,9 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) {
|
|||
if (pSnode == NULL) {
|
||||
dError("snode: msg:%p failed to put into vnode queue since %s, type:%s qtype:%d", pMsg, terrstr(),
|
||||
TMSG_INFO(pMsg->msgType), qtype);
|
||||
taosFreeQitem(pMsg);
|
||||
rpcFreeCont(pRpc->pCont);
|
||||
pRpc->pCont = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -282,6 +282,8 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
|
|||
pMgmt->errCode = 0;
|
||||
|
||||
SRpcMsg req = {.msgType = TDMT_MND_APPLY_MSG, .contLen = sdbGetRawTotalSize(pRaw)};
|
||||
if (req.contLen <= 0) return -1;
|
||||
|
||||
req.pCont = rpcMallocCont(req.contLen);
|
||||
if (req.pCont == NULL) return -1;
|
||||
memcpy(req.pCont, pRaw, req.contLen);
|
||||
|
|
|
@ -375,7 +375,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
|
|||
if (taosArrayPush(pTrans->undoActions, &action) == NULL) goto _OVER;
|
||||
action.pCont = NULL;
|
||||
} else {
|
||||
if (taosArrayPush(pTrans->redoActions, &action) == NULL) goto _OVER;
|
||||
if (taosArrayPush(pTrans->undoActions, &action) == NULL) goto _OVER;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -325,10 +325,10 @@ static void *mndBuildAlterVnodeConfigReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pV
|
|||
static void *mndBuildAlterVnodeReplicaReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_t dnodeId,
|
||||
int32_t *pContLen) {
|
||||
SAlterVnodeReplicaReq alterReq = {
|
||||
alterReq.vgId = pVgroup->vgId,
|
||||
alterReq.strict = pDb->cfg.strict,
|
||||
alterReq.replica = pVgroup->replica,
|
||||
alterReq.selfIndex = -1,
|
||||
.vgId = pVgroup->vgId,
|
||||
.strict = pDb->cfg.strict,
|
||||
.replica = pVgroup->replica,
|
||||
.selfIndex = -1,
|
||||
};
|
||||
|
||||
for (int32_t v = 0; v < pVgroup->replica; ++v) {
|
||||
|
|
|
@ -768,7 +768,7 @@ char* sync2SimpleStr(int64_t rid) {
|
|||
sTrace("syncSetRpc get pSyncNode is NULL, rid:%" PRId64, rid);
|
||||
return NULL;
|
||||
}
|
||||
ASSERT(rid == pSyncNode->rid);
|
||||
|
||||
char* s = syncNode2SimpleStr(pSyncNode);
|
||||
syncNodeRelease(pSyncNode);
|
||||
|
||||
|
@ -778,11 +778,9 @@ char* sync2SimpleStr(int64_t rid) {
|
|||
int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak) {
|
||||
SSyncNode* pSyncNode = syncNodeAcquire(rid);
|
||||
if (pSyncNode == NULL) {
|
||||
syncNodeRelease(pSyncNode);
|
||||
terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
|
||||
return -1;
|
||||
}
|
||||
ASSERT(rid == pSyncNode->rid);
|
||||
|
||||
int32_t ret = syncNodePropose(pSyncNode, pMsg, isWeak);
|
||||
syncNodeRelease(pSyncNode);
|
||||
|
@ -3108,15 +3106,15 @@ int32_t syncDoLeaderTransfer(SSyncNode* ths, SRpcMsg* pRpcMsg, SSyncRaftEntry* p
|
|||
|
||||
if (ths->pFsm->FpLeaderTransferCb != NULL) {
|
||||
SFsmCbMeta cbMeta = {
|
||||
cbMeta.code = 0,
|
||||
cbMeta.currentTerm = ths->pRaftStore->currentTerm,
|
||||
cbMeta.flag = 0,
|
||||
cbMeta.index = pEntry->index,
|
||||
cbMeta.lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, pEntry->index),
|
||||
cbMeta.isWeak = pEntry->isWeak,
|
||||
cbMeta.seqNum = pEntry->seqNum,
|
||||
cbMeta.state = ths->state,
|
||||
cbMeta.term = pEntry->term,
|
||||
.code = 0,
|
||||
.currentTerm = ths->pRaftStore->currentTerm,
|
||||
.flag = 0,
|
||||
.index = pEntry->index,
|
||||
.lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, pEntry->index),
|
||||
.isWeak = pEntry->isWeak,
|
||||
.seqNum = pEntry->seqNum,
|
||||
.state = ths->state,
|
||||
.term = pEntry->term,
|
||||
};
|
||||
ths->pFsm->FpLeaderTransferCb(ths->pFsm, pRpcMsg, &cbMeta);
|
||||
}
|
||||
|
|
|
@ -146,15 +146,15 @@ void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl, bool rsp) {
|
|||
cnt++;
|
||||
|
||||
SFsmCbMeta cbMeta = {
|
||||
cbMeta.index = SYNC_INDEX_INVALID,
|
||||
cbMeta.lastConfigIndex = SYNC_INDEX_INVALID,
|
||||
cbMeta.isWeak = false,
|
||||
cbMeta.code = TSDB_CODE_SYN_TIMEOUT,
|
||||
cbMeta.state = pSyncNode->state,
|
||||
cbMeta.seqNum = *pSeqNum,
|
||||
cbMeta.term = SYNC_TERM_INVALID,
|
||||
cbMeta.currentTerm = pSyncNode->pRaftStore->currentTerm,
|
||||
cbMeta.flag = 0,
|
||||
.index = SYNC_INDEX_INVALID,
|
||||
.lastConfigIndex = SYNC_INDEX_INVALID,
|
||||
.isWeak = false,
|
||||
.code = TSDB_CODE_SYN_TIMEOUT,
|
||||
.state = pSyncNode->state,
|
||||
.seqNum = *pSeqNum,
|
||||
.term = SYNC_TERM_INVALID,
|
||||
.currentTerm = pSyncNode->pRaftStore->currentTerm,
|
||||
.flag = 0,
|
||||
};
|
||||
|
||||
pStub->rpcMsg.pCont = NULL;
|
||||
|
|
|
@ -246,9 +246,6 @@ STaosQueue *tWWorkerAllocQueue(SWWorkerPool *pool, void *ahandle, FItems fp) {
|
|||
pool->nextId = (pool->nextId + 1) % pool->max;
|
||||
}
|
||||
|
||||
while (worker->pid <= 0) taosMsleep(10);
|
||||
queue->threadId = worker->pid;
|
||||
uInfo("worker:%s, queue:%p is allocated, ahandle:%p thread:%08" PRId64, pool->name, queue, ahandle, queue->threadId);
|
||||
code = 0;
|
||||
|
||||
_OVER:
|
||||
|
@ -260,6 +257,9 @@ _OVER:
|
|||
if (worker->qall != NULL) taosFreeQall(worker->qall);
|
||||
return NULL;
|
||||
} else {
|
||||
while (worker->pid <= 0) taosMsleep(10);
|
||||
queue->threadId = worker->pid;
|
||||
uInfo("worker:%s, queue:%p is allocated, ahandle:%p thread:%08" PRId64, pool->name, queue, ahandle, queue->threadId);
|
||||
return queue;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue