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:
parent
5f32b5666a
commit
f079a83fed
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue