mirror of https://github.com/borgbackup/borg.git
Repository: don't use defaultdict for shadow index
avoids errors by accidentally inserting an empty list and makes it more clear.
This commit is contained in:
parent
833f8d1373
commit
26e8ff2cbc
|
@ -113,10 +113,9 @@ class Repository:
|
||||||
self.index = None
|
self.index = None
|
||||||
# This is an index of shadowed log entries during this transaction. Consider the following sequence:
|
# This is an index of shadowed log entries during this transaction. Consider the following sequence:
|
||||||
# segment_n PUT A, segment_x DELETE A
|
# segment_n PUT A, segment_x DELETE A
|
||||||
# After the "DELETE A" in segment_x the shadow index will contain "A -> (n,)".
|
# After the "DELETE A" in segment_x the shadow index will contain "A -> [n]".
|
||||||
self.shadow_index = defaultdict(list)
|
self.shadow_index = {}
|
||||||
self._active_txn = False
|
self._active_txn = False
|
||||||
|
|
||||||
self.lock_wait = lock_wait
|
self.lock_wait = lock_wait
|
||||||
self.do_lock = lock
|
self.do_lock = lock
|
||||||
self.do_create = create
|
self.do_create = create
|
||||||
|
@ -741,7 +740,7 @@ class Repository:
|
||||||
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[id].append(segment)
|
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.compact[segment] += size
|
self.compact[segment] += size
|
||||||
|
|
Loading…
Reference in New Issue