mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 01:06:50 +00:00
Merge pull request #5016 from ThomasWaldmann/improve-repo-check-output-master
Improve repo check output (master)
This commit is contained in:
commit
547f39fe45
1 changed files with 14 additions and 18 deletions
|
@ -1022,24 +1022,20 @@ def report_error(msg):
|
||||||
report_error('Index object count mismatch.')
|
report_error('Index object count mismatch.')
|
||||||
logger.error('committed index: %d objects', len(current_index))
|
logger.error('committed index: %d objects', len(current_index))
|
||||||
logger.error('rebuilt index: %d objects', len(self.index))
|
logger.error('rebuilt index: %d objects', len(self.index))
|
||||||
|
else:
|
||||||
line_format = '%-64s %-16s %-16s'
|
logger.info('Index object count match.')
|
||||||
not_found = '<not found>'
|
line_format = 'ID: %-64s rebuilt index: %-16s committed index: %-16s'
|
||||||
logger.warning(line_format, 'ID', 'rebuilt index', 'committed index')
|
not_found = '<not found>'
|
||||||
for key, value in self.index.iteritems():
|
for key, value in self.index.iteritems():
|
||||||
current_value = current_index.get(key, not_found)
|
current_value = current_index.get(key, not_found)
|
||||||
if current_value != value:
|
if current_value != value:
|
||||||
logger.warning(line_format, bin_to_hex(key), value, current_value)
|
logger.warning(line_format, bin_to_hex(key), value, current_value)
|
||||||
for key, current_value in current_index.iteritems():
|
for key, current_value in current_index.iteritems():
|
||||||
if key in self.index:
|
if key in self.index:
|
||||||
continue
|
continue
|
||||||
value = self.index.get(key, not_found)
|
value = self.index.get(key, not_found)
|
||||||
if current_value != value:
|
if current_value != value:
|
||||||
logger.warning(line_format, bin_to_hex(key), value, current_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:
|
|
||||||
report_error('Index mismatch for key {}. {} != {}'.format(key, value, current_index.get(key, (-1, -1))))
|
|
||||||
if repair:
|
if repair:
|
||||||
self.write_index()
|
self.write_index()
|
||||||
self.rollback()
|
self.rollback()
|
||||||
|
|
Loading…
Reference in a new issue