Преглед на файлове

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();
         }
     }