hashindex: track unresolved pack location with F_PENDING flag#9828
Conversation
Replace the UNKNOWN_BYTES32 pack_id sentinel (in-band signalling) with a ChunkIndex system flag, queried via is_pending(). Follow-up to borgbackup#9821.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9828 +/- ##
==========================================
- Coverage 85.23% 85.14% -0.09%
==========================================
Files 92 93 +1
Lines 15297 15337 +40
Branches 2299 2306 +7
==========================================
+ Hits 13038 13059 +21
- Misses 1570 1586 +16
- Partials 689 692 +3 ☔ View full report in Codecov by Harness. |
|
Not sure: maybe check whether it would be better to use a user flag for F_PENDING. The slight complication you have in the hashindex code (can't use The "system flags" are rather hashtable-internal things, like tracking what's new and then only writing what's new. |
switched F_PENDING to a user |
F_PENDING moves to the user flag range so it is set/cleared via normal assignment; flush()'s store-failure path no longer re-checks is_pending.
c640a65 to
1206808
Compare
Description
A chunk's pack location (pack_id, obj_offset, obj_size) isn't known yet between put() buffering it in the PackWriter and flush() writing the pack. The old code signalled this by writing the UNKNOWN_BYTES32 sentinel into pack_id and comparing against it later. Since every 256-bit value is a valid pack_id, reserving one as a marker is in-band signalling.
This replaces that with a ChunkIndex user flag, F_PENDING. add() sets it, update_pack_info() clears it once the real location is known, and is_pending() is the query used by repository.list() and get() in place of the old sentinel comparison. UNKNOWN_BYTES32 is still written as filler for the fixed-width record, but nothing reads it for meaning now.
Follow-up to #9821.
Checklist
mastertoxor the relevant test subset)