diff options
author | Marian Beermann <public@enkore.de> | 2016-08-16 12:45:33 +0200 |
---|---|---|
committer | Marian Beermann <public@enkore.de> | 2016-08-17 01:17:49 +0200 |
commit | 26e8ff2cbc449bc49bc5e3bad3d51e8c757cc763 (patch) | |
tree | 1d8a5a56399786762217760e1886a126a0c628c8 /src | |
parent | 833f8d1373f5a6086ce66ccc2d443b587cbb0290 (diff) |
Repository: don't use defaultdict for shadow index
avoids errors by accidentally inserting an empty list and makes it more clear.
Diffstat (limited to 'src')
-rw-r--r-- | src/borg/repository.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/borg/repository.py b/src/borg/repository.py index 097c64bcd..a095ca7c8 100644 --- a/src/borg/repository.py +++ b/src/borg/repository.py @@ -113,10 +113,9 @@ class Repository: self.index = None # This is an index of shadowed log entries during this transaction. Consider the following sequence: # segment_n PUT A, segment_x DELETE A - # After the "DELETE A" in segment_x the shadow index will contain "A -> (n,)". - self.shadow_index = defaultdict(list) + # After the "DELETE A" in segment_x the shadow index will contain "A -> [n]". + self.shadow_index = {} self._active_txn = False - self.lock_wait = lock_wait self.do_lock = lock self.do_create = create @@ -741,7 +740,7 @@ class Repository: segment, offset = self.index.pop(id) except KeyError: raise self.ObjectNotFound(id, self.path) from None - self.shadow_index[id].append(segment) + self.shadow_index.setdefault(id, []).append(segment) self.segments[segment] -= 1 size = self.io.read(segment, offset, id, read_data=False) self.compact[segment] += size |