Skip to content

remove the drop_corrupt_tail mechanism, refs #10369 - #10378

Merged
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
mr-raj12:remove-drop-corrupt-tail
Sep 18, 2026
Merged

ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
mr-raj12:remove-drop-corrupt-tail

Conversation

@mr-raj12

Copy link
Copy Markdown
Contributor

Description

Follow-up to #10369, review point 3. Every check --repair rebuild of the chunk index now has an object validator, so drop_corrupt_tail was only reachable from tests.

Depends on #10369. This branch contains its commit; I will rebase onto master after #10369 is merged.

Changes

  • PackReader.iter_headers(): remove the drop_corrupt_tail parameter. Without a validator, a corrupt object header raises IntegrityError.
  • build_chunkindex_from_repo(): remove the drop_corrupt_tail parameter.
  • Repository: remove chunkindex_drop_corrupt_tail.
  • ArchiveChecker.check(): stop passing drop_corrupt_tail=repair and setting repository.chunkindex_drop_corrupt_tail.

No behaviour change: a walk without a validator only happens in a check without --repair, and it already raised.

Tests

  • Removed:
    • repository_test.py::test_pack_reader_drops_a_corrupt_tail_only_when_asked
    • repository_test.py::test_pack_reader_drops_a_corrupt_tail_without_an_on_drop
    • repository_test.py::test_pack_reader_drop_corrupt_tail_does_not_affect_a_validating_walk
    • cache_test.py::test_build_chunkindex_without_a_validator_drops_the_rest_of_a_damaged_pack
    • cache_test.py::test_build_chunkindex_without_drop_corrupt_tail_raises_on_a_damaged_pack
  • check_cmd_test.py::test_check_without_repair_does_not_drop_a_pack_tail renamed to test_check_without_key_aborts_on_a_corrupt_pack_header. It asserts that the rebuild gets no validator and raises CorruptPack.
  • Still covered by unchanged tests: test_pack_reader_raises_on_bad_magic (raises without a validator) and test_build_chunkindex_repair_resyncs_after_corrupt_header (CorruptPack without a validator; with one, the rebuild skips the damaged object and indexes the next one).

TZ=UTC pytest --benchmark-skip -n auto: 3072 passed, 1141 skipped.

Note for #10368

#10368 still passes drop_corrupt_tail=repair and sets chunkindex_drop_corrupt_tail in ArchiveChecker.check(). Whichever PR merges second removes those two lines.

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 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.11%. Comparing base (1110bcd) to head (f8f1464).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10378      +/-   ##
==========================================
- Coverage   88.14%   88.11%   -0.03%     
==========================================
  Files         103      103              
  Lines       18896    18889       -7     
  Branches     2931     2929       -2     
==========================================
- Hits        16655    16644      -11     
- Misses       1557     1561       +4     
  Partials      684      684              

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

@mr-raj12

Copy link
Copy Markdown
Contributor Author

Merge order: #10368 first, then I rebase this PR on master. The rebase also removes Repository.chunkindex_validate, its comment with the TODO pointing here, and the getter argument, which covers item 6 of the latest #10368 review.

@ThomasWaldmann ThomasWaldmann added this to the 2.0.0b25 milestone Sep 17, 2026
@ThomasWaldmann

Copy link
Copy Markdown
Member

@mr-raj12 #10368 is merged.

Every check --repair rebuild of the chunk index has an object validator
(borgbackup#10369), so drop_corrupt_tail was only reachable from tests.

- PackReader.iter_headers: remove the drop_corrupt_tail parameter. Without
  a validator, a corrupt object header raises IntegrityError.
- build_chunkindex_from_repo: remove the drop_corrupt_tail parameter.
- Repository: remove chunkindex_drop_corrupt_tail and chunkindex_validate.
  Since borgbackup#10368 the checker hands its index to the repository, so the lazy
  .chunks rebuild never runs during a check and nothing set either of them.
- ArchiveChecker.check: stop passing drop_corrupt_tail.
- tests: remove the 5 tests for drop_corrupt_tail, rewrite
  test_check_without_repair_does_not_drop_a_pack_tail as
  test_check_without_key_aborts_on_a_corrupt_pack_header.
@mr-raj12
mr-raj12 force-pushed the remove-drop-corrupt-tail branch from 624ccdc to f8f1464 Compare September 18, 2026 04:20
@mr-raj12

Copy link
Copy Markdown
Contributor Author

Rebased onto master, both repository attributes are gone now: chunkindex_drop_corrupt_tail and chunkindex_validate, plus the TODO(#10378) note.

Since #10368 the checker installs its index into the repository, so the lazy .chunks rebuild never runs during a check and nothing set either attribute. Full suite passes locally on repo v5.

@ThomasWaldmann
ThomasWaldmann merged commit 663a058 into borgbackup:master Sep 18, 2026
26 of 27 checks passed
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.

2 participants