Explorar o código

Add a comment about SNAPSHOT_INDEX_INVARIANT.

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

+ 3 - 0
src/apply_command.rs

@@ -75,6 +75,9 @@ where
                             Duration::from_millis(HEARTBEAT_INTERVAL_MILLIS),
                         );
                     }
+                    // 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.
                     if rf.last_applied < rf.log.start() {
                         let (index_term, data) = rf.log.snapshot();
                         let messages =