Pārlūkot izejas kodu

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 gadi atpakaļ
vecāks
revīzija
088e7f60bd
1 mainītis faili ar 1 papildinājumiem un 5 dzēšanām
  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();
         }
     }