Repository navigation
fix(client): let a partial holder steal the covered tail of a busy leg (#2303) - #2304
Merged
Merged
Conversation
#2303) A freed lane stole from a busy lane only when its coverage held the victim's whole range in flight. In a mistral-7b bundle pull, fra1 held blocks 0-43 of a shard as one 2.95 GB leg. hel1 covered blocks 18-45, went idle in seconds and could not steal, so the leg ran alone for 8 min on one stream. covered_suffix_start gives the start of the longest suffix of a range whose blocks a source covers. steal_split ranks ranges by the missing bytes in that suffix, after the MIN_SPLIT_SIZE / MIN_STOLEN floors, and moves a split that lies before the suffix to its start, so the victim keeps every byte before it. A fully covered range steals exactly as before. Work::plan_steal is the read-only half of Work::steal. has_work_for runs it, so a holder counts as having work, and starts, only when it would steal now: a late partial holder starts and steals, and a holder whose only option is a tail below the floors no longer takes a lane slot to park. ADR 039 states the covered-part rule. Refs #2303 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation matches the stated scheduling rules and includes focused unit, scheduler, and end-to-end coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Enables partial holders to steal covered tails from busy client fetch legs.
Changes:
- Adds covered-suffix detection and tail-aware splitting.
- Reuses steal planning to avoid starting unusable lanes.
- Adds scheduler coverage plus ADR and changelog updates.
| File | Description |
|---|---|
crates/client/src/segment.rs |
Implements covered-tail split selection and tests. |
crates/client/src/scheduler.rs |
Integrates read-only steal planning and partial-holder scheduling. |
crates/client/src/coverage_plan.rs |
Finds the longest covered suffix. |
CHANGELOG.md |
Documents the fix. |
adr/039-multi-source-parallel-fetch.md |
Specifies covered-tail stealing behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code Coverage OverviewLanguages: Rust Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit cc9efd2 in the Show a line coverage summary of the most impacted files.
|
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A freed lane stole from a busy lane only when its 64 MiB block coverage held the victim's whole range in flight. A partial holder that covered the back of a big leg could never steal it. In the 2026-10-03 testnet mistral-7b bundle pull, fra1 held blocks 0–43 of shard
b32596as one 2.95 GB leg. hel1 covered blocks 18–45 and went idle in seconds, so fra1 served the leg alone: 497.7 s at ~6 MB/s, with the node idle 98% of the time waiting on the client. That leg set the run's wall time.coverage_plan::covered_suffix_startgives the start of the longest suffix of a range whose blocks the source covers. It returnsNonewhen the source does not cover the range's last block.segment::steal_splittakescovered_fromin place ofcovers. It first drops any range belowMIN_SPLIT_SIZEoverall, or belowMIN_STOLENin its covered suffix. It then picks the range whose covered suffix misses the most. A split by rate that lies before the suffix moves to the suffix's start, and the victim keeps every byte before it.Work::plan_stealis the read-only half ofWork::steal.has_work_forcalls it, so a holder starts only when it would steal now. A late partial holder starts and steals. A holder whose only option is a tail below the floors does not take a lane slot just to park.Closes #2303
Reviewer notes
covered_suffix_startreturnsSome(start)in exactly the cases wherecovers_byte_rangereturned true. The floor filter before the argmax keeps the old victim, including on ties.Work::steal, which restarts the tail at the victim's frontier, stays at or past the split.has_work_foris approximate. Its dry run treats every byte in flight past a victim's received frontier as missing, and it has no rate for the stealer. So it declines only steals that the size floors or the coverage rule forbid.hashfield.Verification
cargo fmt -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo nextest run -p decdn-client(554 passed) and-p decdn-node -p decdn-cli(2446 passed)RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-itemsa_late_tail_holder_steals_the_covered_tail_and_fetches_each_byte_onceruns end to end.a_tail_holder_steal_moves_the_split_into_its_covered_suffixa_tail_holder_has_work_only_while_its_covered_suffix_is_stealablea_partial_holder_steals_the_covered_tail_of_a_busy_legsteal_splitandcovered_suffix_start.418c5522, with an earlier version of this patch (same steal logic, beforehas_work_forran the steal check):b32596took 305 s, against 501 s on main.7cbb48, which only bcl serves. They ran at 1–2 MB/s each, against ~6 MB/s on main, with the same 145 legs and the same 73 extra streams. bcl's serve spans show the node 97% idle waiting on the client, so the cause looks like the bcl→client path. One run cannot prove that.cc9efd2b, 02:06 UTC, same fleet: 5m42s, 0 failed, same bytes, no WARN or ERROR, 16 steals, 9 victim stops, nothing re-queued.b32596took 244 s (main: 501 s).7cbb48took 337 s and ended 16 s after the last shard.CHANGELOG.mdentry addedfix(client): …🤖 Generated with Claude Code