Skip to content

Commit bd8f53e

Browse files
cache sync: log per-archive messages at debug level, fixes #9659
The chunks cache sync emitted 2 INFO lines per archive: - warm chunks.archive.d (the usual case): "Reading cached archive chunk index for <name> ..." plus "Merging into master chunks index ..." - cache rebuild: "Fetching and building archive index for <name> ..." plus "Merging into master chunks index ..." On repositories with many archives this floods the output of anybody running with -v / --info, without telling them much - "Merging into master chunks index ..." does not even name the archive. Log these at debug level, so --info now only shows the summary: Synchronizing chunks cache... Archives: %d, w/ cached Idx: %d, w/ outdated Idx: %d, w/o cached Idx: %d. Done. Per-archive feedback for interactive use is still available via --progress (the cache.sync progress indicator names each archive), and borg 2 already logs all of this at debug level.
1 parent 651230e commit bd8f53e

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎src/borg/cache.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ def write_archive_index(archive_id, chunk_idx):
801801

802802
def read_archive_index(archive_id, archive_name):
803803
archive_chunk_idx_path = mkpath(archive_id)
804-
logger.info("Reading cached archive chunk index for %s ...", archive_name)
804+
logger.debug("Reading cached archive chunk index for %s ...", archive_name)
805805
try:
806806
try:
807807
# Attempt to load compact index first
@@ -869,14 +869,14 @@ def create_master_idx(chunk_idx):
869869
if archive_id not in cached_ids:
870870
# Do not make this an else branch; the FileIntegrityError exception handler
871871
# above can remove *archive_id* from *cached_ids*.
872-
logger.info('Fetching and building archive index for %s ...', archive_name)
872+
logger.debug('Fetching and building archive index for %s ...', archive_name)
873873
archive_chunk_idx = ChunkIndex()
874874
fetch_and_build_idx(archive_id, decrypted_repository, archive_chunk_idx)
875-
logger.info("Merging into master chunks index ...")
875+
logger.debug("Merging into master chunks index ...")
876876
chunk_idx.merge(archive_chunk_idx)
877877
else:
878878
chunk_idx = chunk_idx or ChunkIndex(usable=master_index_capacity)
879-
logger.info('Fetching archive index for %s ...', archive_name)
879+
logger.debug('Fetching archive index for %s ...', archive_name)
880880
fetch_and_build_idx(archive_id, decrypted_repository, chunk_idx)
881881
if not self.do_cache:
882882
fetch_missing_csize(chunk_idx)

‎src/borg/testsuite/archiver.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5112,7 +5112,7 @@ def test_chunks_archive(self):
51125112
config.write(fd)
51135113

51145114
# Cache sync notices corrupted archive chunks, but automatically recovers.
5115-
out = self.cmd('create', '-v', self.repository_location + '::test3', 'input', exit_code=1)
5115+
out = self.cmd('create', '--debug', self.repository_location + '::test3', 'input', exit_code=1)
51165116
assert 'Reading cached archive chunk index for test1' in out
51175117
assert 'Cached archive chunk index of test1 is corrupted' in out
51185118
assert 'Fetching and building archive index for test1' in out

0 commit comments

Comments
 (0)