Browse Source

Add a comment about SNAPSHOT_INDEX_INVARIANT.

Jing Yang 4 năm trước cách đây
mục cha
commit
132bb388db
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  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 =