fix(sync): sending snapshot
This commit is contained in:
parent
6b329f791b
commit
84a67e850e
|
@ -91,6 +91,7 @@ typedef struct SSnapshot {
|
|||
void* data;
|
||||
SyncIndex lastApplyIndex;
|
||||
SyncTerm lastApplyTerm;
|
||||
SyncIndex lastConfigIndex;
|
||||
} SSnapshot;
|
||||
|
||||
typedef struct SSyncFSM {
|
||||
|
|
|
@ -438,9 +438,12 @@ static bool syncNodeOnAppendEntriesLogOK(SSyncNode* pSyncNode, SyncAppendEntries
|
|||
return true;
|
||||
}
|
||||
|
||||
SyncTerm myPreLogTerm = syncNodeGetPreTerm(pSyncNode, pMsg->prevLogIndex + 1);
|
||||
SyncIndex myLastIndex = syncNodeGetLastIndex(pSyncNode);
|
||||
if (pMsg->prevLogIndex > myLastIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SyncTerm myPreLogTerm = syncNodeGetPreTerm(pSyncNode, pMsg->prevLogIndex + 1);
|
||||
if (pMsg->prevLogIndex <= myLastIndex && pMsg->prevLogTerm == myPreLogTerm) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ static int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index,
|
|||
|
||||
} else {
|
||||
// index not in range
|
||||
code = -2;
|
||||
code = 0;
|
||||
}
|
||||
|
||||
return code;
|
||||
|
|
Loading…
Reference in New Issue