From 7dad4a69929489de90089c48d10ccd374b1f8be4 Mon Sep 17 00:00:00 2001 From: Dan Christensen Date: Tue, 17 Jan 2023 15:21:18 -0500 Subject: [PATCH 1/3] cache.py: be less verbose during cache sync --- src/borg/cache.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/borg/cache.py b/src/borg/cache.py index 90ded1e40..f9bcddb8d 100644 --- a/src/borg/cache.py +++ b/src/borg/cache.py @@ -797,7 +797,7 @@ class LocalCache(CacheStatsMixin): 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.info("Reading cached archive chunk index for %s", archive_name) try: try: # Attempt to load compact index first @@ -837,13 +837,12 @@ class LocalCache(CacheStatsMixin): return archive_names def create_master_idx(chunk_idx): - logger.info("Synchronizing chunks cache...") + logger.debug("Synchronizing chunks cache...") cached_ids = cached_archives() archive_ids = repo_archives() logger.info( - "Archives: %d, w/ cached Idx: %d, w/ outdated Idx: %d, w/o cached Idx: %d.", - len(archive_ids), - len(cached_ids), + "Cached archive chunk indexes: %d fresh, %d stale, %d need fetching.", + len(archive_ids & cached_ids), len(cached_ids - archive_ids), len(archive_ids - cached_ids), ) @@ -872,14 +871,14 @@ class LocalCache(CacheStatsMixin): 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.info("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.info("Fetching archive index for %s", archive_name) fetch_and_build_idx(archive_id, decrypted_repository, chunk_idx) pi.finish() logger.debug( @@ -891,7 +890,7 @@ class LocalCache(CacheStatsMixin): "Cache sync: compact chunks.archive.d storage saved %s bytes", format_file_size(compact_chunks_archive_saved_space), ) - logger.info("Done.") + logger.debug("Cache sync done.") return chunk_idx # The cache can be used by a command that e.g. only checks against Manifest.Operation.WRITE, From 6f7bc8962714731c3225e22a8f9c62aedd8e745d Mon Sep 17 00:00:00 2001 From: Dan Christensen Date: Wed, 18 Jan 2023 16:59:44 -0500 Subject: [PATCH 2/3] cache.py: minor updates to output --- src/borg/cache.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/borg/cache.py b/src/borg/cache.py index f9bcddb8d..1cae43939 100644 --- a/src/borg/cache.py +++ b/src/borg/cache.py @@ -837,7 +837,7 @@ class LocalCache(CacheStatsMixin): return archive_names def create_master_idx(chunk_idx): - logger.debug("Synchronizing chunks cache...") + logger.debug("Synchronizing chunks index...") cached_ids = cached_archives() archive_ids = repo_archives() logger.info( @@ -857,7 +857,7 @@ class LocalCache(CacheStatsMixin): pi = ProgressIndicatorPercent( total=len(archive_ids), step=0.1, - msg="%3.0f%% Syncing chunks cache. Processing archive %s", + msg="%3.0f%% Syncing chunks index. Processing archive %s.", msgid="cache.sync", ) archive_ids_to_names = get_archive_ids_to_names(archive_ids) @@ -871,26 +871,26 @@ class LocalCache(CacheStatsMixin): 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.info("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.debug("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.info("Fetching archive index for %s.", archive_name) fetch_and_build_idx(archive_id, decrypted_repository, chunk_idx) pi.finish() logger.debug( - "Cache sync: processed %s (%d chunks) of metadata", + "Cache index sync: processed %s (%d chunks) of metadata.", format_file_size(processed_item_metadata_bytes), processed_item_metadata_chunks, ) logger.debug( - "Cache sync: compact chunks.archive.d storage saved %s bytes", + "Cache index sync: compact chunks.archive.d storage saved %s bytes.", format_file_size(compact_chunks_archive_saved_space), ) - logger.debug("Cache sync done.") + logger.debug("Cache index sync done.") return chunk_idx # The cache can be used by a command that e.g. only checks against Manifest.Operation.WRITE, From 530bd4c2989f05c2f9b72522df869f03d294f714 Mon Sep 17 00:00:00 2001 From: Dan Christensen Date: Wed, 18 Jan 2023 19:51:01 -0500 Subject: [PATCH 3/3] cache.py: consistenly use "chunks index" --- src/borg/cache.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/borg/cache.py b/src/borg/cache.py index 1cae43939..ebd81cb7a 100644 --- a/src/borg/cache.py +++ b/src/borg/cache.py @@ -882,15 +882,15 @@ class LocalCache(CacheStatsMixin): fetch_and_build_idx(archive_id, decrypted_repository, chunk_idx) pi.finish() logger.debug( - "Cache index sync: processed %s (%d chunks) of metadata.", + "Chunks index sync: processed %s (%d chunks) of metadata.", format_file_size(processed_item_metadata_bytes), processed_item_metadata_chunks, ) logger.debug( - "Cache index sync: compact chunks.archive.d storage saved %s bytes.", + "Chunks index sync: compact chunks.archive.d storage saved %s bytes.", format_file_size(compact_chunks_archive_saved_space), ) - logger.debug("Cache index sync done.") + logger.debug("Chunks index sync done.") return chunk_idx # The cache can be used by a command that e.g. only checks against Manifest.Operation.WRITE,