Skip to content

check --repair: flush pack writer in ArchiveChecker.finish() before dropping the index - #10072

Merged
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
mr-raj12:fix-check-finish-flush
Aug 11, 2026
Merged

check --repair: flush pack writer in ArchiveChecker.finish() before dropping the index#10072
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
mr-raj12:fix-check-finish-flush

Conversation

@mr-raj12

Copy link
Copy Markdown
Contributor

Closes #10055.

During check --repair, add_reference() re-adds chunks via repository.put(), which only buffers them in the pack writer. ArchiveChecker.finish() then deleted the chunk index without flushing, so a buffered chunk could survive to repository.close(), which asserts an empty buffer.

This flushes the pack writer in finish() before deleting the index. The test buffers a chunk in a repair-mode checker and checks that finish() stores it.

…ropping the index

During --repair, add_reference() re-adds chunks via repository.put(), which only
buffers them in the pack writer. finish() then deleted the chunk index without
flushing, so a buffered chunk survived to repository.close(), which asserts an
empty buffer. Flush in finish() before deleting the index.
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.54%. Comparing base (da6f388) to head (4211d49).
⚠️ Report is 11 commits behind head on master.

Files with missing lines Patch % Lines
src/borg/archive.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10072      +/-   ##
==========================================
- Coverage   86.77%   84.54%   -2.24%     
==========================================
  Files          98       98              
  Lines       17109    17134      +25     
  Branches     2591     2601      +10     
==========================================
- Hits        14847    14486     -361     
- Misses       1570     1964     +394     
+ Partials      692      684       -8     

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

Comment thread src/borg/archive.py
Comment on lines 2399 to 2400
# drops the stale in-memory index, so the next repository access rebuilds it from the repo.
logger.info("Deleting chunk indexes in repository - next repository access will cause a rebuild.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is something to look at later.

we should not kill the index, if we can avoid it.

@ThomasWaldmann
ThomasWaldmann merged commit ec7eb5f into borgbackup:master Aug 11, 2026
17 of 20 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.

check ArchiveChecker - does it flush?

2 participants