|
@@ -193,13 +193,6 @@ impl<Command: ReplicableCommand> Raft<Command> {
|
|
|
Ok(SyncLogEntriesResult::Success) => {
|
|
Ok(SyncLogEntriesResult::Success) => {
|
|
|
let mut rf = rf.lock();
|
|
let mut rf = rf.lock();
|
|
|
|
|
|
|
|
- check_or_record!(
|
|
|
|
|
- match_index < rf.log.end(),
|
|
|
|
|
- ErrorKind::LeaderLogShrunk(match_index),
|
|
|
|
|
- "The leader log shrunk",
|
|
|
|
|
- &rf
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
if !rf.is_leader() {
|
|
if !rf.is_leader() {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -208,6 +201,13 @@ impl<Command: ReplicableCommand> Raft<Command> {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ check_or_record!(
|
|
|
|
|
+ match_index < rf.log.end(),
|
|
|
|
|
+ ErrorKind::LeaderLogShrunk(match_index),
|
|
|
|
|
+ "The leader log shrunk",
|
|
|
|
|
+ &rf
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
rf.next_index[peer_index] = match_index + 1;
|
|
rf.next_index[peer_index] = match_index + 1;
|
|
|
rf.current_step[peer_index] = 0;
|
|
rf.current_step[peer_index] = 0;
|
|
|
if match_index > rf.match_index[peer_index] {
|
|
if match_index > rf.match_index[peer_index] {
|