refactor(core): remove dead per-store WAL cleanup timer - #166
Merged
Conversation
`RolloutStore::spawn_periodic_cleanup` (and its `cleanup_interval_secs` option/field) had no production caller: WAL merge is now driven by the server's process-wide `spawn_global_sweeper` and the master's fan-out `MergeWal` sweep, both of which call `cleanup_own_shard` directly. Drop the per-store timer, its option/field, and its two tests to remove a confusing third scheduling path. The server-level `rollout_cleanup_interval_secs` (driving the active global sweeper) is retained. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
This was referenced Jul 21, 2026
beinan
added a commit
that referenced
this pull request
Jul 22, 2026
…#168) ## Summary - `AppError::from_lance` took `impl Display` and string-matched the rendered message (`"not found"`, `"Invalid"`, `"DatasetNotFound"`). That is brittle (breaks on any Display wording change) and over-broad (any message containing `"Invalid"` — e.g. `InvalidTableLocation`, `InvalidRef` — became a 400). - Now takes `lance::Error` by value (re-exported as `LanceError` from `lance-context-core`) and matches **typed variants**: `DatasetNotFound`/`NotFound` → 404, `DatasetAlreadyExists` → 409, `InvalidInput`/`SchemaMismatch` → 400, else 500. - The one signal Lance exposes no dedicated variant for — "compaction already in progress", raised as an `ArrowError::InvalidArgumentError` folded into Lance's generic `Arrow` variant — is still matched by text, but checked **up front** so it keeps mapping to 409 `COMPACTION_IN_PROGRESS`. - All call sites already passed `lance::Error`, so no caller changes were needed. ## Test plan - [x] `cargo test -p lance-context-server error::` (typed-variant mapping + Arrow-wrapped compaction case) - [x] `cargo clippy -p lance-context-server -p lance-context-core` clean - [x] `cargo fmt --all` Independent of #166 and #167. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4 <noreply@anthropic.com>
beinan
added a commit
that referenced
this pull request
Jul 22, 2026
## Summary - `ShardWriter` has no `Drop`, so its background tasks are only reclaimed by an explicit `close().await`. At process shutdown the runtime is about to stop, so the detached best-effort close in `RolloutStore::Drop` may never run — leaking those tasks / skipping a clean drain. - Adds `AppState::shutdown()`, which snapshots the resident LRU and awaits `RolloutStore::close()` on each handle. Wired into `main` right after `axum::serve(...).with_graceful_shutdown(...)` returns (connections already drained). Idempotent and a no-op on an empty cache. ## Test plan - [x] `cargo test -p lance-context-server state::` (incl. new `shutdown_closes_resident_writers`) - [x] `cargo clippy -p lance-context-server` clean - [x] `cargo fmt --all` Note: this branch is independent of #166; it does not touch the `cleanup_interval_secs` removal. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4 <noreply@anthropic.com>
Removing the `cleanup_interval_secs` field left several test `RolloutStoreOptions` literals specifying all remaining fields, so the trailing `..Default::default()` became redundant and tripped `clippy::needless_update` under `--all-targets` (CI runs `clippy --workspace --all-targets -- -D warnings`). Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
dcfocus
approved these changes
Jul 22, 2026
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.
Summary
RolloutStore::spawn_periodic_cleanupand itscleanup_interval_secsoption/field had no production caller. WAL merge is driven by two live paths instead: the server's process-widespawn_global_sweeperand the master's fan-outMergeWalsweep (feat(master): auto-sweep MergeWal from pending WAL generations #162), both callingcleanup_own_sharddirectly.RolloutStoreOptions.cleanup_interval_secsoption and the store field, the two dead tests, and stale doc/comment references. This eliminates a confusing third WAL-scheduling path.rollout_cleanup_interval_secs(which drives the active global sweeper) is retained unchanged.Net: 5 insertions, 220 deletions.
Test plan
cargo build -p lance-context-core -p lance-context-server -p lance-contextcargo test -p lance-context-core rollout(27 passed)cargo clippyclean on all three cratescargo fmt --all🤖 Generated with Claude Code