Pārlūkot izejas kodu

Add a comment about SNAPSHOT_INDEX_INVARIANT.

Jing Yang 4 gadi atpakaļ
vecāks
revīzija
132bb388db
1 mainītis faili ar 3 papildinājumiem un 0 dzēšanām
  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 =