浏览代码

Add a comment about SNAPSHOT_INDEX_INVARIANT.

Jing Yang 4 年之前
父节点
当前提交
132bb388db
共有 1 个文件被更改,包括 3 次插入0 次删除
  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 =