From b07899115756942c98906070302f473cd41edb9b Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 29 Oct 2017 11:25:11 +0100 Subject: [PATCH] get rid of already existing invalid chunks_healthy metadata, see #3218 (cherry picked from commit 90186ad12b7f67ebca56250cafbe7d8b3f6ac628) --- src/borg/archive.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/borg/archive.py b/src/borg/archive.py index 1c8a1332e..e0f6ddb3b 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -1378,7 +1378,12 @@ def replacement_chunk(size): has_chunks_healthy = 'chunks_healthy' in item chunks_current = item.chunks chunks_healthy = item.chunks_healthy if has_chunks_healthy else chunks_current - assert len(chunks_current) == len(chunks_healthy) + if has_chunks_healthy and len(chunks_current) != len(chunks_healthy): + # should never happen, but there was issue #3218. + logger.warning('{}: Invalid chunks_healthy metadata removed!'.format(item.path)) + del item.chunks_healthy + has_chunks_healthy = False + chunks_healthy = chunks_current for chunk_current, chunk_healthy in zip(chunks_current, chunks_healthy): chunk_id, size, csize = chunk_healthy if chunk_id not in self.chunks: