fix: coverity issues
This commit is contained in:
parent
e5abe59bb1
commit
e94646ca70
|
@ -132,7 +132,7 @@ typedef struct SSyncFSM {
|
||||||
void (*FpRollBackCb)(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta);
|
void (*FpRollBackCb)(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta);
|
||||||
|
|
||||||
void (*FpRestoreFinishCb)(struct SSyncFSM* pFsm);
|
void (*FpRestoreFinishCb)(struct SSyncFSM* pFsm);
|
||||||
void (*FpReConfigCb)(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SReConfigCbMeta cbMeta);
|
void (*FpReConfigCb)(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SReConfigCbMeta *cbMeta);
|
||||||
void (*FpLeaderTransferCb)(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta);
|
void (*FpLeaderTransferCb)(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta);
|
||||||
|
|
||||||
void (*FpBecomeLeaderCb)(struct SSyncFSM* pFsm);
|
void (*FpBecomeLeaderCb)(struct SSyncFSM* pFsm);
|
||||||
|
|
|
@ -74,11 +74,14 @@ static SProcQueue *dmInitProcQueue(SProc *proc, char *ptr, int32_t size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tstrncpy(queue->name, proc->name, sizeof(queue->name));
|
tstrncpy(queue->name, proc->name, sizeof(queue->name));
|
||||||
|
|
||||||
|
taosThreadMutexLock(&queue->mutex);
|
||||||
queue->head = 0;
|
queue->head = 0;
|
||||||
queue->tail = 0;
|
queue->tail = 0;
|
||||||
queue->total = bufSize;
|
queue->total = bufSize;
|
||||||
queue->avail = bufSize;
|
queue->avail = bufSize;
|
||||||
queue->items = 0;
|
queue->items = 0;
|
||||||
|
taosThreadMutexUnlock(&queue->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return queue;
|
return queue;
|
||||||
|
|
|
@ -301,7 +301,7 @@ int32_t dmInitServer(SDnode *pDnode) {
|
||||||
SDnodeTrans *pTrans = &pDnode->trans;
|
SDnodeTrans *pTrans = &pDnode->trans;
|
||||||
|
|
||||||
SRpcInit rpcInit = {0};
|
SRpcInit rpcInit = {0};
|
||||||
strncpy(rpcInit.localFqdn, tsLocalFqdn, TSDB_FQDN_LEN);
|
tstrncpy(rpcInit.localFqdn, tsLocalFqdn, TSDB_FQDN_LEN);
|
||||||
rpcInit.localPort = tsServerPort;
|
rpcInit.localPort = tsServerPort;
|
||||||
rpcInit.label = "DND-S";
|
rpcInit.label = "DND-S";
|
||||||
rpcInit.numOfThreads = tsNumOfRpcThreads;
|
rpcInit.numOfThreads = tsNumOfRpcThreads;
|
||||||
|
|
|
@ -83,6 +83,7 @@ static int32_t mndCreateDefaultAcct(SMnode *pMnode) {
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL, "create-acct");
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL, "create-acct");
|
||||||
if (pTrans == NULL) {
|
if (pTrans == NULL) {
|
||||||
|
sdbFreeRaw(pRaw);
|
||||||
mError("acct:%s, failed to create since %s", acctObj.acct, terrstr());
|
mError("acct:%s, failed to create since %s", acctObj.acct, terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,7 +315,7 @@ static int32_t mndProcessUptimeTimer(SRpcMsg *pReq) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mInfo("update cluster uptime to %" PRId64, clusterObj.upTime);
|
mInfo("update cluster uptime to %d", clusterObj.upTime);
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "update-uptime");
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "update-uptime");
|
||||||
if (pTrans == NULL) return -1;
|
if (pTrans == NULL) return -1;
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ void mndSyncCommitMsg(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbM
|
||||||
if (pMgmt->errCode != 0) {
|
if (pMgmt->errCode != 0) {
|
||||||
mError("trans:%d, failed to propose since %s, post sem", transId, tstrerror(pMgmt->errCode));
|
mError("trans:%d, failed to propose since %s, post sem", transId, tstrerror(pMgmt->errCode));
|
||||||
} else {
|
} else {
|
||||||
mInfo("trans:%d, is proposed and post sem", transId, tstrerror(pMgmt->errCode));
|
mInfo("trans:%d, is proposed and post sem", transId);
|
||||||
}
|
}
|
||||||
pMgmt->transId = 0;
|
pMgmt->transId = 0;
|
||||||
taosWUnLockLatch(&pMgmt->lock);
|
taosWUnLockLatch(&pMgmt->lock);
|
||||||
|
@ -113,13 +113,13 @@ void mndRestoreFinish(struct SSyncFSM *pFsm) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mndReConfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReConfigCbMeta cbMeta) {
|
void mndReConfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReConfigCbMeta *cbMeta) {
|
||||||
SMnode *pMnode = pFsm->data;
|
SMnode *pMnode = pFsm->data;
|
||||||
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
|
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
|
||||||
|
|
||||||
pMgmt->errCode = cbMeta.code;
|
pMgmt->errCode = cbMeta->code;
|
||||||
mInfo("trans:-1, sync reconfig is proposed, saved:%d code:0x%x, index:%" PRId64 " term:%" PRId64, pMgmt->transId,
|
mInfo("trans:-1, sync reconfig is proposed, saved:%d code:0x%x, index:%" PRId64 " term:%" PRId64, pMgmt->transId,
|
||||||
cbMeta.code, cbMeta.index, cbMeta.term);
|
cbMeta->code, cbMeta->index, cbMeta->term);
|
||||||
|
|
||||||
taosWLockLatch(&pMgmt->lock);
|
taosWLockLatch(&pMgmt->lock);
|
||||||
if (pMgmt->transId == -1) {
|
if (pMgmt->transId == -1) {
|
||||||
|
@ -127,7 +127,7 @@ void mndReConfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReConfigCbMeta cbM
|
||||||
mError("trans:-1, failed to propose sync reconfig since %s, post sem", tstrerror(pMgmt->errCode));
|
mError("trans:-1, failed to propose sync reconfig since %s, post sem", tstrerror(pMgmt->errCode));
|
||||||
} else {
|
} else {
|
||||||
mInfo("trans:-1, sync reconfig is proposed, saved:%d code:0x%x, index:%" PRId64 " term:%" PRId64 " post sem",
|
mInfo("trans:-1, sync reconfig is proposed, saved:%d code:0x%x, index:%" PRId64 " term:%" PRId64 " post sem",
|
||||||
pMgmt->transId, cbMeta.code, cbMeta.index, cbMeta.term);
|
pMgmt->transId, cbMeta->code, cbMeta->index, cbMeta->term);
|
||||||
}
|
}
|
||||||
pMgmt->transId = 0;
|
pMgmt->transId = 0;
|
||||||
tsem_post(&pMgmt->syncSem);
|
tsem_post(&pMgmt->syncSem);
|
||||||
|
@ -271,6 +271,11 @@ void mndCleanupSync(SMnode *pMnode) {
|
||||||
int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
|
int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
|
||||||
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
|
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
|
||||||
SRpcMsg req = {.msgType = TDMT_MND_APPLY_MSG, .contLen = sdbGetRawTotalSize(pRaw)};
|
SRpcMsg req = {.msgType = TDMT_MND_APPLY_MSG, .contLen = sdbGetRawTotalSize(pRaw)};
|
||||||
|
if (req.contLen <= 0) {
|
||||||
|
terrno = TSDB_CODE_APP_ERROR;
|
||||||
|
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);
|
||||||
|
@ -278,7 +283,7 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
|
||||||
pMgmt->errCode = 0;
|
pMgmt->errCode = 0;
|
||||||
taosWLockLatch(&pMgmt->lock);
|
taosWLockLatch(&pMgmt->lock);
|
||||||
if (pMgmt->transId != 0) {
|
if (pMgmt->transId != 0) {
|
||||||
mError("trans:%d, can't be proposed since trans:%s alrady waiting for confirm", transId, pMgmt->transId);
|
mError("trans:%d, can't be proposed since trans:%d alrady waiting for confirm", transId, pMgmt->transId);
|
||||||
taosWUnLockLatch(&pMgmt->lock);
|
taosWUnLockLatch(&pMgmt->lock);
|
||||||
terrno = TSDB_CODE_APP_NOT_READY;
|
terrno = TSDB_CODE_APP_NOT_READY;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -774,7 +774,7 @@ static int32_t mndRetrieveTopic(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
||||||
SName n;
|
SName n;
|
||||||
int32_t cols = 0;
|
int32_t cols = 0;
|
||||||
|
|
||||||
char topicName[TSDB_TOPIC_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
char topicName[TSDB_TOPIC_NAME_LEN + VARSTR_HEADER_SIZE + 5] = {0};
|
||||||
strcpy(varDataVal(topicName), mndGetDbStr(pTopic->name));
|
strcpy(varDataVal(topicName), mndGetDbStr(pTopic->name));
|
||||||
/*tNameFromString(&n, pTopic->name, T_NAME_ACCT | T_NAME_DB);*/
|
/*tNameFromString(&n, pTopic->name, T_NAME_ACCT | T_NAME_DB);*/
|
||||||
/*tNameGetDbName(&n, varDataVal(topicName));*/
|
/*tNameGetDbName(&n, varDataVal(topicName));*/
|
||||||
|
|
|
@ -427,7 +427,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (terrno != 0) {
|
if (terrno != 0 && pTrans != NULL) {
|
||||||
mError("trans:%d, failed to parse from raw:%p since %s", pTrans->id, pRaw, terrstr());
|
mError("trans:%d, failed to parse from raw:%p since %s", pTrans->id, pRaw, terrstr());
|
||||||
mndTransDropData(pTrans);
|
mndTransDropData(pTrans);
|
||||||
taosMemoryFreeClear(pRow);
|
taosMemoryFreeClear(pRow);
|
||||||
|
@ -629,6 +629,7 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict,
|
||||||
pTrans->pRpcArray == NULL) {
|
pTrans->pRpcArray == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
mError("failed to create transaction since %s", terrstr());
|
mError("failed to create transaction since %s", terrstr());
|
||||||
|
mndTransDrop(pTrans);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1428,6 +1429,7 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) {
|
||||||
SSdbRaw *pRaw = mndTransActionEncode(pTrans);
|
SSdbRaw *pRaw = mndTransActionEncode(pTrans);
|
||||||
if (pRaw == NULL) {
|
if (pRaw == NULL) {
|
||||||
mError("trans:%d, failed to encode while finish trans since %s", pTrans->id, terrstr());
|
mError("trans:%d, failed to encode while finish trans since %s", pTrans->id, terrstr());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
sdbSetRawStatus(pRaw, SDB_STATUS_DROPPED);
|
sdbSetRawStatus(pRaw, SDB_STATUS_DROPPED);
|
||||||
|
|
||||||
|
@ -1617,7 +1619,7 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
||||||
colDataAppend(pColInfo, numOfRows, (const char *)&pTrans->lastExecTime, false);
|
colDataAppend(pColInfo, numOfRows, (const char *)&pTrans->lastExecTime, false);
|
||||||
|
|
||||||
char lastInfo[TSDB_TRANS_ERROR_LEN + VARSTR_HEADER_SIZE] = {0};
|
char lastInfo[TSDB_TRANS_ERROR_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
char detail[TSDB_TRANS_ERROR_LEN] = {0};
|
char detail[TSDB_TRANS_ERROR_LEN + 1] = {0};
|
||||||
int32_t len = snprintf(detail, sizeof(detail), "action:%d code:0x%x(%s) ", pTrans->lastAction,
|
int32_t len = snprintf(detail, sizeof(detail), "action:%d code:0x%x(%s) ", pTrans->lastAction,
|
||||||
pTrans->lastErrorNo & 0xFFFF, tstrerror(pTrans->lastErrorNo));
|
pTrans->lastErrorNo & 0xFFFF, tstrerror(pTrans->lastErrorNo));
|
||||||
SEpSet epset = pTrans->lastEpset;
|
SEpSet epset = pTrans->lastEpset;
|
||||||
|
|
|
@ -83,6 +83,7 @@ static int32_t mndCreateDefaultUser(SMnode *pMnode, char *acct, char *user, char
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL, "create-user");
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL, "create-user");
|
||||||
if (pTrans == NULL) {
|
if (pTrans == NULL) {
|
||||||
|
sdbFreeRaw(pRaw);
|
||||||
mError("user:%s, failed to create since %s", userObj.user, terrstr());
|
mError("user:%s, failed to create since %s", userObj.user, terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1250,7 +1250,7 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb,
|
||||||
mError("db:%s, vgId:%d, no enough memory:%" PRId64 " in dnode:%d avail:%" PRId64 " used:%" PRId64,
|
mError("db:%s, vgId:%d, no enough memory:%" PRId64 " in dnode:%d avail:%" PRId64 " used:%" PRId64,
|
||||||
pVgroup->dbName, pVgroup->vgId, vgMem, pNew1->id, pNew1->memAvail, pNew1->memUsed);
|
pVgroup->dbName, pVgroup->vgId, vgMem, pNew1->id, pNew1->memAvail, pNew1->memUsed);
|
||||||
terrno = TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE;
|
terrno = TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE;
|
||||||
return -1;
|
goto _OVER;
|
||||||
} else {
|
} else {
|
||||||
pNew1->memUsed += vgMem;
|
pNew1->memUsed += vgMem;
|
||||||
}
|
}
|
||||||
|
@ -1272,7 +1272,7 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb,
|
||||||
mError("db:%s, vgId:%d, no enough memory:%" PRId64 " in dnode:%d avail:%" PRId64 " used:%" PRId64,
|
mError("db:%s, vgId:%d, no enough memory:%" PRId64 " in dnode:%d avail:%" PRId64 " used:%" PRId64,
|
||||||
pVgroup->dbName, pVgroup->vgId, vgMem, pNew2->id, pNew2->memAvail, pNew2->memUsed);
|
pVgroup->dbName, pVgroup->vgId, vgMem, pNew2->id, pNew2->memAvail, pNew2->memUsed);
|
||||||
terrno = TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE;
|
terrno = TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE;
|
||||||
return -1;
|
goto _OVER;
|
||||||
} else {
|
} else {
|
||||||
pNew2->memUsed += vgMem;
|
pNew2->memUsed += vgMem;
|
||||||
}
|
}
|
||||||
|
@ -1293,7 +1293,7 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb,
|
||||||
mError("db:%s, vgId:%d, no enough memory:%" PRId64 " in dnode:%d avail:%" PRId64 " used:%" PRId64,
|
mError("db:%s, vgId:%d, no enough memory:%" PRId64 " in dnode:%d avail:%" PRId64 " used:%" PRId64,
|
||||||
pVgroup->dbName, pVgroup->vgId, vgMem, pNew3->id, pNew3->memAvail, pNew3->memUsed);
|
pVgroup->dbName, pVgroup->vgId, vgMem, pNew3->id, pNew3->memAvail, pNew3->memUsed);
|
||||||
terrno = TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE;
|
terrno = TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE;
|
||||||
return -1;
|
goto _OVER;
|
||||||
} else {
|
} else {
|
||||||
pNew3->memUsed += vgMem;
|
pNew3->memUsed += vgMem;
|
||||||
}
|
}
|
||||||
|
@ -1627,7 +1627,7 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj
|
||||||
} else if (newVg1.replica == 3) {
|
} else if (newVg1.replica == 3) {
|
||||||
SVnodeGid del1 = {0};
|
SVnodeGid del1 = {0};
|
||||||
if (mndRemoveVnodeFromVgroup(pMnode, &newVg1, pArray, &del1) != 0) goto _OVER;
|
if (mndRemoveVnodeFromVgroup(pMnode, &newVg1, pArray, &del1) != 0) goto _OVER;
|
||||||
if (mndAddSetVnodeStandByAction(pMnode, pTrans, pDb, pVgroup, &del1, true) != 0) return -1;
|
if (mndAddSetVnodeStandByAction(pMnode, pTrans, pDb, pVgroup, &del1, true) != 0) goto _OVER;
|
||||||
if (mndAddAlterVnodeAction(pMnode, pTrans, pDb, &newVg1, TDMT_VND_ALTER_REPLICA) != 0) goto _OVER;
|
if (mndAddAlterVnodeAction(pMnode, pTrans, pDb, &newVg1, TDMT_VND_ALTER_REPLICA) != 0) goto _OVER;
|
||||||
if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVg1, &del1, true) != 0) goto _OVER;
|
if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVg1, &del1, true) != 0) goto _OVER;
|
||||||
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg1) != 0) goto _OVER;
|
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg1) != 0) goto _OVER;
|
||||||
|
|
|
@ -496,16 +496,16 @@ static int32_t vnodeSyncGetSnapshot(SSyncFSM *pFsm, SSnapshot *pSnapshot) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vnodeSyncReconfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReConfigCbMeta cbMeta) {
|
static void vnodeSyncReconfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReConfigCbMeta *cbMeta) {
|
||||||
SVnode *pVnode = pFsm->data;
|
SVnode *pVnode = pFsm->data;
|
||||||
|
|
||||||
SRpcMsg rpcMsg = {.msgType = pMsg->msgType, .contLen = pMsg->contLen};
|
SRpcMsg rpcMsg = {.msgType = pMsg->msgType, .contLen = pMsg->contLen};
|
||||||
syncGetAndDelRespRpc(pVnode->sync, cbMeta.newCfgSeqNum, &rpcMsg.info);
|
syncGetAndDelRespRpc(pVnode->sync, cbMeta->newCfgSeqNum, &rpcMsg.info);
|
||||||
rpcMsg.info.conn.applyIndex = cbMeta.index;
|
rpcMsg.info.conn.applyIndex = cbMeta->index;
|
||||||
|
|
||||||
const STraceId *trace = (STraceId *)&pMsg->info.traceId;
|
const STraceId *trace = (STraceId *)&pMsg->info.traceId;
|
||||||
vGTrace("vgId:%d, alter vnode replica is confirmed, type:%s contLen:%d seq:%" PRIu64 " handle:%p", TD_VID(pVnode),
|
vGTrace("vgId:%d, alter vnode replica is confirmed, type:%s contLen:%d seq:%" PRIu64 " handle:%p", TD_VID(pVnode),
|
||||||
TMSG_INFO(pMsg->msgType), pMsg->contLen, cbMeta.seqNum, rpcMsg.info.handle);
|
TMSG_INFO(pMsg->msgType), pMsg->contLen, cbMeta->seqNum, rpcMsg.info.handle);
|
||||||
if (rpcMsg.info.handle != NULL) {
|
if (rpcMsg.info.handle != NULL) {
|
||||||
tmsgSendRsp(&rpcMsg);
|
tmsgSendRsp(&rpcMsg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2908,7 +2908,7 @@ static int32_t syncNodeConfigChangeFinish(SSyncNode* ths, SRpcMsg* pRpcMsg, SSyn
|
||||||
cbMeta.newCfgTerm = pFinish->newCfgTerm;
|
cbMeta.newCfgTerm = pFinish->newCfgTerm;
|
||||||
cbMeta.newCfgSeqNum = pFinish->newCfgSeqNum;
|
cbMeta.newCfgSeqNum = pFinish->newCfgSeqNum;
|
||||||
|
|
||||||
ths->pFsm->FpReConfigCb(ths->pFsm, pRpcMsg, cbMeta);
|
ths->pFsm->FpReConfigCb(ths->pFsm, pRpcMsg, &cbMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear changing
|
// clear changing
|
||||||
|
|
|
@ -149,9 +149,9 @@ int32_t SnapshotDoWrite(struct SSyncFSM* pFsm, void* pWriter, void* pBuf, int32_
|
||||||
|
|
||||||
void RestoreFinishCb(struct SSyncFSM* pFsm) { sTrace("==callback== ==RestoreFinishCb=="); }
|
void RestoreFinishCb(struct SSyncFSM* pFsm) { sTrace("==callback== ==RestoreFinishCb=="); }
|
||||||
|
|
||||||
void ReConfigCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SReConfigCbMeta cbMeta) {
|
void ReConfigCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SReConfigCbMeta *cbMeta) {
|
||||||
sTrace("==callback== ==ReConfigCb== flag:0x%lX, index:%" PRId64 ", code:%d, currentTerm:%" PRIu64 ", term:%" PRIu64,
|
sTrace("==callback== ==ReConfigCb== flag:0x%lX, index:%" PRId64 ", code:%d, currentTerm:%" PRIu64 ", term:%" PRIu64,
|
||||||
cbMeta.flag, cbMeta.index, cbMeta.code, cbMeta.currentTerm, cbMeta.term);
|
cbMeta->flag, cbMeta->index, cbMeta->code, cbMeta->currentTerm, cbMeta->term);
|
||||||
}
|
}
|
||||||
|
|
||||||
SSyncFSM* createFsm() {
|
SSyncFSM* createFsm() {
|
||||||
|
|
|
@ -80,9 +80,9 @@ int32_t GetSnapshotCb(struct SSyncFSM* pFsm, SSnapshot* pSnapshot) {
|
||||||
|
|
||||||
void RestoreFinishCb(struct SSyncFSM* pFsm) { sTrace("==callback== ==RestoreFinishCb=="); }
|
void RestoreFinishCb(struct SSyncFSM* pFsm) { sTrace("==callback== ==RestoreFinishCb=="); }
|
||||||
|
|
||||||
void ReConfigCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SReConfigCbMeta cbMeta) {
|
void ReConfigCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SReConfigCbMeta *cbMeta) {
|
||||||
sTrace("==callback== ==ReConfigCb== flag:0x%lX, index:%" PRId64 ", code:%d, currentTerm:%" PRIu64 ", term:%" PRIu64,
|
sTrace("==callback== ==ReConfigCb== flag:0x%lX, index:%" PRId64 ", code:%d, currentTerm:%" PRIu64 ", term:%" PRIu64,
|
||||||
cbMeta.flag, cbMeta.index, cbMeta.code, cbMeta.currentTerm, cbMeta.term);
|
cbMeta->flag, cbMeta->index, cbMeta->code, cbMeta->currentTerm, cbMeta->term);
|
||||||
}
|
}
|
||||||
|
|
||||||
SSyncFSM* createFsm() {
|
SSyncFSM* createFsm() {
|
||||||
|
|
|
@ -153,11 +153,11 @@ int32_t SnapshotDoWrite(struct SSyncFSM* pFsm, void* pWriter, void* pBuf, int32_
|
||||||
|
|
||||||
void RestoreFinishCb(struct SSyncFSM* pFsm) { sTrace("==callback== ==RestoreFinishCb== pFsm:%p", pFsm); }
|
void RestoreFinishCb(struct SSyncFSM* pFsm) { sTrace("==callback== ==RestoreFinishCb== pFsm:%p", pFsm); }
|
||||||
|
|
||||||
void ReConfigCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SReConfigCbMeta cbMeta) {
|
void ReConfigCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SReConfigCbMeta* cbMeta) {
|
||||||
char* s = syncCfg2Str(&(cbMeta.newCfg));
|
char* s = syncCfg2Str(&(cbMeta.newCfg));
|
||||||
sTrace("==callback== ==ReConfigCb== flag:0x%lX, index:%" PRId64 ", code:%d, currentTerm:%" PRIu64 ", term:%" PRIu64
|
sTrace("==callback== ==ReConfigCb== flag:0x%lX, index:%" PRId64 ", code:%d, currentTerm:%" PRIu64 ", term:%" PRIu64
|
||||||
", newCfg:%s",
|
", newCfg:%s",
|
||||||
cbMeta.flag, cbMeta.index, cbMeta.code, cbMeta.currentTerm, cbMeta.term, s);
|
cbMeta->flag, cbMeta->index, cbMeta->code, cbMeta->currentTerm, cbMeta->term, s);
|
||||||
taosMemoryFree(s);
|
taosMemoryFree(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue