refact: rename as SYNC_FSM_STATE_COMPLETE

This commit is contained in:
Benguang Zhao 2023-10-18 16:09:51 +08:00
parent a515f8a94f
commit a2e0480839
5 changed files with 6 additions and 6 deletions

View File

@ -87,7 +87,7 @@ typedef enum {
} ESyncRole;
typedef enum {
SYNC_FSM_STATE_NORMAL = 0,
SYNC_FSM_STATE_COMPLETE = 0,
SYNC_FSM_STATE_INCOMPLETE,
} ESyncFsmState;

View File

@ -791,7 +791,7 @@ int32_t vnodeGetSnapshot(SVnode *pVnode, SSnapshot *pSnap) {
pSnap->lastApplyIndex = pVnode->state.committed;
pSnap->lastApplyTerm = pVnode->state.commitTerm;
pSnap->lastConfigIndex = -1;
pSnap->state = SYNC_FSM_STATE_NORMAL;
pSnap->state = SYNC_FSM_STATE_COMPLETE;
if (tsdbSnapGetFsState(pVnode) != TSDB_FS_STATE_NORMAL) {
pSnap->state = SYNC_FSM_STATE_INCOMPLETE;

View File

@ -155,7 +155,7 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
pMsg->vgId, pMsg->prevLogIndex + 1, pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->commitIndex,
pEntry->term);
if (ths->fsmState != SYNC_FSM_STATE_NORMAL) {
if (ths->fsmState == SYNC_FSM_STATE_INCOMPLETE) {
pReply->fsmState = ths->fsmState;
sWarn("vgId:%d, unable to accept, due to incomplete fsm state. index:%" PRId64, ths->vgId, pEntry->index);
syncEntryDestroy(pEntry);

View File

@ -1010,7 +1010,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo, int32_t vnodeVersion) {
sNTrace(pSyncNode, "reset commit index by snapshot");
}
pSyncNode->fsmState = snapshot.state;
if (pSyncNode->fsmState != SYNC_FSM_STATE_NORMAL) {
if (pSyncNode->fsmState == SYNC_FSM_STATE_INCOMPLETE) {
sError("vgId:%d, fsm state is incomplete.", pSyncNode->vgId);
if (pSyncNode->replicaNum == 1) {
goto _error;

View File

@ -840,8 +840,8 @@ int32_t syncLogReplRecover(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEn
}
if (pMsg->fsmState == SYNC_FSM_STATE_INCOMPLETE || (!pMsg->success && pMsg->matchIndex >= pMsg->lastSendIndex)) {
char* msg1 = "rollback match index failure";
char* msg2 = "incomplete fsm state";
char* msg1 = " rollback match index failure";
char* msg2 = " incomplete fsm state";
sInfo("vgId:%d, snapshot replication to dnode:%d. reason:%s, match index:%" PRId64 ", last sent:%" PRId64,
pNode->vgId, DID(&destId), (pMsg->fsmState == SYNC_FSM_STATE_INCOMPLETE ? msg2 : msg1), pMsg->matchIndex,
pMsg->lastSendIndex);