From 999f0ae187481110609c4d693d58c8cd4b04debb Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Thu, 28 Jul 2016 17:55:40 +0200 Subject: [PATCH] fix chunk refcounts considering part files --- src/borg/archive.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/borg/archive.py b/src/borg/archive.py index 49e68a401..13f596c33 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -729,9 +729,6 @@ Number of files: {0.stats.nfiles}'''.format( number += 1 self.add_item(item, show_progress=False) self.write_checkpoint() - # we have saved the part file, but we will reference the same chunks also from the final, complete file: - for chunk in item.chunks: - cache.chunk_incref(chunk.id, stats) return length, number item.chunks = [] @@ -745,12 +742,18 @@ Number of files: {0.stats.nfiles}'''.format( from_chunk, part_number = write_part(item, from_chunk, part_number) self.last_checkpoint = time.time() else: - if part_number > 1 and item.chunks[from_chunk:]: - # if we already have created a part item inside this file, we want to put the final - # chunks (if any) into a part item also (so all parts can be concatenated to get - # the complete file): - from_chunk, part_number = write_part(item, from_chunk, part_number) - self.last_checkpoint = time.time() + if part_number > 1: + if item.chunks[from_chunk:]: + # if we already have created a part item inside this file, we want to put the final + # chunks (if any) into a part item also (so all parts can be concatenated to get + # the complete file): + from_chunk, part_number = write_part(item, from_chunk, part_number) + self.last_checkpoint = time.time() + + # if we created part files, we have referenced all chunks from the part files, + # but we also will reference the same chunks also from the final, complete file: + for chunk in item.chunks: + cache.chunk_incref(chunk.id, stats) def process_stdin(self, path, cache): uid, gid = 0, 0