소스 검색

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