2
0
Эх сурвалжийг харах

AdHocCache: fix size not propagating to incref

Marian Beermann 8 жил өмнө
parent
commit
fc7c560345
1 өөрчлөгдсөн 4 нэмэгдсэн , 4 устгасан
  1. 4 4
      src/borg/cache.py

+ 4 - 4
src/borg/cache.py

@@ -974,7 +974,7 @@ Chunk index:    {0.total_unique_chunks:20d}             unknown"""
         size = len(chunk)
         refcount = self.seen_chunk(id, size)
         if refcount:
-            return self.chunk_incref(id, stats)
+            return self.chunk_incref(id, stats, size_=size)
         data = self.key.encrypt(chunk)
         csize = len(data)
         self.repository.put(id, data, wait=wait)
@@ -985,12 +985,12 @@ Chunk index:    {0.total_unique_chunks:20d}             unknown"""
     def seen_chunk(self, id, size=None):
         return self.chunks.get(id, ChunkIndexEntry(0, None, None)).refcount
 
-    def chunk_incref(self, id, stats):
+    def chunk_incref(self, id, stats, size_=None):
         if not self._txn_active:
             self._begin_txn()
         count, size, csize = self.chunks.incref(id)
-        stats.update(size, csize, False)
-        return ChunkListEntry(id, size, csize)
+        stats.update(size or size_, csize, False)
+        return ChunkListEntry(id, size or size_, csize)
 
     def chunk_decref(self, id, stats, wait=True):
         if not self._txn_active: