1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-21 21:57:36 +00:00

ignore corrupt files cache, fixes #2939

ignore the files cache when corrupt and emit a warning message
so the users notices that there is a problem.

(cherry picked from commit 5beaa5bd02)
This commit is contained in:
Thomas Waldmann 2017-08-16 01:52:33 +02:00
parent 5a7825f090
commit 4eadb59c10

View file

@ -503,10 +503,16 @@ def _read_files(self):
if not data:
break
u.feed(data)
for path_hash, item in u:
entry = FileCacheEntry(*item)
# in the end, this takes about 240 Bytes per file
self.files[path_hash] = msgpack.packb(entry._replace(age=entry.age + 1))
try:
for path_hash, item in u:
entry = FileCacheEntry(*item)
# in the end, this takes about 240 Bytes per file
self.files[path_hash] = msgpack.packb(entry._replace(age=entry.age + 1))
except (TypeError, ValueError) as exc:
logger.warning('The files cache seems corrupt, ignoring it. '
'Expect lower performance. [%s]' % str(exc))
self.files = {}
return
def begin_txn(self):
# Initialize transaction snapshot