1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 17:57:59 +00:00

fix updating shadow_index also in put

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
This commit is contained in:
Thomas Waldmann 2021-01-18 21:26:01 +01:00
parent 5f32b5666a
commit f079a83fed

View file

@ -1216,11 +1216,11 @@ def delete(self, id, wait=True):
segment, offset = self.index.pop(id) segment, offset = self.index.pop(id)
except KeyError: except KeyError:
raise self.ObjectNotFound(id, self.path) from None raise self.ObjectNotFound(id, self.path) from None
self.shadow_index.setdefault(id, []).append(segment)
self._delete(id, segment, offset) self._delete(id, segment, offset)
def _delete(self, id, segment, offset): def _delete(self, id, segment, offset):
# common code used by put and delete # common code used by put and delete
self.shadow_index.setdefault(id, []).append(segment)
self.segments[segment] -= 1 self.segments[segment] -= 1
size = self.io.read(segment, offset, id, read_data=False) size = self.io.read(segment, offset, id, read_data=False)
self.storage_quota_use -= size self.storage_quota_use -= size