1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-22 07:43:06 +00:00

chunk index cache: fix "upgrade" code

nice try, but due to other changes after b13, the cache is invalid anyway.
This commit is contained in:
Thomas Waldmann 2024-11-08 22:10:39 +01:00
parent 43a27f294d
commit 56493fc62b
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01

View file

@ -667,17 +667,13 @@ def memorize_file(self, hashed_path, path_hash, st, chunks):
def try_upgrade_to_b14(repository):
# TODO: remove this before 2.0.0 release
# we just delete any present chunk index cache here, it is invalid due to the
# refcount -> flags change we did and due to the different CHUNKINDEX_HASH_SEED.
for name in "chunks_hash", "chunks":
try:
hash = repository.store_load("cache/chunks_hash")
repository.store_delete(f"cache/{name}")
except (Repository.ObjectNotFound, StoreObjectNotFound):
# TODO: ^ seem like RemoteRepository raises Repository.ONF instead of StoreONF
pass # likely already upgraded
else:
old_name = "cache/chunks"
new_name = f"cache/chunks.{bin_to_hex(hash)}"
logger.debug(f"renaming {old_name} to {new_name}.")
repository.store_move(old_name, new_name)
repository.store_delete("cache/chunks_hash")
def list_chunkindex_hashes(repository):