Ver Fonte

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
Thomas Waldmann há 4 anos atrás
pai
commit
f079a83fed
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      src/borg/repository.py

+ 1 - 1
src/borg/repository.py

@@ -1216,11 +1216,11 @@ class Repository:
             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