Skip to content

Commit

Permalink
check --repair: recreate shadow index, see #6687
Browse files Browse the repository at this point in the history
before this fix, borg check --repair just created an
empty shadow index, which can lead to incomplete
entries if entries are added later.

and such incomplete (but present) entries can lead to
compact_segment() resurrecting old PUTs by accidentally
dropping related DELs.
  • Loading branch information
ThomasWaldmann committed Oct 28, 2023
1 parent 48feb28 commit 096e704
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/borg/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,7 @@ def _update_index(self, segment, objects, report=None):
s, _ = self.index[key]
self.compact[s] += size
self.segments[s] -= 1
self.shadow_index.setdefault(key, []).append(s)
except KeyError:
pass
self.index[key] = segment, offset
Expand All @@ -935,6 +936,7 @@ def _update_index(self, segment, objects, report=None):
self.segments[s] -= 1
size = self.io.read(s, offset, key, read_data=False)
self.compact[s] += size
self.shadow_index.setdefault(key, []).append(s)
elif tag == TAG_COMMIT:
continue
else:
Expand Down

0 comments on commit 096e704

Please sign in to comment.