Skip to content

fix(scheduler): discard a rolled-back stage's partial outputs before it re-runs - #2677

Open
akshaychitneni wants to merge 1 commit into
apache:mainfrom
akshaychitneni:fix/rollback-duplicate-outputs
Open

akshaychitneni wants to merge 1 commit into
apache:mainfrom
akshaychitneni:fix/rollback-duplicate-outputs

Conversation

@akshaychitneni

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #.

Rationale for this change

When a running stage is rolled back (a fetch failure, or losing an executor
whose output it reads), it re-runs every task. But each finished task had
already pushed its output locations to the next stage's inputs (or, for a final
stage, to the job's output) when it reported, and those were kept. After the
re-run those partitions are recorded twice, so the query returns duplicated
rows with no error.

It happens whenever a task of the stage succeeds before another fails: rare
when every task reads from the lost executor, but routine when each task reads a
single upstream partition.

What changes are included in this PR?

  • rollback_running_stage now drops the stage's entries from its linked stages'
    inputs, or from the job's output locations for a final stage, before the stage
    re-runs.
  • Two execution-graph tests: a final stage and an intermediate stage, each rolled
    back after a partial success. Both fail without the fix.
  • Chaos Scenario K: kill a map-side executor after some final-aggregate tasks
    have finished; the result must match the baseline.

The adaptive graph keeps stage outputs in its planner and does not re-run a
rolled-back stage yet, so it is unchanged.

Are there any user-facing changes?

No, other than queries that hit this case no longer return duplicated rows.

…it re-runs

A finished task's output locations are pushed to the stage's output links
(or, for a final stage, to the job's output) as soon as it reports. When a
running stage is rolled back - on a fetch failure, or on losing an executor
whose output it reads - it re-runs every task, but the outputs its finished
tasks had already pushed were kept. Those partitions were then produced
twice, and the query returned duplicated rows.

It shows whenever a task of the stage succeeds before another fails, which
is rare when every task reads from the lost executor, but routine when each
task reads a single upstream partition.

rollback_running_stage now drops the stage's entries from its linked
stages' inputs, or from the job's output locations for a final stage,
before the stage re-runs. The adaptive graph keeps stage outputs in its
planner and never re-runs a rolled-back stage yet, so it is unchanged.

Tests: two execution-graph tests, a final stage and an intermediate stage
rolled back after partial success, and a chaos scenario that kills a
map-side executor after some final-aggregate tasks have finished.
@akshaychitneni

Copy link
Copy Markdown
Contributor Author

cc @milenkovicm @andygrove @comphead
I encountered this issue with stage rollback with cache test cases

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