Repository navigation
fix(kv-router): fence stale TTL removals after refresh - #15476
Open
bojiang-li wants to merge 3 commits into
Open
bojiang-li wants to merge 3 commits into
bojiang-li wants to merge 3 commits into
Conversation
Signed-off-by: bojiang-li <327132355+bojiang-li@users.noreply.github.com>
bojiang-li
temporarily deployed
to
external_collaborator
October 1, 2026 10:05 — with
GitHub Actions
Inactive
bojiang-li
temporarily deployed
to
external_collaborator
October 1, 2026 10:05 — with
GitHub Actions
Inactive
Contributor
|
👋 Hi bojiang-li! Thank you for contributing to ai-dynamo/dynamo. Just a reminder: The 🚀 |
Contributor
bojiang-li
marked this pull request as draft
October 1, 2026 11:16
Signed-off-by: bojiang-li <327132355+bojiang-li@users.noreply.github.com>
bojiang-li
temporarily deployed
to
external_collaborator
October 1, 2026 11:43 — with
GitHub Actions
Inactive
bojiang-li
marked this pull request as ready for review
October 1, 2026 11:43
Signed-off-by: bojiang-li <327132355+bojiang-li@users.noreply.github.com>
bojiang-li
temporarily deployed
to
external_collaborator
October 14, 2026 03:41 — with
GitHub Actions
Inactive
Contributor
Author
|
Hi @ai-dynamo/dynamo-router-codeowners, I resolved the conflict with main in 784b6db, keeping the new LaneLookup and the TTL ordering fix. On Spark, 1131 tests passed with 3 ignored, and strict Clippy and formatting passed. I linked the relevant part of #12785. Could you review when you have a chance? Thanks! Prepared with Codex assistance. |
1 task done
This branch was previously deployed
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.
Overview:
Approximate TTL removals can erase refreshed KV coverage: an expired removal may already be queued when the same block is stored again, and the thread-pool caller only registers the refreshed TTL after receiving its store acknowledgement. Cancelling that caller after enqueueing can also leave a successful store without any TTL.
Order successful-store registration, expiration validation and reset cleanup with the worker's mutation stream. A queued expired removal can no longer delete refreshed or newly LRU-owned coverage; an applied store retains its TTL even if its caller is cancelled.
Details:
Expiration creates removable ownership that refresh, Forget and worker/rank reset invalidate. A removal consumes that ownership immediately before backend application. Successful stores register TTL before their callers are acknowledged. Rank reset bookkeeping completes before the next mutation; whole-worker cleanup remains at the existing final removal barrier after all lanes have drained. The direct indexer's actor applies the same expiration check.
Keep the public
WorkerTaskvariants and constructors and the existingSyncIndexer::workersignature unchanged. An additive providedworker_with_retentionmethod accepts an opaqueWorkerTaskReceiverthat exposes only original worker tasks. Compressed radix, positional and lower-tier workers reuse their existing loops and perform bookkeeping between tasks, retaining one thread and one input queue per lane. The default preserves existing external implementations through a compatibility dispatch thread; those implementations can override the additive method to use the same inline path. This extra thread/queue cost applies only to legacy external backends with retention enabled. Queue-depth observations include both queues on that fallback path.The receiver settles ready final store/worker-removal acknowledgements even when a worker returns before its next receive. Drop never waits for an outstanding acknowledgement. An unacknowledged rank removal does not claim completion when its lane exits.
Validation:
cargo test --locked --offline -p dynamo-kv-router --lib --features bench: 1083 passed, 2 existing ignored. Includes an exhaustive downstream-style backend using the original worker API, early worker return, caller cancellation, panic/error/dropped acknowledgements, single-thread-runtime shutdown, and fallback queue-depth observations.cargo clippy --locked --offline -p dynamo-kv-router --lib --tests --features bench -- -D warnings: passed.cargo fmt --all -- --checkandgit diff --check: passed.AI assistance: Codex helped investigate, implement and test this change. The patch also received independent agent review; reported tests ran locally on CPU.
Main refresh validation
Merged main
c872a52bbin784b6dbf9, retaining the newLaneLookupimplementation inside the existing retention worker wrapper. No additional tree or locking behavior was changed during conflict resolution.On DGX Spark, Linux ARM64 and Rust 1.96.1:
cargo test --locked -p dynamo-kv-router --lib --features benchpassed 1131 tests with 3 ignored. Strict Clippy for the library and tests with the same features passed, as did Rust formatting and diff checks. This is CPU validation, not an inference benchmark.Where should the reviewer start?
Start with
indexer/worker_receiver.rsfor acknowledgement ownership, inline completion, legacy adaptation and shutdown. Then reviewindexer/pruning.rsfor expiration authorization and invalidation, and the gated mutation tests inindexer/thread_pool.rs. The three builtin backend changes reuse their existing worker loops; tree algorithms and structural locking are unchanged.Related Issues
Part of #12785. This PR addresses stale queued expiration only; the per insert deadline work remains separate.
Related work: #12793 separately adds per-insert TTL support and defers the stale-removal ordering problem. This PR does not implement its per-insert TTL feature or change the expiry-heap rebuild policy, and does not close that PR.