Skip to content

control-plane: warn when the scheduler is stuck reapplying a non-converging plan#6585

Open
aanufriev-celonis wants to merge 3 commits into
quickwit-oss:mainfrom
celonis:observe-stuck-reapply-loop
Open

control-plane: warn when the scheduler is stuck reapplying a non-converging plan#6585
aanufriev-celonis wants to merge 3 commits into
quickwit-oss:mainfrom
celonis:observe-stuck-reapply-loop

Conversation

@aanufriev-celonis

@aanufriev-celonis aanufriev-celonis commented Jul 9, 2026

Copy link
Copy Markdown

Summary

Make the indexing scheduler's "reapply last plan" control loop observable so a non-converging cluster can be detected and alerted on, instead of failing silently for an unbounded amount of time.

Part of #6601.

Problem

The control plane runs a periodic control loop (control_running_plan) that compares the running plan reported by indexers against the last applied plan. When the tasks differ (same nodes), the loop re-sends the identical plan.

If the last applied plan can never converge, for example, an indexer that never picks up its assigned tasks, or a stale/un-runnable plan referencing a shard that no longer exists, the loop reapplies the same plan every cycle indefinitely. Ingestion for the affected shards stalls, and currently this is invisible: the loop logs the same info line every ~30s with no counter, so a transient one-cycle propagation lag is indistinguishable from a cluster that has been stuck for hours, and there is nothing to alert on.

Change

  • Add num_consecutive_reapplies to IndexingSchedulerState. It increments on each reapply and resets to 0 on convergence or when a new plan is scheduled.

  • Once it reaches REAPPLY_LOOP_WARN_THRESHOLD (5 cycles, ~2.5 min at the 30s production interval), the per-cycle log escalates from info to warn, including the plan diff. The missing-vs-unplanned breakdown in the diff distinguishes an un-runnable task from a stale pipeline.

This is purely observability, no scheduling behavior changes.

Testing

  • New unit test test_control_running_plan_counts_consecutive_reapplies drives the reapply branch repeatedly, asserts the counter grows, then converges the indexer and asserts it resets to 0.

  • cargo test -p quickwit-control-plane passes.

  • cargo +nightly fmt and cargo clippy -p quickwit-control-plane --all-features --tests are clean.

@aanufriev-celonis
aanufriev-celonis requested a review from a team as a code owner July 9, 2026 15:34

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

https://github.com/quickwit-oss/quickwit/blob/f2848637b69a5c1e29c9fc7d560c44a184508b96/quickwit-control-plane/src/indexing_scheduler/mod.rs#L400-L401
P2 Badge Reset reapply counter when scheduling new plans

This reset only covers the control-loop path where node IDs differ, but normal model changes also schedule a fresh plan via ControlPlane::handle(RebuildPlan) calling rebuild_plan directly (control_plane.rs:453, and similarly rebalance at :1081). After a prior stuck plan has crossed the threshold, applying a new plan through those paths leaves num_consecutive_reapplies high, so the first normal post-reschedule mismatch is logged as a repeated non-convergence warning even though it is the first reapply for a different plan. Reset the counter when a new physical plan is actually applied/scheduled rather than only in this branch.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@aanufriev-celonis

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 11344d63f3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant