提交 adb33546 编写于 作者: S Shengliang Guan

fix: coverity issues

上级 a83c69b8
...@@ -140,6 +140,9 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { ...@@ -140,6 +140,9 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) {
if (pSnode == NULL) { if (pSnode == NULL) {
dError("snode: msg:%p failed to put into vnode queue since %s, type:%s qtype:%d", pMsg, terrstr(), dError("snode: msg:%p failed to put into vnode queue since %s, type:%s qtype:%d", pMsg, terrstr(),
TMSG_INFO(pMsg->msgType), qtype); TMSG_INFO(pMsg->msgType), qtype);
taosFreeQitem(pMsg);
rpcFreeCont(pRpc->pCont);
pRpc->pCont = NULL;
return -1; return -1;
} }
......
...@@ -282,6 +282,8 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) { ...@@ -282,6 +282,8 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
pMgmt->errCode = 0; pMgmt->errCode = 0;
SRpcMsg req = {.msgType = TDMT_MND_APPLY_MSG, .contLen = sdbGetRawTotalSize(pRaw)}; SRpcMsg req = {.msgType = TDMT_MND_APPLY_MSG, .contLen = sdbGetRawTotalSize(pRaw)};
if (req.contLen <= 0) return -1;
req.pCont = rpcMallocCont(req.contLen); req.pCont = rpcMallocCont(req.contLen);
if (req.pCont == NULL) return -1; if (req.pCont == NULL) return -1;
memcpy(req.pCont, pRaw, req.contLen); memcpy(req.pCont, pRaw, req.contLen);
......
...@@ -375,7 +375,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) { ...@@ -375,7 +375,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
if (taosArrayPush(pTrans->undoActions, &action) == NULL) goto _OVER; if (taosArrayPush(pTrans->undoActions, &action) == NULL) goto _OVER;
action.pCont = NULL; action.pCont = NULL;
} else { } 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 ...@@ -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, static void *mndBuildAlterVnodeReplicaReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_t dnodeId,
int32_t *pContLen) { int32_t *pContLen) {
SAlterVnodeReplicaReq alterReq = { SAlterVnodeReplicaReq alterReq = {
alterReq.vgId = pVgroup->vgId, .vgId = pVgroup->vgId,
alterReq.strict = pDb->cfg.strict, .strict = pDb->cfg.strict,
alterReq.replica = pVgroup->replica, .replica = pVgroup->replica,
alterReq.selfIndex = -1, .selfIndex = -1,
}; };
for (int32_t v = 0; v < pVgroup->replica; ++v) { for (int32_t v = 0; v < pVgroup->replica; ++v) {
......
...@@ -768,7 +768,7 @@ char* sync2SimpleStr(int64_t rid) { ...@@ -768,7 +768,7 @@ char* sync2SimpleStr(int64_t rid) {
sTrace("syncSetRpc get pSyncNode is NULL, rid:%" PRId64, rid); sTrace("syncSetRpc get pSyncNode is NULL, rid:%" PRId64, rid);
return NULL; return NULL;
} }
ASSERT(rid == pSyncNode->rid);
char* s = syncNode2SimpleStr(pSyncNode); char* s = syncNode2SimpleStr(pSyncNode);
syncNodeRelease(pSyncNode); syncNodeRelease(pSyncNode);
...@@ -778,11 +778,9 @@ char* sync2SimpleStr(int64_t rid) { ...@@ -778,11 +778,9 @@ char* sync2SimpleStr(int64_t rid) {
int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak) { int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak) {
SSyncNode* pSyncNode = syncNodeAcquire(rid); SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) { if (pSyncNode == NULL) {
syncNodeRelease(pSyncNode);
terrno = TSDB_CODE_SYN_INTERNAL_ERROR; terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
return -1; return -1;
} }
ASSERT(rid == pSyncNode->rid);
int32_t ret = syncNodePropose(pSyncNode, pMsg, isWeak); int32_t ret = syncNodePropose(pSyncNode, pMsg, isWeak);
syncNodeRelease(pSyncNode); syncNodeRelease(pSyncNode);
...@@ -3108,15 +3106,15 @@ int32_t syncDoLeaderTransfer(SSyncNode* ths, SRpcMsg* pRpcMsg, SSyncRaftEntry* p ...@@ -3108,15 +3106,15 @@ int32_t syncDoLeaderTransfer(SSyncNode* ths, SRpcMsg* pRpcMsg, SSyncRaftEntry* p
if (ths->pFsm->FpLeaderTransferCb != NULL) { if (ths->pFsm->FpLeaderTransferCb != NULL) {
SFsmCbMeta cbMeta = { SFsmCbMeta cbMeta = {
cbMeta.code = 0, .code = 0,
cbMeta.currentTerm = ths->pRaftStore->currentTerm, .currentTerm = ths->pRaftStore->currentTerm,
cbMeta.flag = 0, .flag = 0,
cbMeta.index = pEntry->index, .index = pEntry->index,
cbMeta.lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, pEntry->index), .lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, pEntry->index),
cbMeta.isWeak = pEntry->isWeak, .isWeak = pEntry->isWeak,
cbMeta.seqNum = pEntry->seqNum, .seqNum = pEntry->seqNum,
cbMeta.state = ths->state, .state = ths->state,
cbMeta.term = pEntry->term, .term = pEntry->term,
}; };
ths->pFsm->FpLeaderTransferCb(ths->pFsm, pRpcMsg, &cbMeta); ths->pFsm->FpLeaderTransferCb(ths->pFsm, pRpcMsg, &cbMeta);
} }
......
...@@ -146,15 +146,15 @@ void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl, bool rsp) { ...@@ -146,15 +146,15 @@ void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl, bool rsp) {
cnt++; cnt++;
SFsmCbMeta cbMeta = { SFsmCbMeta cbMeta = {
cbMeta.index = SYNC_INDEX_INVALID, .index = SYNC_INDEX_INVALID,
cbMeta.lastConfigIndex = SYNC_INDEX_INVALID, .lastConfigIndex = SYNC_INDEX_INVALID,
cbMeta.isWeak = false, .isWeak = false,
cbMeta.code = TSDB_CODE_SYN_TIMEOUT, .code = TSDB_CODE_SYN_TIMEOUT,
cbMeta.state = pSyncNode->state, .state = pSyncNode->state,
cbMeta.seqNum = *pSeqNum, .seqNum = *pSeqNum,
cbMeta.term = SYNC_TERM_INVALID, .term = SYNC_TERM_INVALID,
cbMeta.currentTerm = pSyncNode->pRaftStore->currentTerm, .currentTerm = pSyncNode->pRaftStore->currentTerm,
cbMeta.flag = 0, .flag = 0,
}; };
pStub->rpcMsg.pCont = NULL; pStub->rpcMsg.pCont = NULL;
......
...@@ -246,9 +246,6 @@ STaosQueue *tWWorkerAllocQueue(SWWorkerPool *pool, void *ahandle, FItems fp) { ...@@ -246,9 +246,6 @@ STaosQueue *tWWorkerAllocQueue(SWWorkerPool *pool, void *ahandle, FItems fp) {
pool->nextId = (pool->nextId + 1) % pool->max; 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; code = 0;
_OVER: _OVER:
...@@ -260,6 +257,9 @@ _OVER: ...@@ -260,6 +257,9 @@ _OVER:
if (worker->qall != NULL) taosFreeQall(worker->qall); if (worker->qall != NULL) taosFreeQall(worker->qall);
return NULL; return NULL;
} else { } 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; return queue;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册