diff --git a/src/borg/archiver/compact_cmd.py b/src/borg/archiver/compact_cmd.py index 8f529d544..b854b12c3 100644 --- a/src/borg/archiver/compact_cmd.py +++ b/src/borg/archiver/compact_cmd.py @@ -65,7 +65,7 @@ def save_chunk_index(self): # as we put the wrong size in there, we need to clean up the size: self.chunks[id] = ChunkIndexEntry(refcount=ChunkIndex.MAX_VALUE, size=0) # now self.chunks is an uptodate ChunkIndex, usable for general borg usage! - write_chunkindex_to_repo_cache(self.repository, self.chunks, compact=True, clear=True, force_write=True) + write_chunkindex_to_repo_cache(self.repository, self.chunks, clear=True, force_write=True) self.chunks = None # nothing there (cleared!) def analyze_archives(self) -> Tuple[Set, Set, int, int, int]: diff --git a/src/borg/cache.py b/src/borg/cache.py index 2f2c81e24..0390f9e07 100644 --- a/src/borg/cache.py +++ b/src/borg/cache.py @@ -630,11 +630,8 @@ def load_chunks_hash(repository) -> bytes: return hash -def write_chunkindex_to_repo_cache(repository, chunks, *, compact=False, clear=False, force_write=False): +def write_chunkindex_to_repo_cache(repository, chunks, *, clear=False, force_write=False): cached_hash = load_chunks_hash(repository) - if compact: - # if we don't need the in-memory chunks index anymore: - chunks.compact() # vacuum the hash table with io.BytesIO() as f: chunks.write(f) data = f.getvalue() @@ -698,7 +695,7 @@ def build_chunkindex_from_repo(repository, *, disable_caches=False, cache_immedi logger.debug(f"queried {num_chunks} chunk IDs in {duration} s, ~{speed}/s") if cache_immediately: # immediately update cache/chunks, so we only rarely have to do it the slow way: - write_chunkindex_to_repo_cache(repository, chunks, compact=False, clear=False, force_write=True) + write_chunkindex_to_repo_cache(repository, chunks, clear=False, force_write=True) return chunks @@ -770,8 +767,8 @@ def add_chunk( return ChunkListEntry(id, size) def _write_chunks_cache(self, chunks): - # this is called from .close, so we can clear/compact here: - write_chunkindex_to_repo_cache(self.repository, self._chunks, compact=True, clear=True) + # this is called from .close, so we can clear here: + write_chunkindex_to_repo_cache(self.repository, self._chunks, clear=True) self._chunks = None # nothing there (cleared!) def refresh_lock(self, now): diff --git a/src/borg/hashindex.pyx b/src/borg/hashindex.pyx index d7c30b095..8f816639d 100644 --- a/src/borg/hashindex.pyx +++ b/src/borg/hashindex.pyx @@ -54,9 +54,6 @@ class ChunkIndex: refcount = min(self.MAX_VALUE, v.refcount + refs) self[key] = v._replace(refcount=refcount, size=size) - def compact(self): - return 0 - def clear(self): pass @@ -155,9 +152,6 @@ class NSIndex1: else: do_yield = key == marker - def compact(self): - return 0 - def clear(self): pass diff --git a/src/borg/repository.py b/src/borg/repository.py index 441359232..6f87f8ccf 100644 --- a/src/borg/repository.py +++ b/src/borg/repository.py @@ -193,7 +193,7 @@ def create(self): # to build the ChunkIndex the slow way by listing all the directories. from borg.cache import write_chunkindex_to_repo_cache - write_chunkindex_to_repo_cache(self, ChunkIndex(), compact=True, clear=True, force_write=True) + write_chunkindex_to_repo_cache(self, ChunkIndex(), clear=True, force_write=True) finally: self.store.close() @@ -385,7 +385,7 @@ def check_object(obj): # if we did a full pass in one go, we built a complete, uptodate ChunkIndex, cache it! from .cache import write_chunkindex_to_repo_cache - write_chunkindex_to_repo_cache(self, chunks, compact=True, clear=True, force_write=True) + write_chunkindex_to_repo_cache(self, chunks, clear=True, force_write=True) except StoreObjectNotFound: # it can be that there is no "data/" at all, then it crashes when iterating infos. pass