From ae5b4980f2a4403bfd22097c2c9a93b5169061bc Mon Sep 17 00:00:00 2001 From: Marian Beermann Date: Thu, 15 Sep 2016 11:23:58 +0200 Subject: [PATCH] Repository.check: improve object count mismatch diagnostic --- src/borg/repository.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/borg/repository.py b/src/borg/repository.py index 6c0159a72..022a8d48b 100644 --- a/src/borg/repository.py +++ b/src/borg/repository.py @@ -687,7 +687,23 @@ class Repository: # current_index = "as found on disk" # self.index = "as rebuilt in-memory from segments" if len(current_index) != len(self.index): - report_error('Index object count mismatch. {} != {}'.format(len(current_index), len(self.index))) + report_error('Index object count mismatch.') + logger.error('committed index: %d objects', len(current_index)) + logger.error('rebuilt index: %d objects', len(self.index)) + + line_format = '%-64s %-16s %-16s' + not_found = '' + logger.warning(line_format, 'ID', 'rebuilt index', 'committed index') + for key, value in self.index.iteritems(): + current_value = current_index.get(key, not_found) + if current_value != value: + logger.warning(line_format, bin_to_hex(key), value, current_value) + for key, current_value in current_index.iteritems(): + if key in self.index: + continue + value = self.index.get(key, not_found) + if current_value != value: + logger.warning(line_format, bin_to_hex(key), value, current_value) elif current_index: for key, value in self.index.iteritems(): if current_index.get(key, (-1, -1)) != value: