Skip to content

check: report missing chunks grouped as chunk -> files -> archives, #9218 - #9965

Open
mr-raj12 wants to merge 2 commits into
borgbackup:masterfrom
mr-raj12:invert-missing-chunk-report-9218
Open

check: report missing chunks grouped as chunk -> files -> archives, #9218#9965
mr-raj12 wants to merge 2 commits into
borgbackup:masterfrom
mr-raj12:invert-missing-chunk-report-9218

Conversation

@mr-raj12

@mr-raj12 mr-raj12 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #9218.

borg check logged one line per (archive, file, chunk) for each missing file chunk. Now it groups by chunk:

The following chunks are missing in the repository:
- Chunk a8675a3a8a...95dce, 553,688 bytes
    - var/lib/flatpak/repo/objects/2c/6265...52be.file: archive-2022-03-31, archive-2022-04-29
    - var/lib/flatpak/runtime/.../bin/gpgsm: archive-2022-03-31

For each missing chunk you see its size, the files that reference it, and the archives each file is in. The old per-chunk line (with byte offsets) is now logged at debug level.

The report is collected while checking the archives and printed once they have all been analyzed. As a check can run against a badly damaged repository with very many missing chunks, the collection is bounded by ArchiveChecker.MAX_MISSING_CHUNKS (distinct chunks) and MAX_REFS_PER_CHUNK (files per chunk); the report notes when either limit truncated it.

Tests in check_cmd_test.py cover the grouping (one chunk reported once, listing multiple files and archives) and the truncation.

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.23529% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.68%. Comparing base (a50eb6f) to head (083bb31).
⚠️ Report is 20 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/borg/archive.py 88.23% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9965      +/-   ##
==========================================
- Coverage   85.70%   85.68%   -0.03%     
==========================================
  Files          95       95              
  Lines       16815    16902      +87     
  Branches     2577     2591      +14     
==========================================
+ Hits        14411    14482      +71     
- Misses       1668     1684      +16     
  Partials      736      736              

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

@ThomasWaldmann

Copy link
Copy Markdown
Member

So, did you ask claude for a review?

…orgbackup#9218

Cap distinct chunks and file refs kept for the end-of-run report, combine the two collection dicts into one, and add tests for the grouping and truncation.
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.

Improve borg2 check reporting of missing chunks

2 participants