Skip to content

Commit

Permalink
fix updating shadow_index also in put
Browse files Browse the repository at this point in the history
The shadow_index should be in same state after both of these sequences
(let's assume that A is not in repo yet for simplicity, but it does not matter):

a) explicit delete: put(A), delete(A), put(A), resulting in: PUT A, DEL A, PUT A repo contents

b) implicit delete: put(A), put(A), resulting in: PUT A, DEL A, PUT A repo contents
  • Loading branch information
ThomasWaldmann committed Jan 29, 2021
1 parent 5f32b56 commit f079a83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/borg/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -1216,11 +1216,11 @@ def delete(self, id, wait=True):
segment, offset = self.index.pop(id)
except KeyError:
raise self.ObjectNotFound(id, self.path) from None
self.shadow_index.setdefault(id, []).append(segment)
self._delete(id, segment, offset)

def _delete(self, id, segment, offset):
# common code used by put and delete
self.shadow_index.setdefault(id, []).append(segment)
self.segments[segment] -= 1
size = self.io.read(segment, offset, id, read_data=False)
self.storage_quota_use -= size
Expand Down

0 comments on commit f079a83

Please sign in to comment.