From ef19d937ed09885b1c545cf179478053f7d3b93d Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Fri, 8 Jan 2021 19:29:29 +0100 Subject: [PATCH] use cached_hash also to generate all-zero replacement chunks at least for major amounts of fixed-size replacement hashes, this will be much faster. also less memory management overhead. --- src/borg/archive.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/borg/archive.py b/src/borg/archive.py index 9ac37e7f1..b023a9cac 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -1662,8 +1662,8 @@ def verify_file_chunks(archive_name, item): If a previously missing file chunk re-appears, the replacement chunk is replaced by the correct one. """ def replacement_chunk(size): - data = bytes(size) - chunk_id = self.key.id_hash(data) + chunk = Chunk(None, allocation=CH_ALLOC, size=size) + chunk_id, data = cached_hash(chunk, self.key.id_hash) cdata = self.key.encrypt(data) csize = len(cdata) return chunk_id, size, csize, cdata