Browse Source

compress_entry: fix assertion failure

if the size is not known yet in the chunks index, we must update the value there.
Thomas Waldmann 10 tháng trước cách đây
mục cha
commit
0545b6a2eb
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  1. 4 1
      src/borg/cache.py

+ 4 - 1
src/borg/cache.py

@@ -397,7 +397,10 @@ class FilesCacheMixin:
             cie = self.chunks.get(id)
             assert cie is not None
             assert cie.flags & ChunkIndex.F_USED
-            assert size == cie.size
+            if cie.size == 0:  # size is not known in the chunks index yet
+                self.chunks[id] = cie._replace(size=size)
+            else:
+                assert size == cie.size, f"{size} != {cie.size}"
             idx = self.chunks.k_to_idx(id)
             compressed_chunks.append(idx)
         entry = entry._replace(chunks=compressed_chunks)