Skip to content

fix(scheduler): keep AQE stage in the graph when a stage transition fails - #2613

Open
DeviousCardi wants to merge 1 commit into
apache:mainfrom
DeviousCardi:fix/2594-aqe-stage-restore
Open

DeviousCardi wants to merge 1 commit into
apache:mainfrom
DeviousCardi:fix/2594-aqe-stage-restore

Conversation

@DeviousCardi

Copy link
Copy Markdown

Which issue does this PR close?

Closes #2594.

Rationale for this change

AdaptiveExecutionGraph::resolve_stage, rollback_running_stage and rollback_resolved_stage removed the stage from stages before running the fallible plan rewrite (to_resolved / to_unresolved). If the rewrite failed, ? returned early and the stage was never put back, so later lookups failed with "stage not found" instead of the original error. StaticExecutionGraph already avoids this.

What changes are included in this PR?

  • The three AQE methods now get the stage, build the new one, and insert it only once that succeeds, the same way StaticExecutionGraph does it. succeed_stage, fail_stage and rerun_successful_stage keep remove because their conversions can't fail.
  • FailingPlanRewriteExec / fail_plan_rewrites move from the static graph's test module to test_utils.rs so both graphs can use them. This is a move only; the static graph's tests are otherwise unchanged.
  • New state/aqe/test/stage_transitions.rs with three tests that mirror the static graph's tests. Each one forces the plan rewrite to fail and checks that the stage is still in the graph in its original state (same plan, attempt number, and pending and running tasks). All three fail on main and pass with this change.

cargo test -p ballista-scheduler passes, and so does cargo clippy -p ballista-scheduler --all-targets --all-features -- -D warnings.

Are there any user-facing changes?

No.


AI disclosure: Claude Code prepared the implementation and tests. I reviewed them and will reply to review comments myself.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y1b55sEL1gA1c3FCMcQCbm

…ails

AdaptiveExecutionGraph::resolve_stage, rollback_running_stage and
rollback_resolved_stage removed the stage from `stages` before running
the fallible plan rewrite, so an error dropped the stage from the graph.
Look the stage up, build the new stage, and only then insert it, as
StaticExecutionGraph already does.

The FailingPlanRewriteExec test helper moves from the static graph's
tests to test_utils so the adaptive graph's tests can use it too.

Closes apache#2594

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y1b55sEL1gA1c3FCMcQCbm
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.

AQE: resolve_stage and rollback_*_stage drop the stage from the graph when the conversion fails

1 participant