From bd8f53ee42920c567b3eee3e7f0d9331ed91bba5 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Thu, 27 Aug 2026 10:42:20 +0200 Subject: [PATCH] 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 ..." plus "Merging into master chunks index ..." - cache rebuild: "Fetching and building archive index for ..." 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. --- src/borg/cache.py | 8 ++++---- src/borg/testsuite/archiver.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/borg/cache.py b/src/borg/cache.py index 54874ecc81..ff7575ce14 100644 --- a/src/borg/cache.py +++ b/src/borg/cache.py @@ -801,7 +801,7 @@ def write_archive_index(archive_id, chunk_idx): def read_archive_index(archive_id, archive_name): archive_chunk_idx_path = mkpath(archive_id) - logger.info("Reading cached archive chunk index for %s ...", archive_name) + logger.debug("Reading cached archive chunk index for %s ...", archive_name) try: try: # Attempt to load compact index first @@ -869,14 +869,14 @@ def create_master_idx(chunk_idx): if archive_id not in cached_ids: # Do not make this an else branch; the FileIntegrityError exception handler # above can remove *archive_id* from *cached_ids*. - logger.info('Fetching and building archive index for %s ...', archive_name) + logger.debug('Fetching and building archive index for %s ...', archive_name) archive_chunk_idx = ChunkIndex() fetch_and_build_idx(archive_id, decrypted_repository, archive_chunk_idx) - logger.info("Merging into master chunks index ...") + logger.debug("Merging into master chunks index ...") chunk_idx.merge(archive_chunk_idx) else: chunk_idx = chunk_idx or ChunkIndex(usable=master_index_capacity) - logger.info('Fetching archive index for %s ...', archive_name) + logger.debug('Fetching archive index for %s ...', archive_name) fetch_and_build_idx(archive_id, decrypted_repository, chunk_idx) if not self.do_cache: fetch_missing_csize(chunk_idx) diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py index 49a69a1dc9..6102b8419d 100644 --- a/src/borg/testsuite/archiver.py +++ b/src/borg/testsuite/archiver.py @@ -5112,7 +5112,7 @@ def test_chunks_archive(self): config.write(fd) # Cache sync notices corrupted archive chunks, but automatically recovers. - out = self.cmd('create', '-v', self.repository_location + '::test3', 'input', exit_code=1) + out = self.cmd('create', '--debug', self.repository_location + '::test3', 'input', exit_code=1) assert 'Reading cached archive chunk index for test1' in out assert 'Cached archive chunk index of test1 is corrupted' in out assert 'Fetching and building archive index for test1' in out