Explorar o código

Add an assert for snapshot index invariant.

Jing Yang %!s(int64=4) %!d(string=hai) anos
pai
achega
b7bebd42ab
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      src/apply_command.rs

+ 1 - 0
src/apply_command.rs

@@ -78,6 +78,7 @@ where
                     // Note that between those two nested `if`s, log start is
                     // always smaller than or equal to commit index, as
                     // guaranteed by the SNAPSHOT_INDEX_INVARIANT.
+                    assert!(rf.log.start() <= rf.commit_index);
                     if rf.last_applied < rf.log.start() {
                         let (index_term, data) = rf.log.snapshot();
                         let messages =