Pārlūkot izejas kodu

Refuse to append entries when the RPC is inconsistent.

Jing Yang 4 gadi atpakaļ
vecāks
revīzija
c57b6dd644
1 mainītis faili ar 6 papildinājumiem un 0 dzēšanām
  1. 6 0
      src/process_append_entries.rs

+ 6 - 0
src/process_append_entries.rs

@@ -67,6 +67,12 @@ where
                 "Entries in AppendEntries request shows index mismatch",
                 &rf
             );
+
+            return AppendEntriesReply {
+                term: args.term,
+                success: false,
+                committed: Some(rf.log.first_after(rf.commit_index).into()),
+            };
         }
 
         // COMMIT_INDEX_INVARIANT: Before this loop, we can safely assume that