Merge pull request #5778 from ThomasWaldmann/missing-chunk-id-master

missing / healed chunks: always tell chunk ID, fixes #5704
This commit is contained in:
TW 2021-04-20 00:43:02 +02:00 committed by GitHub
commit 57abf9a3ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 9 deletions

View File

@ -1734,23 +1734,23 @@ class ArchiveChecker:
if chunk_id not in self.chunks: if chunk_id not in self.chunks:
# a chunk of the healthy list is missing # a chunk of the healthy list is missing
if chunk_current == chunk_healthy: if chunk_current == chunk_healthy:
logger.error('{}: {}: New missing file chunk detected (Byte {}-{}). ' logger.error('{}: {}: New missing file chunk detected (Byte {}-{}, Chunk {}). '
'Replacing with all-zero chunk.'.format( 'Replacing with all-zero chunk.'.format(
archive_name, item.path, offset, offset + size)) archive_name, item.path, offset, offset + size, bin_to_hex(chunk_id)))
self.error_found = chunks_replaced = True self.error_found = chunks_replaced = True
chunk_id, size, csize, cdata = replacement_chunk(size) chunk_id, size, csize, cdata = replacement_chunk(size)
add_reference(chunk_id, size, csize, cdata) add_reference(chunk_id, size, csize, cdata)
else: else:
logger.info('{}: {}: Previously missing file chunk is still missing (Byte {}-{}). It has a ' logger.info('{}: {}: Previously missing file chunk is still missing (Byte {}-{}, Chunk {}). '
'all-zero replacement chunk already.'.format( 'It has an all-zero replacement chunk already.'.format(
archive_name, item.path, offset, offset + size)) archive_name, item.path, offset, offset + size, bin_to_hex(chunk_id)))
chunk_id, size, csize = chunk_current chunk_id, size, csize = chunk_current
if chunk_id in self.chunks: if chunk_id in self.chunks:
add_reference(chunk_id, size, csize) add_reference(chunk_id, size, csize)
else: else:
logger.warning('{}: {}: Missing all-zero replacement chunk detected (Byte {}-{}). ' logger.warning('{}: {}: Missing all-zero replacement chunk detected (Byte {}-{}, Chunk {}). '
'Generating new replacement chunk.'.format( 'Generating new replacement chunk.'.format(
archive_name, item.path, offset, offset + size)) archive_name, item.path, offset, offset + size, bin_to_hex(chunk_id)))
self.error_found = chunks_replaced = True self.error_found = chunks_replaced = True
chunk_id, size, csize, cdata = replacement_chunk(size) chunk_id, size, csize, cdata = replacement_chunk(size)
add_reference(chunk_id, size, csize, cdata) add_reference(chunk_id, size, csize, cdata)
@ -1759,8 +1759,8 @@ class ArchiveChecker:
# normal case, all fine. # normal case, all fine.
add_reference(chunk_id, size, csize) add_reference(chunk_id, size, csize)
else: else:
logger.info('{}: {}: Healed previously missing file chunk! ' logger.info('{}: {}: Healed previously missing file chunk! (Byte {}-{}, Chunk {}).'.format(
'(Byte {}-{}).'.format(archive_name, item.path, offset, offset + size)) archive_name, item.path, offset, offset + size, bin_to_hex(chunk_id)))
add_reference(chunk_id, size, csize) add_reference(chunk_id, size, csize)
mark_as_possibly_superseded(chunk_current[0]) # maybe orphaned the all-zero replacement chunk mark_as_possibly_superseded(chunk_current[0]) # maybe orphaned the all-zero replacement chunk
chunk_list.append([chunk_id, size, csize]) # list-typed element as chunks_healthy is list-of-lists chunk_list.append([chunk_id, size, csize]) # list-typed element as chunks_healthy is list-of-lists