浏览代码

Merge pull request #7904 from ThomasWaldmann/fix-shadow-index2-1.2

shadow index: add more comments
TW 1 年之前
父节点
当前提交
21d67b8295
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/borg/repository.py

+ 3 - 0
src/borg/repository.py

@@ -170,6 +170,9 @@ class Repository:
         # segment_n PUT A, segment_x DELETE A
         # segment_n PUT A, segment_x DELETE A
         # After the "DELETE A" in segment_x the shadow index will contain "A -> [n]".
         # After the "DELETE A" in segment_x the shadow index will contain "A -> [n]".
         # .delete() is updating this index, it is persisted into "hints" file and is later used by .compact_segments().
         # .delete() is updating this index, it is persisted into "hints" file and is later used by .compact_segments().
+        # We need the entries in the shadow_index to not accidentally drop the "DELETE A" when we compact segment_x
+        # only (and we do not compact segment_n), because DELETE A is still needed then because PUT A will be still
+        # there. Otherwise chunk A would reappear although it was previously deleted.
         self.shadow_index = {}
         self.shadow_index = {}
         self._active_txn = False
         self._active_txn = False
         self.lock_wait = lock_wait
         self.lock_wait = lock_wait