Skip to content

check: --find-lost-archives reuses the archive metadata ids found by --verify-data, fixes #8478 - #10447

Open
mr-raj12 wants to merge 1 commit into
borgbackup:masterfrom
mr-raj12:check-find-lost-archives-verify-data-8478
Open

mr-raj12 wants to merge 1 commit into
borgbackup:masterfrom
mr-raj12:check-find-lost-archives-verify-data-8478

Conversation

@mr-raj12

Copy link
Copy Markdown
Contributor

Description

borg check --verify-data --find-lost-archives read every object twice: once in verify_data and once in rebuild_archives_directory to find the archive metadata objects.

verify_data now records the ids of the archive metadata objects it parses, including chunks that succeed on the --repair retry, in ArchiveChecker.archive_meta_ids. If the pass is interrupted, the ids stay None.

If archive_meta_ids is not None, rebuild_archives_directory reads only those objects. Otherwise it scans the metadata of all objects as before.

Behavior change: with --verify-data and without --repair, a corrupted archive metadata object is reported only by verify_data. The full scan no longer runs, so the extra "Skipping corrupted chunk" message is gone. error_found is the same.

Tests:

  • test_check_undelete_archives and test_spoofed_archive run with and without --verify-data.
  • New tests cover id collection (including a soft-deleted archive), an interrupted verify_data, and a chunk kept by the --repair retry.

fixes #8478

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 Sep 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.48780% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.75%. Comparing base (8274470) to head (c920290).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/borg/archive.py 80.48% 5 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10447      +/-   ##
==========================================
+ Coverage   88.73%   88.75%   +0.01%     
==========================================
  Files         103      103              
  Lines       19387    19408      +21     
  Branches     3023     3030       +7     
==========================================
+ Hits        17204    17225      +21     
+ Misses       1514     1513       -1     
- Partials      669      670       +1     

☔ 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.

borg2: check --verify-data --find-lost-archives can be made faster

1 participant