Skip to content

repository: keep the store cache out of repo-create and repo-delete, refs #10396 - #10477

Open
mr-raj12 wants to merge 1 commit into
borgbackup:masterfrom
mr-raj12:store-cache-lifecycle-10396
Open

mr-raj12 wants to merge 1 commit into
borgbackup:masterfrom
mr-raj12:store-cache-lifecycle-10396

Conversation

@mr-raj12

@mr-raj12 mr-raj12 commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Description

Implements option A of #10396: repo-create and repo-delete only act on the repository, not on the BORG_STORE_CACHE directory. refs #10396.

With BORG_STORE_CACHE set (master a586f69, borgstore 0.7.0):

  • borg repo-create failed with rc 11 ("has no repository config") as soon as the cache directory was not empty, and left an empty repository directory behind.
  • borg repo-delete removed the whole cache directory: the cached packs of all other repositories and any other file in there.

Changes:

  • Repository(create=True) does not give a cache to the Store.
  • Repository.destroy() and the cleanup after a failed create destroy the store's backend only (Repository._destroy_store).
  • Help text of BORG_STORE_CACHE: cached packs of a deleted repository stay until they are evicted or the directory is removed.

Tests:

  • test_create_with_a_filled_store_cache (file, ssh): creating a repository leaves a filled cache directory unchanged, the cache is used when the repository is opened afterwards.
  • test_destroy_keeps_the_store_cache (file, ssh): destroy() removes the repository, the cache directory keeps all its files.
  • test_create_failure_keeps_the_store_cache: a failing save_config / open after the store was created removes the store, the cache directory keeps all its files.
  • test_repo_create_with_a_filled_store_cache: a second borg repo-create works.
  • test_delete_repo_keeps_the_store_cache: borg repo-delete of one repository keeps the cache files, the other repository still extracts.
  • test_gather_many_one_gather_for_many_packs and test_salvage_pack_refuses_with_a_pack_store_cache now reopen the repository after creating it, so they still run with the cache.

The create and destroy tests fail on master. test_destroy_keeps_the_store_cache and test_delete_repo_keeps_the_store_cache also fail if only _destroy_store calls Store.destroy().

Not in this PR: a per-repository cache directory (option B) and a check for a cache directory that holds other content. Touches the same lines of Repository.__init__ as #10467.

Checklist

  • PR is against master (or maintenance branch if only applicable there)
  • New code has tests and docs where appropriate
  • Tests pass (run tox or the relevant test subset)
  • Commit messages are clean and reference related issues

@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.74%. Comparing base (e84d7ac) to head (09613dc).
⚠️ Report is 3 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #10477   +/-   ##
=======================================
  Coverage   88.73%   88.74%           
=======================================
  Files         103      103           
  Lines       19392    19394    +2     
  Branches     3024     3024           
=======================================
+ Hits        17208    17211    +3     
+ Misses       1515     1514    -1     
  Partials      669      669           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant