瀏覽代碼

Remove a trigger condition of log_grow.

The snapshot index never goes backwards either, just like log start.
So it is always larger or equal to (>=) log start.

The trigger condition always holds. That does not mean we should
always trigger. On the contrary, it means the target situation the
condition is trying to address is impossible.
Jing Yang 4 年之前
父節點
當前提交
088e7f60bd
共有 1 個文件被更改,包括 1 次插入5 次删除
  1. 1 5
      src/snapshot.rs

+ 1 - 5
src/snapshot.rs

@@ -41,11 +41,7 @@ impl SnapshotDaemon {
     const MIN_SNAPSHOT_INDEX_INTERVAL: usize = 100;
 
     pub(crate) fn log_grow(&self, first_index: Index, last_index: Index) {
-        let last_included_index =
-            self.current_snapshot.0.lock().last_included_index;
-        if last_included_index > first_index
-            || last_index - first_index > Self::MIN_SNAPSHOT_INDEX_INTERVAL
-        {
+        if last_index - first_index > Self::MIN_SNAPSHOT_INDEX_INTERVAL {
             self.trigger();
         }
     }