1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-27 18:28:42 +00:00

AdHocCache: fix size not propagating to incref

This commit is contained in:
Marian Beermann 2017-06-10 19:17:17 +02:00
parent 8aa745ddbd
commit fc7c560345

View file

@ -974,7 +974,7 @@ def add_chunk(self, id, chunk, stats, overwrite=False, wait=True):
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 @@ def add_chunk(self, id, chunk, stats, overwrite=False, wait=True):
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: