From 2a15ccf5ac7f158147d65ab6459d46a4424880b2 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Mon, 18 Apr 2022 04:37:00 +0200 Subject: [PATCH] pre12-meta cache: do not use the cache if want_unique is True, fixes #6612 we can't cache usize, it needs to get dynamically calculated. --- src/borg/archive.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/borg/archive.py b/src/borg/archive.py index 0f0c8ffb4..36806b84e 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -650,6 +650,12 @@ Utilization of max. archive size: {csize_max:.0%} # caching wrapper around _calc_stats which is rather slow for archives made with borg < 1.2 have_borg12_meta = self.metadata.get('nfiles') is not None try: + if want_unique: + # usize is neither contained in the borg 1.2 archive metadata nor in the + # pre12_meta cache entry representing the same information for 1.1 archives. + # usize is not a static property of an archive, but must get dynamically calculated, + # thus we must trigger a call to self._calc_stats() to get it. + raise KeyError stats = Statistics.from_raw_dict(**cache.pre12_meta[self.fpr]) except KeyError: # not in pre12_meta cache stats = self._calc_stats(cache, want_unique=want_unique)