#1 [high] PR 496 overview: coalesced shared ancestor reads in selene disk_store
PR #496 (FujitsuPolycom, open, ready for review, head f9c9191, base main@c0c4f79). 2 files: selene/src/disk_store.rs (+2803/-913), docs/prefix-cache-offload.md (+5/-1, section 2.4).
Change: splits old InboundRecord (Destination::Device|Host) into
HostInbound(caller-owned buffer path,Staged::read_into, used by CompositeStore/host_inbound): unchangedplan_windows(unaligned).DeviceInbound(GPUStaged::fetch): newplan_aligned_windowssplits on absolute WINDOW_PAGES (64) boundaries;SharedSegment(one disk-thread Open per (path, expected Header), refcounted byusers);SharedWindow(one staged window per (path, expected, first, count, row)) shared across fetches, each follower submits its own GPU upload from the shared staging slots. Also:Owner::Inbound(id,seg)->Owner::HostInbound+Owner::SharedSegment;pump_allnow does outbound, host_inbound, thenpump_device_inbound(passes 1..5e); test-support counters disk_opens/disk_window_reads/coalesced_windows;Staged::in_flight()counts host+device.
Relevant constants: WINDOW_PAGES=64 (selene/src/slab.rs:34 via shared), WINDOWS_IN_FLIGHT=WINDOW_CREDITS=2 (shared/limits.rs:18), RECORDS_IN_FLIGHT=8 (disk_store.rs:64), disk::QUEUE_DEPTH=64.
PR claims: shared Open per file, 64-page aligned coalescing, refcounted windows, demand ordering, failure isolation, Staged::close drains. Evidence: 474 selene tests, Windows IOCP 7 coalescing tests; live SM121 checks; not covered: rerun of single-pass benchmarks after demand-index edit, helios FLARE_RUN_CUDA_TESTS, Windows serving, CompositeStore/PooledStore GPU serving.
Related: #497 (companion, same author, touches Staged::pump_all; merge this first), #477/#486 (other disk_store changes).
Review lens A: correctness and consequences - callers, configs, lifetimes, edge paths.
#2 [high] Research summary
I ran out of budget before finishing the whole review, so this is a partial result stated honestly.
What I reviewed in context
read_charter,AGENTS.md,docs/design-review.mdfor the applicable rules (principle 6 "make storage and lifetimes explicit / never reuse slots while transfers reference them", principle 7 "published checkpoints are immutable", principle 12 "validate the real path").- The whole new device path in
selene/src/disk_store.rs:plan_aligned_windows(700–738),HostInbound(740–997) vsDeviceInbound(1099–1153),SharedSegment/SharedWindow(999–1091),acquire_shared_segment(1362–1402),fail_segment_users/fail_window/apply_shared_disk/apply_device_transfer(1449–1566),find_reusable_window/find_best_existing_window_for/attach_existing_window(1568–1643),build_pending_demand/pick_next_pending_plan(1647–1724),detach_unwinding_windows/sweep_shared_windows/segment_needs_disk_reads(1726–1809),pump_device_inboundpasses 1–5e (1811–2266),pump_all(2268–2289),step/busy/fetch/close(2299–2508), and the consumersDiskStore::apply/fetch/stats(3593–3833). - Supporting code:
selene/src/disk.rs(Open/ReadPages/ReadRow/Closesemantics, FIFO per-id execution,openheader validation),selene/src/slab.rs(SlabPool::allocate/release/free_slots,WINDOW_PAGES),selene/src/geometry.rs(record_slots,row_slots),selene/src/shared/limits.rs(WINDOW_CREDITS = 2), callersselene/src/composite.rs:802–836(hostread_intopath),selene/src/offload.rs:465–650(pool sizing / transport construction),selene/src/shard.rs:1030–1195(per-rankStagedpeers,in_flight()use).
What I checked and found sound
Slot lifetime for a shared window is guarded by followers.is_empty() && disk_referenced == 0 && upload_referenced == 0 (1755–1771); every path I traced that could remove a record or a segment first requires active.is_empty() (Pass 5e, 2213–2230) or refuses to detach while an upload is busy (1737–1741), so apply_device_transfer cannot drop a reply that still holds upload_referenced. allocate(plan.count, plan.row) matches record_slots and the pick_next_pending_plan free-slot precheck, and plan.offset/count index record.pages and win.buffers.pages consistently for aligned windows. Linux disk::Job ordering makes the pending_page_reads/pending_row_reads reply matching correct (jobs for one id run in submission order). Host read_into stays on the unchanged private path, so CompositeStore behaviour is untouched.
Findings
- Nit —
selene/src/disk_store.rs:2485–2506(Staged::close): the timeout diagnostic now sumsoutbound + host_inbound + device_inbound + maintenanceand then.max(usize::from(self.busy())), wherebusy()is a bool. Work held only byshared_segments/shared_windows/ownersis therefore reported as "1 disk transport jobs did not complete" instead of the previousself.owners.len(). Diagnostic-only; fix by counting outstanding disk jobs (owners+ maintenance) so the message stays truthful. - Observation (should confirm) —
selene/src/disk_store.rs:1828–1830with3587and3628: each follower credits the shared window'sread_bytesin full (record.bytes += win.read_bytes), so a coalesced restore still reports its whole chain toDiskStore::apply, which feedsstats.bytes_inandinbound_rate.observe. That keeps the historical definition, butinbound_ratealso priceshit().estimated_secondsfor scheduling. After this change the rate reflects a wall time shortened by sharing, so estimates for a request that will not be coalesced under-report its cost. Not a correctness defect; worth stating explicitly in the description or splitting physical from logical accounting.
Not finished (would settle the remaining risk)
I did not read the new test module past line 8420 (tests staggered_arrival…, different_skip_pages…, private_failure_isolation…, shared_ancestor_failure…, staged_close_drains…), nor #497's pump_all rebase interaction, nor the Windows/IOCP and helios GPU-offload paths. The two-risk areas I would want tests for before approving are (a) a follower attaching to a Read-phase window in a segment that closes in the same pump (my trace says safe via users/settled), and (b) Staged::close draining a coalesced burst within copier::CLOSE_TIMEOUT, which staged_close_drains_active_coalesced_fetches_cleanly appears to cover but which I did not read. I found no blocking correctness defect in the paths I did read.
#5 [high] Report 2026-11-25 (head 0c04b1e2): earlier should-fix items resolved; residual nits
Review — PR #496 at head 0c04b1e2 (2026-11-25), correctness lens
Verdict: no blocking or should-fix findings; 2 nits.
Previously raised items, re-checked at head — resolved
- Logical bytes into
inbound_rate(old :1829/.3626/.3628) — fixed.apply_shared_disknow emitsTransportEvent::InboundWindowSample { bytes, elapsed }once per completed physical shared window (selene/src/disk_store.rs:1596-1620), carryingwin.read_bytesand the summeddisk::Reply.elapsedof that window'sReadPages/ReadRowjobs (:1597-1598), andDiskStore::applyfeeds onlyself.inbound_rate.observe(bytes, elapsed)from it (:3632-3635).stats.bytes_instays logical throughrecord.bytes += win.read_bytesper follower (Pass 1, :1899-1905) and:3669. Docs state the split (docs/prefix-cache-offload.md §2.4 and §4). NoteRate::observeignores zero bytes/elapsed (levels.rs:57-60), and the pure row window is included in the same window's bytes/elapsed. Staged::closeabandoned count — fixed:store_jobs.max(internal)whereinternal = max(owners.len(), maintenance.len(), shared_segments.len(), shared_windows.len())(selene/src/disk_store.rs:2513-2528) can no longer report less thanowners.len().- Misaligned-follower coverage — added
misaligned_follower_attaching_to_shared_partial_tail_and_row_matches_private_restore, comparing byte-equal SimulatedGpu pages/row against a private-store baseline forskip_pages = 13attaching to a leader's windows (test module, disk_store.rs ~8760ff).
Event plumbing for the new variant (checked in full)
Sharded::absorb_localforwards samples toself.eventswithout going throughKind::of(shard.rs:718-728);Kind::ofhas anunreachable!arm (shard.rs:476-478) that is genuinely unreachable because peer forwarding filters first (Peer::forward, shard.rs:1144-1153). Rank 0 keeps its own samples, so the rate is measured on the rank that owns theDiskStore; peers drop theirs, which is what the doc claims.CompositeStore::pollpasses them tostreamed_event→DiskStore::apply(composite.rs:1373-1385, 300-327); the composite's byte/rate deltas are computed fromfetched/bytes_indeltas, unaffected by samples.
Nits
- N1 (nit) —
selene/src/composite.rs:1376:self.stats.progress += 1runs for every transport event before dispatch, so a coalesced restore'sInboundWindowSamples bump the composite's progress counter whileDiskStore::applydeliberately does not bumpself.stats.progressfor them (disk_store.rs:3632-3636). The two stores' progress counters now advance at different rates for the same work. Fix: skip the increment forInboundWindowSamplein the composite loop, mirroring the early return inDiskStore::apply. - N2 (nit) —
selene/src/disk_store.rs:1594-1620: the sample is emitted only from theOk(())arm and only whenwin.phase == Reading; a window whoseReadPagessucceeded but whoseReadRowwas never submitted becausedisk_space()ran out (Pass 5acontinue, :2113-2116) keepsrow_submitted == falseand staysReadingwithdisk_referenced == 0, so it is never sampled and never uploadable until a later pump submits the row. Correct but means a rate sample can be delayed indefinitely under disk-queue saturation; worth a comment on the invariant (Reading⇒ at least one pending submission or reply).
Not re-verified this turn (time)
#497 rebase interaction on pump_all, Windows IOCP path, multi-host RoCE, 2-GPU split pools — the author lists these as not covered too.
#6 [high] Research summary
Reviewed PR #496 at head 0c04b1e2 through the correctness lens. Verdict: no blocking or should-fix findings — the three issues I raised on the previous revision are addressed in code, and the two things left are nits. Full detail is in scratchpad entry #5.
Resolved from the previous round. (1) The inbound_rate/bytes_in conflation is fixed: apply_shared_disk emits one TransportEvent::InboundWindowSample { bytes, elapsed } per completed physical shared window (selene/src/disk_store.rs:1596-1620) carrying that window's summed disk::Reply.elapsed, and DiskStore::apply feeds only inbound_rate from it (:3632-3635) while stats.bytes_in stays logical via record.bytes += win.read_bytes (:1899-1905, :3669); docs §2.4 and §4 now state the split. (2) Staged::close's abandoned count is now store_jobs.max(internal) with internal the max of owners/maintenance/shared_segments/shared_windows lengths (:2513-2528), so it can no longer under-report versus owners.len(). (3) A misaligned-follower test now compares byte-equal pages and row against a private-store baseline.
Event plumbing checked in full. Sharded::absorb_local forwards samples to rank 0 without Kind::of (shard.rs:718-728); the unreachable! arm (shard.rs:476-478) is genuinely unreachable because Peer::forward filters first (shard.rs:1144-1153), so peers drop samples and rank 0, which owns the DiskStore, measures its own. CompositeStore::poll routes them to streamed_event → DiskStore::apply (composite.rs:1373-1385), and the composite's counters are computed from fetched/bytes_in deltas, so they are unaffected.
Nits. N1: composite.rs:1376 bumps self.stats.progress for every transport event before dispatch, including InboundWindowSample, while DiskStore::apply deliberately does not (disk_store.rs:3632-3636) — the two progress counters now advance at different rates for the same work. N2: a window whose ReadPages succeeded but whose ReadRow was deferred for lack of disk queue space (:2113-2116) stays Reading with disk_referenced == 0, so it is neither sampled nor uploadable until a later pump; correct but deserving of a comment on that invariant. I did not re-verify the #497 pump_all rebase, the Windows IOCP path, or multi-host/split-pool configurations in this turn.
#7 [high] Scope, docs claim check, and verdict line for the 0c04b1e2 review
Scope & supporting notes for PR #496 review at head 0c04b1e2
What was read in context this turn (all changed files + their consumers)
selene/src/disk_store.rsat head: module doc (:14-27),TransportEventincl. newInboundWindowSample(:85-110),DiskTransport(:113-162),Resources+ test-support counters (:192-260),plan_windows(:682-727),HostInbound(:747-993) vsDeviceInbound(:1166-1214),HeaderIdentity/SegmentKey/WindowKey(:1001-1064),SharedFileState/SharedSegment(:1066-1110),SharedWindow/DeviceActiveWindow(:1112-1158),Stagedfields (:1222-1238),write_from/read_into/store_pages/accept(:1305-1414),acquire_shared_segment(:1428-1462),pump_host_inbound(:1496-1507),fail_segment_users/fail_window/apply_shared_disk/apply_device_transfer(:1509-1644),find_reusable_window/find_best_existing_window_for/has_window_credit/attach_existing_window/attach_pending(:1646-1730),build_pending_demand/pick_next_pending_plan(:1734-1793),detach_unwinding_windows/sweep_shared_windows/segment_needs_disk_reads/remove_shared_segment(:1795-1881),pump_device_inboundpasses 1–5e (:1883-2289),pump_all(:2291-2312),step/busy(:2322-2374),Staged::fetch(:2410-2461),truncate/unlink/poll/close(:2463-2547),DiskStore::plan_fetch/hit/apply(:3579-3710),fetch/poll/stats(:3840-3900).selene/src/shard.rs:Kind::of/Kind::event(:466-512),finish/absorb_local/absorb_peers/abandon/expire(:631-798),Sharded::poll(:952-971),Peer::dispatch/forward(:1100-1155).selene/src/composite.rs:streamed_event(:300-327),hit(:331-358),start_readviastaged().read_into(:802-837),advance(:841-904),disk_read(:980-1034),memory_fetched(:1037-1070), transport polling (:1373-1387).- Supporting:
selene/src/levels.rsRate::observe/get(:46-87),selene/src/disk.rsReply.elapsed(:284-294) and the worker recordingstarted.elapsed()(:447-454),selene/src/geometry.rsrow_slots/record_slots/record_bytes(:173-188),selene/src/slab.rsSlabPool(:143-200),selene/src/store.rsworth_fetching/worth_transfer/INITIAL_STAGED_DISK_RATE(:416-438),selene/src/shared/record.rsHeaderfields +PartialEq(:89-154) versusHeaderIdentity's hand-writtenHash— I checked field-by-field and every field compared inPartialEqis hashed (identity, fingerprint, flags, key, parent, bucket, page_tokens, tail_pages, ranks, page_segment, row_segment, row_checksum, created), withversion(non-semantic by its own doc comment) andranks.len()hashed as a length prefix; so the customHash/Eqpair is consistent.
Docs claim check (against code, not just prose)
docs/prefix-cache-offload.md §2.4 additions match the code: shared handle per matching (path, expected header), WINDOW_PAGES-aligned staging, per-follower upload, slots released only after disk read + every upload, caller-owned read_into independent and segment-relative, sharing only while a window is Reading/Read, at most one extra partial window per segment when skip_pages % WINDOW_PAGES != 0, shared open/read errors fail all attached restores while private child/upload errors fail one, logical bytes_in vs physical inbound_rate. §4's added paragraph matches DiskStore::apply (:3632-3635) and stats (:3889).
Report verdict line
Verdict: no blocking or should-fix correctness findings at 0c04b1e2; 2 nits (composite progress-counter bump for InboundWindowSample, composite.rs:1376; unsampled window when ReadRow is deferred for disk queue space, disk_store.rs:2113-2116 with :1599-1611). Not verified this turn: #497 rebase of pump_all, Windows IOCP, multi-host RoCE, 2-GPU split pools (also listed as not covered by the author).
#9 [high] Re-check of the 5 external should-fix items against my correctness verdict (head 0c04b1e2)
Re-check of the posted review's 5 "should fix" items through the correctness lens
1. TransportEvent::InboundWindowSample on the completion enum (disk_store.rs:97-101; shard.rs:476-478, :722-725, :1148-1150)
Layering, not correctness. The unreachable!() arm is genuinely unreachable at head:
Sharded::absorb_local forwards samples straight to self.events without calling Kind::of
(shard.rs:718-729), and Peer::forward filters the variant before Kind::of (shard.rs:1144-1153).
The two guards are hand-written, so a future event path could violate the invariant — that is the
maintainability risk the other reviewer names, and I agree it is worth fixing, but no code path at
head can panic. Not a correctness defect.
2. HeaderIdentity's hand-written Hash (disk_store.rs:1014-1050) vs Header::PartialEq (shared/record.rs:136-152)
Verified field by field at head: identity, fingerprint, flags, key, parent, bucket, page_tokens,
tail_pages, ranks (len + planes + row_bytes), page_segment, row_segment, row_checksum, created are
all hashed; version is skipped but is documented non-semantic (record.rs:118-119) and excluded from
PartialEq too. So a == b => hash(a) == hash(b) holds at head and two different records cannot
alias in SegmentKey/WindowKey. The .. in the destructure is a silent-drift hazard for a future
Header field, not a defect now. Should-fix for maintainability, not correctness.
3. Hand-restated record_slots in pick_next_pending_plan (disk_store.rs:1767-1777)
Checked the arithmetic: needed = plan.count + if plan.row { layout_row_slots } else { 0 } where
layout_row_slots = layout().row_slots() (:1767-1771); Layout::record_slots(pages, row)
(geometry.rs:180-182) is pages + usize::from(row) * self.row_slots(). Identical expressions, so the
admission prediction cannot under- or over-estimate the allocation in Resources::allocate
(disk_store.rs:243-254), which uses record_slots. Nit (duplication), not an arithmetic bug — the
other reviewer's wording implies a divergence that is not in the code.
4. Docs §2.4 split (docs/prefix-cache-offload.md:337-366; duplication at :1528-1531)
Prose organisation. The content matches the code (I checked the §2.4 claims against
plan_windows :682-727, slot release :1824-1843, failure isolation :1509-1553, and the
bytes_in/inbound_rate split :3631-3670, :3889). Style only.
5. Design sign-off on a second inbound lifecycle in Staged
Process, not code. Out of my lens.
Where this leaves my verdict
No blocking or should-fix correctness findings at 0c04b1e2. The two nits I recorded stand
(composite.rs:1376 progress bump — note that via CompositeStore::poll :1418-1428 it also re-runs
spill_parked + disk.maintain() once per physical window, which defeats the throttling the
maintenance_progress gate exists for; safe but wasteful. disk_store.rs:2113-2116 deferred ReadRow
leaving a window unsampled/unuploadable until a later pump — correct, invariant worth a comment).
#10 [high] Research summary
Reviewed PR #496 at head 0c04b1e2 again through the correctness lens, this time specifically re-checking the five "should fix" items in the posted review against the code. None of them is a correctness defect; my verdict stays clean, with the same two nits.
Re-checks (all verified in code this turn):
InboundWindowSampleonTransportEvent— layering, not correctness.Kind::of'sunreachable!()(shard.rs:476-478) cannot be reached at head:Sharded::absorb_localforwards samples straight toself.events(shard.rs:718-729) andPeer::forwardfilters the variant beforeKind::of(shard.rs:1144-1153). Worth fixing for maintainability, but no panic path exists.HeaderIdentity's hand-writtenHash— I re-verified field by field: every field inHeader::PartialEq(shared/record.rs:136-152) is hashed (disk_store.rs:1032-1048),versionis excluded from both and is documented non-semantic.a == b ⇒ hash(a) == hash(b)holds, so no aliasing inSegmentKey/WindowKey. The..is a drift hazard only.pick_next_pending_planrestatingrecord_slots— the arithmetic is identical (plan.count + row * row_slots()at :1767-1777 vs geometry.rs:180-182 andResources::allocateat disk_store.rs:243-254), so there is no admission/allocation divergence. Duplication nit only.- Docs §2.4 — organisation; the content matches the code (plan_windows :682-727, slot release :1824-1843, failure isolation :1509-1553, bytes_in/inbound_rate split :3631-3670, :3889).
- Design sign-off — process, outside the correctness lens.
The two surviving nits: composite.rs:1376 bumps stats.progress for InboundWindowSample, which DiskStore::apply does not (:3632-3636) — via CompositeStore::poll (:1418-1428) that also re-runs spill_parked + disk.maintain() once per physical window, safe but defeating the throttle; and disk_store.rs:2113-2116, where a window whose ReadRow is deferred for disk queue space stays Reading with disk_referenced == 0, so it is neither sampled nor uploadable until a later pump (correct, invariant deserves a comment). Not verified: the #497 pump_all rebase, Windows IOCP, multi-host RoCE, 2-GPU split pools.
#11 [high] Report of 2026-11-25, run (re-check of posted review): verdict clean, 5 should-fix items re-assessed
Review — PR #496 "Coalesce shared ancestor reads across concurrent Selene disk fetches"
Head reviewed: 0c04b1e2 · Lens: Correctness · Files: selene/src/disk_store.rs, selene/src/shard.rs (+ selene/src/composite.rs, geometry.rs, slab.rs, disk.rs, shared/record.rs, levels.rs read as context), docs/prefix-cache-offload.md.
Run purpose: re-check the five "should fix" items in the posted Autobot review against the code, not to re-review from scratch.
Verdict: clean — no blocking or should-fix correctness findings; 2 nits.
The posted review's five should-fix items, re-assessed under correctness
TransportEvent::InboundWindowSampleon the cross-rank completion enum (disk_store.rs:97-101;unreachable!shard.rs:476-478; guards shard.rs:722-725, :1148-1150). Not a correctness defect at head:Sharded::absorb_localpushes samples straight toself.eventswithoutKind::of(shard.rs:718-729) andPeer::forwardfilters the variant beforeKind::of(shard.rs:1144-1153), so theunreachable!arm cannot be reached. Real maintainability risk (two hand-written guards uphold an invariant the type system should); agree it is worth fixing, but it is layering, not correctness.HeaderIdentity's hand-writtenHash(disk_store.rs:1014-1050) vsHeader::PartialEq(shared/record.rs:136-152). Re-verified field by field: identity, fingerprint, flags, key, parent, bucket, page_tokens, tail_pages, ranks (len + planes + row_bytes), page_segment, row_segment, row_checksum, created are all hashed;versionis omitted from bothPartialEqand the hash and is documented non-semantic (record.rs:118-119). Soa == b ⇒ hash(a) == hash(b)holds and no two distinct records can alias intoSegmentKey/WindowKey. The..in the destructure is a silent-drift hazard for a futureHeaderfield, not a present defect.pick_next_pending_planrestatingrecord_slots(disk_store.rs:1767-1777). The expressions are identical:plan.count + if plan.row { layout().row_slots() } else { 0 }vsLayout::record_slots(pages, row) = pages + usize::from(row) * row_slots()(geometry.rs:180-182), which is whatResources::allocateactually uses (disk_store.rs:243-254). No under/over-admission, so no correctness consequence — duplication nit only. The posted wording ("recomputes by hand", implying divergence) is stronger than the code supports.- Docs §2.4 split (docs/prefix-cache-offload.md:337-366, duplication at :1528-1531). Organisation only; the content matches code (plan_windows :682-727, slot release :1824-1843, failure isolation :1509-1553,
bytes_in/inbound_ratesplit :3631-3670, :3889). - Design sign-off on a second inbound lifecycle inside
Staged. Process; outside this lens.
Nits (unchanged from the earlier head review)
- N1 —
selene/src/composite.rs:1376.CompositeStore::polldoesself.stats.progress += 1for every transport event before dispatch, includingInboundWindowSample, whereasDiskStore::applyearly-returns for it and does not count progress (disk_store.rs:3632-3636). Consequence beyond the counter divergence: the gate at composite.rs:1418-1428 (maintenance_progress != progress) re-runsspill_parked+disk.maintain()once per physical window read, i.e. the new event defeats the throttle it exists for. Safe (maintenance is idempotent and slot-consuming only when needed), but wasteful; fix by skipping the increment for this variant. - N2 —
selene/src/disk_store.rs:2113-2116with:1599-1611. When a window'sReadPagessucceeded butReadRowis deferred for lack of disk queue space, the window staysReadingwithpages_submitted == true,row_submitted == false,disk_referenced == 0; the sample condition requiresrow_submitted && disk_referenced == 0, so noInboundWindowSampleand no follower upload until a later pump. Behaviour is correct (followersnon-empty keeps the window alive; Pass 5a re-enters and submits the row), but the invariant "Reading⇒ a pending submission or outstanding reply" is load-bearing and undocumented; a comment would protect future edits to thatcontinue.
Previously fixed at this head (for context)
- Physical
inbound_ratevs logicalbytes_in: one sample per completed physical window (disk_store.rs:1596-1620), rate-only inapply(:3632-3635),stats.bytes_inlogical (:1899-1905, :3669); docs §2.4/§4 updated. Staged::closeabandoned countstore_jobs.max(internal)(:2513-2528), which cannot under-reportowners.len().- Misaligned-follower test comparing byte-equal SimulatedGpu pages and row against a private-store baseline.
Not verified (same gaps as the author lists)
#497 rebase of Staged::pump_all ordering; Windows IOCP; multi-host RoCE; 2-GPU split_pools; discrete PCIe GPUs; live CompositeStore/PooledStore GPU serving. No toolchain, GPU or test run was available: every statement above is from source at 0c04b1e2.
#13 [high] Report 2026-11-27 (head cb3db468): verdict clean, packed coalescing + out-of-band samples verified
Review — PR #496 (head cb3db468, rebased onto main 6d74db3a)
Verdict: clean. No blocking, no should-fix. 3 nits.
Files read in context at head: selene/src/disk_store.rs (+8470/−5627), selene/src/shard.rs (+11), selene/src/shared/packed.rs (+44), selene/src/shared/record.rs (+119/−1), docs/prefix-cache-offload.md (+38/−2); dependencies selene/src/disk.rs, copier.rs, codec_copy.rs, levels.rs, composite.rs, geometry.rs, selene/proto/selene.proto.
Prior findings — now resolved in code
- N1 (composite progress bump per rate sample) — FIXED.
TransportEventhas noInboundWindowSamplevariant (disk_store.rs:84-106);DiskStore::applyagain starts with an unconditionalself.stats.progress += 1(disk_store.rs:4409-4410) and rate samples arrive out of band: trait hookdrain_inbound_samples(disk_store.rs:149-150),Stagedimpl (:3165-3167), drained byDiskStore::observe_inbound_samplesfrompoll_transport(:3649-3663),HostStore::poll(:4640) andclose(:4678).CompositeStore::poll(composite.rs:1471-1484) therefore only counts real completions, so themaintenance_progressgate (composite.rs:1518-1529) is no longer re-triggered per physical window. - Rank-0-only, peer-discard plumbing:
Sharded::drain_inbound_samplesforwards the localStagedand discards onpoison(shard.rs:1005-1012);Peer::forwarddrops its own samples into a throwaway vec (shard.rs:1210-1214). Matches the description. Staged::closenow reportsabandoned_jobsandleaked_sharedseparately (disk_store.rs:3183-3225), andmem::forgets apacked_bufstill referenced by an upload only when the copier close failed (:3206-3212) — correct leak-vs-free choice.Layout::record_slotsis now used by the admission guard (pick_next_pending_plan, disk_store.rs:2306-2321, packed windows exempted) and byResources::allocate(:254).
Hashing / compatibility (was should-fix on the old head)
Hash for Header(shared/record.rs:165-202) is an exhaustive destructure and skips onlyversion: _, matchingPartialEq(:144-160) which also ignoresversion(field documented non-semantic at :125-126). Every equality field includingpacked,ranks,row_checksum,createdis hashed.Eq/Hash for packed::Layout(shared/packed.rs:99-141) destructuresLayout,PackedOfferandPackedUnitexhaustively; the hashed set is exactly the prost fields ofPackedUnit/PackedOffer(selene/proto/selene.proto:1197-1218), andoffsets/pagesderive fromoffer+ ranks, soa == b ⇒ hash(a) == hash(b).HeaderIdentity::hashdelegates toHeader::hash(:1452-1456) with theArc::ptr_eqfast path only inPartialEq(:1444-1448) — no aliasing between different records inSegmentKey/WindowKey(:1458-1470).- Test
header_eq_implies_same_hash(record.rs:2229-2306) pins version-insensitivity,createdsensitivity, and raw-vs-packed distinction. - No record format, header layout or re-export change: existing
.ckptfiles (v1-v4) load unchanged.
Soundness re-verified at head
- Window lifetime: freed only when
followers.is_empty() && disk_referenced == 0 && upload_referenced == 0(sweep_shared_windows :2361-2378);disk_referencedincremented at every submission (:2688, :2724, :2752), decremented at :2122;upload_referencedat :2851-2854 / :2171. A reply for a freed window cannot occur. - Packed windows: zero
SlabPoolslots (:2528-2533,record_slotsbypass at :2314-2321), oneReadPackedper aligned window covering whole pages plus optional row vialayout.page_offset/physical_bytes(:2643-2699, mirroringHostInbound::submit_reads:1326-1362).packed_bufretained until sweep atReadsoPinnedPacketspans (:2792-2831) outlive every follower's decode/upload fence. - File lifetime:
disk_settled()requiresClosed && disk_outstanding == 0(:1512-1515); segment removed only withusers.is_empty() && disk_settled()(:2929-2954); Pass 5e holdsFetcheduntil every shared segment is settled or has another user (:2910-2921).Closesubmitted only when!segment_needs_disk_reads(:2380-2408, :2872-2891). - Segment reuse only from
reusable()(Unopened/Opening/Opened, :1504-1510) so a Closing/Closed handle is never revived; a stalewindow_indexentry cannot be inherited becauseunindex_windowcompares the id (:2030-2038) and a segment is closed only when no healthy follower still needs aReadingwindow. - FIFO reply matching for
ReadRow(no window id) is exact: onedisk::Workerexecutes jobs strictly in order (disk.rs:463-486), andpending_row_readsis pushed at submission (:2748). - Failure isolation: private/transient upload errors fail one restore (:2179-2181) while shared open/read and packed-content errors use
with_record_read()(:2096, :2145, :2176) and fail every attached restore viafail_segment_users(:2040-2065) /fail_window(:2067-2080);DiskStore::applydrops only the endpoint's lookup row onis_record_read()(:4445-4456). - Host path unchanged:
read_into/read_into_packedstill private per-restore opens withplan_windows(..., false)(:1786-1871),completed_packed_readspopulated beforeFetched(:2021-2026), soCompositeStoresees no behavioural change. - Single-restore bound:
build_pending_demandshort-circuits atdevice_inbound.len() <= 1(:2273-2277), so only the alignment cost remains — theskip_pages % 64 != 0partial window the description claims.
Nits (all verified in code)
- docs/prefix-cache-offload.md:424-428 says coalescing aligns windows to "
WINDOW_PAGES(64-page) file boundaries" for packed records too. For v4 packed segmentsplan_windows(..., true)aligns in page-index space (disk_store.rs:1053-1059) but the byte range islayout.page_offset(first)..page_offset(first+count)(:2650-2660), which is not 64-page aligned in the file because packed unit lengths vary. Behaviour is correct and the "at most one extra partial window" bound still holds; the wording "file boundaries" only fits raw v1-v3. - disk_store.rs:2737-2740 (Pass 5a
if !self.resources.disk_space() { continue; }beforeReadRow): a window whose pages read has completed can sitReadingwithrow_submitted == falseanddisk_referenced == 0, so it emits no rate sample (:2130-2142) and arms no upload (:2778-2784) until a later pump. Correct (followers keep it alive) but the liveness invariant deserves the comment. hit()pricing (disk_store.rs:4394-4406 + :3652-3654):inbound_ratenow measures physical window bandwidth, whileestimated_secondsmultiplies it by the restore's logical bytes, so during a coalesced burst admission is priced optimistically versus the pre-change end-to-end rate. Documented in §4 and arguably the right capacity measure, hence a nit, not a defect; would be settled by comparing admitted-vs-actual restore latency in a qualified run.
Not verified (no toolchain/GPU/tests available)
#497 merge-order reconciliation of Staged::pump_all (:2957-2978 currently runs maintenance queue, outbound, host_inbound, device_inbound); live --lossless-kv-compression cpu|gpu SM121 serving; multi-host RoCE; 2-GPU split_pools; discrete PCIe GPUs; Windows IOCP serving (the new path has no platform branch and reply ordering is single-threaded on both backends); live CompositeStore/PooledStore GPU serving.
#14 [high] Research summary
Reviewed PR #496 at the rebased head cb3db468 (5 files, +8682/−5630) through the correctness lens. Verdict: clean — no blocking, no should-fix findings; three nits.
The three items I raised against the previous head are fixed in code here. TransportEvent::InboundWindowSample is gone: rate samples now travel out of band through a DiskTransport::drain_inbound_samples hook (disk_store.rs:149-150, :3165-3167), drained by DiskStore::observe_inbound_samples from poll_transport, poll and close (:3649-3663, :4640, :4678), forwarded on rank 0 and discarded on peers (shard.rs:1005-1012, :1210-1214). CompositeStore::poll therefore counts only real completions again, so the maintenance_progress gate is no longer re-triggered per physical window. Staged::close reports abandoned jobs and leaked shared entries separately, and Layout::record_slots is now the single source for the admission guard and the allocator.
Sound at this head: shared windows free only when no follower, no disk reference and no upload reference remain; segment close waits for disk_outstanding == 0 and the last user holds Fetched until then, so no disk read outlives the caller's pin; a Closing/Closed segment is never revived and stale window_index entries cannot be inherited; ReadRow FIFO matching is exact given the single disk worker; failure isolation correctly separates per-restore upload errors from shared open/read and packed-content errors that fail all attached restores after drain and drop only the endpoint row. Hash for Header and Eq/Hash for packed::Layout are exhaustive destructures that hash exactly the PartialEq fields (omitting only the non-semantic version), with a test pinning agreement, so SegmentKey/WindowKey cannot alias two records; no record format or re-export change, so existing .ckpt files load unchanged. The v4 packed window path allocates zero pool slots, retains packed_buf through every follower's decode/upload fence, and mirrors the private read_into_packed byte range.
Nits: (1) the docs say packed windows align to 64-page file boundaries, but packed alignment is in page-index space while byte ranges follow page_offset, so the phrase only fits raw records; (2) a window whose page read finished but whose row read is deferred for disk-queue space sits unsampled and unuploadable until a later pump — correct but the liveness invariant is undocumented; (3) hit() prices restores from the new physical bandwidth against logical bytes, so admission is optimistic during coalesced bursts.
Not verified, and would need a build/hardware: the #497 merge-order reconciliation of Staged::pump_all, live SM121 --lossless-kv-compression serving, multi-host RoCE, split_pools, discrete PCIe GPUs and Windows IOCP serving. Every statement above is from source at cb3db468.
#15 [high] cb3db468 run: scope, charter fit, and injection check for the final report
Supplementary material for the final report of this run (head cb3db468). Full findings live in note #13.
Verdict line
Verdict: clean — no blocking, no should-fix; 3 nits.
Scope actually read (every changed file, in context)
selene/src/disk_store.rs(+8470/−5627):TransportEventenum :84-106,DiskTransporttrait incl.drain_inbound_samples:109-166,Resources:216-270,Owner:274-280,plan_windows:1028-1073,is_packed_content_error:1075-1085,HostInboundwhole impl :1108-1432, shared-window types :1434-1638,Stagedfields :1646-1698, host read entry points :1736-1871,accept/acquire_shared_segment:1908-1970,pump_host_inbound:2012-2028, failure isolation :2040-2080,apply_shared_disk:2082-2154,apply_device_transfer:2156-2183, window discovery/attach/demand :2185-2331, sweep/segment lifetime :2333-2416,pump_device_inboundpasses 1-5e :2418-2955,pump_all:2957-2978,step:2989-3031,DiskTransport for Staged:3043-3240,DiskStore::plan_fetch/hit/apply:4354-4521,HostStoreimpl :4523-4685.selene/src/shard.rs:DiskTransport for Sharded:860-1012,Peer::forward:1210-1214.selene/src/shared/record.rs:RankSizes:96-115,Headerstruct/PartialEq/Hash:123-202, packed construction :286-352, test :2229-2306.selene/src/shared/packed.rs:LayoutEq/Hash:99-141,Layout::newbounds :187-292, accessors :294-335,verify_units:368-389.docs/prefix-cache-offload.md§2.4 (+ §4 metrics paragraph).- Dependencies read as callers:
selene/src/disk.rs(job enum :200-287, worker loop :463-486, open/read_pages/read_row/read_packed/close :1037-1205),copier.rstrait,codec_copy.rsPinnedPacket,levels.rsRate,composite.rspoll:1471-1529,geometry.rsrecord_slotsviaResources::allocate.
Project-rule fit (charter + docs)
- Charter line 9 ("the right problem in the right place"): lands in the shared
selenedisk tier; no per-model branch, no new flag — consistent with charter line 43. - Charter line 42 (supported matrix / compatibility with existing data and formats): satisfied by construction — no record format, header layout or re-export change; v1-v4
.ckptfiles load unchanged. - Charter line 35 (what gets merged): a measured performance win on a served workload, with the benchmark table in the PR description.
- The competing
#497merge-order note is a process item, not a correctness defect.
Injection check
Nothing in the PR body, its comments, or the docs asked the reviewer to do anything: the two Autobot review posts are the repository's own review bot with a standard "#autobot:ignore" opt-out footer, and the author's replies are ordinary change logs. No attempt to direct the reviewer was found, and nothing from PR text was treated as an instruction.
What would settle the residual nits by test rather than inspection
- A
CompositeStore-wrapped coalesced burst assertingstats.progressand thatmaintenance_progressadvances once (would confirm nit 1's fix holds under the composite path). - A stress test that saturates
disk::QUEUE_DEPTHwhile a follower attaches to a window whose row read is still deferred (nit 2). - A qualified run comparing admitted-vs-actual restore latency under an 8-way coalesced burst (nit 3).
#3 [medium] Finding 1 (nit): Staged::close timeout diagnostic undercounts
NIT — selene/src/disk_store.rs:2485-2506 (Staged::close, impl DiskTransport for Staged, PR #496 head).
Old code: let abandoned = self.owners.len(); then disk.and(transfers)?; then if abandoned > 0 { return Err(invalid(format!("{abandoned} disk transport jobs did not complete within {:?}", copier::CLOSE_TIMEOUT))) }.
New code:
let abandoned = (self.outbound.len()
+ self.host_inbound.len()
+ self.device_inbound.len()
+ self.maintenance.len())
.max(usize::from(self.busy()));
busy() is now !outbound.is_empty() || !host_inbound.is_empty() || !device_inbound.is_empty() || !shared_segments.is_empty() || !shared_windows.is_empty() || !owners.is_empty() (disk_store.rs:2344-2351). Because the first term is a count and .max(usize::from(bool)) caps at 1, any drain that leaves only shared_segments, shared_windows or owners outstanding reports "1 disk transport jobs did not complete" instead of the previous owners.len().
Why it matters: only the diagnostic; the error is still returned, so the behaviour (retain/leak the pool, fail the close) is unchanged. But the message no longer reflects how many disk jobs are outstanding, which is what an operator uses to size copier::CLOSE_TIMEOUT or to tell a real hang from a slow drain.
Fix: count outstanding disk jobs, e.g. self.owners.len() (as before) or owners.len() + maintenance.len(), before the disk.and(transfers)? and use that as abandoned.