Repository navigation
multilevel: bound and drain background writes - #2898
Open
codeandsolder wants to merge 6 commits into
Open
codeandsolder wants to merge 6 commits into
codeandsolder wants to merge 6 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2898 +/- ##
==========================================
+ Coverage 78.13% 78.43% +0.29%
==========================================
Files 74 74
Lines 43570 44020 +450
==========================================
+ Hits 34043 34525 +482
+ Misses 9527 9495 -32 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
codeandsolder-git-wrangler
Bot
force-pushed
the
upstream-pr/multilevel-slow-write-drain
branch
4 times, most recently
from
October 10, 2026 19:56
d495afa to
c5fe6f9
Compare
codeandsolder-git-wrangler
Bot
force-pushed
the
upstream-pr/multilevel-slow-write-drain
branch
2 times, most recently
from
October 18, 2026 08:13
a10de42 to
da17ec6
Compare
codeandsolder-git-wrangler
Bot
force-pushed
the
upstream-pr/multilevel-slow-write-drain
branch
from
October 20, 2026 01:30
cf12da8 to
a1d593a
Compare
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.
Fixes #2819.
Summary
Multi-level cache writes and backfills can outlive the request that started them. If those tasks are detached without an explicit shutdown boundary, the runtime can cancel accepted cache work before slower cache levels have finished.
This change:
slow_write_concurrency(default4, minimum1);Storage::drain_background()hook so shutdown does not need to know the concrete storage type;Background-task accounting uses a constant-time atomic pending counter plus
Notify, rather than retaining and repeatedly scanning a growing list ofJoinHandles. This keeps bookkeeping bounded even when many writes are waiting on the slow-level semaphore.Panicking background tasks still release their pending-task accounting, so shutdown cannot wait forever on a task that has already terminated.
As a result,
--stop-serverdoes not return before accepted background cache work reaches its shutdown durability boundary.The existing client-request shutdown timeout and the cache-task drain remain separate phases. A stalled background cache operation is still bounded by the daemon's shutdown timeout.
Testing
cargo +1.99.0 fmt --all -- --checkcargo +1.91.0 clippy --locked --all-targets -- -D warnings -A unknown-lints -A clippy::type_complexity -A clippy::new-without-defaultAI Disclosure: AI developed, human directed and reviewed