feat(master): unified task scheduler for compaction and WAL merge#149
Merged
Conversation
The periodic time-based WAL cleanup was gated by a second count threshold (cleanup_min_generations), so "interval elapsed" would not merge unless enough generations had also accumulated. That turned the intended "time OR count, whichever fires first" trigger into an AND: a shard whose interval elapsed but stayed below the count threshold never merged. Make the time trigger unconditional on count: cleanup_own_shard now merges whatever is pending (>=1 generation) the moment a pass runs. Remove the cleanup_min_generations option, the rollout_cleanup_min_generations server config, and the ROLLOUT_CLEANUP_MIN_GENERATIONS env/CLI flag. The count trigger (merge_after_generations) is unchanged; the two are now a strict OR. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Generalize the master's single-serial compaction driver into a unified task scheduler that runs Compact and MergeWal tasks with bounded concurrency. Same-dataset compaction stays serialized via a per-name in-flight gate; distinct experiments run concurrently under a global semaphore. MergeWal fans out to configured worker endpoints so each worker merges its own MemWAL shard (the master cannot fence a live writer). Adds a task queue API + UI view and a "Merge WAL" action. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
# Conflicts: # crates/lance-context-master/src/routes.rs # crates/lance-context-master/ui/src/App.tsx
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
CompactandMergeWaltasks with bounded concurrency (globalSemaphore) while keeping same-dataset compaction serialized via a per-name in-flight gate.POST /api/v1/internal/merge-wal/{name};MergeWaltasks fan out to configured--worker-endpointsso each worker merges its own MemWAL shard (the master cannot fence a live writer). Tolerates 404/no-shard, fails only if every worker errors.POST/GET /api/v1/tasks,GET /api/v1/tasks/{id}) and a master UI Task Queue view with a "Merge WAL" action. Old compact endpoints bridge onto the new task model for backward compat.Test plan
cargo test -p lance-context-api -p lance-context-server -p lance-context-master— all green (new scheduler tests: dedup, merge-wal-no-endpoints, merge-wal broadcast/sum, manual compaction)cargo clippy— cleannpm run build(ui) — succeeds--worker-endpoints; click Merge WAL → task Queued→Running→Done,pending_wal_generationsdrops to 0; multiple Compacts run at concurrency N, same-name serialized🤖 Generated with Claude Code