Repository navigation
[FLINK-38770][runtime] Apply jobvertex parallelism overrides to StreamGraph submissions - #29662
MartijnVisser wants to merge 3 commits into
Conversation
39fb5fd to
c7936e9
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Valid parallelism overrides still fail because forward-group validation mishandles pending overrides and default sentinels, while incremental partition sizing uses stale consumer parallelism.
3 open issues
What changed in this PR
This PR restores job-vertex parallelism overrides for StreamGraph submissions, addressing the submission-path change that left autoscaler settings ineffective in Flink 2.x.
Changes:
- Resolve cluster and job overrides in the Dispatcher and preserve them in submitted StreamGraphs.
- Apply overrides during graph generation, reconcile adaptive forward groups, and improve diagnostics.
- Add regression coverage for submission paths, schedulers, failover, and savepoint restore; update configuration documentation.
| File | Description |
|---|---|
| flink-tests/src/test/java/org/apache/flink/test/scheduling/ParallelismOverridesTestUtils.java | Shared cluster setup and vertex-ID helpers. |
| flink-tests/src/test/java/org/apache/flink/test/scheduling/ParallelismOverridesJMFailoverITCase.java | Tests overrides across JobMaster failover. |
| flink-tests/src/test/java/org/apache/flink/test/scheduling/ParallelismOverridesITCase.java | Tests configuration precedence and forward groups across schedulers. |
| flink-tests/src/test/java/org/apache/flink/test/scheduling/ExecutionPlanSubmissionParityITCase.java | Compares submission paths and captures a sizing limitation. |
| flink-tests/src/test/java/org/apache/flink/test/checkpointing/ParallelismOverridesSavepointITCase.java | Tests savepoint restoration with overridden parallelism. |
| flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorParallelismOverridesTest.java | Exercises the full graph generator. |
| flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/ParallelismOverridesGeneratorTestBase.java | Shared topology-preservation and validation tests. |
| flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/AdaptiveGraphManagerParallelismOverridesTest.java | Exercises incremental graph generation. |
| flink-runtime/src/test/java/org/apache/flink/runtime/jobgraph/JobVertexParallelismOverridesTest.java | Tests override merging, parsing, and application. |
| flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/DispatcherParallelismOverridesTest.java | Tests resolution, persistence, and recovery behavior. |
| flink-runtime/src/main/java/org/apache/flink/streaming/api/graph/util/JobVertexBuildContext.java | Carries overrides during vertex construction. |
| flink-runtime/src/main/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGenerator.java | Applies overrides when vertices are created. |
| flink-runtime/src/main/java/org/apache/flink/streaming/api/graph/AdaptiveGraphManager.java | Reconciles overrides with adaptive forward groups. |
| flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobVertexParallelismOverrides.java | Centralizes override resolution and application. |
| flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/forwardgroup/StreamNodeForwardGroup.java | Adds conflicting-parallelism diagnostics. |
| flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/forwardgroup/JobVertexForwardGroup.java | Adds conflicting-parallelism diagnostics. |
| flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/VertexInputInfoComputationUtils.java | Clarifies insufficient-subpartition errors. |
| flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java | Resolves overrides for both submitted plan types. |
| flink-core/src/main/java/org/apache/flink/configuration/PipelineOptions.java | Documents precedence, supported plans, and constraints. |
| docs/layouts/shortcodes/generated/pipeline_configuration.html | Updates the generated configuration reference. |
Review effort: Balanced
There was a problem hiding this comment.
@MartijnVisser Thanks for tackling this 🙏 It's a regression from 1.x that makes the operator autoscaler ineffective on 2.x, and resolving the map once in the Dispatcher, then applying it while vertices are created, reads well to me. I mostly looked at it from the streaming side, since that's what the autoscaler writes these overrides for.
The Copilot comments only affect adaptive batch. Streaming jobs never use the incremental generator, and the full generator applies every override before any output is sized. If fixing the batch cases grows the PR a lot, failing fast when overrides meet the incremental generator and following up separately would let the streaming fix land first.
Tests. The coverage is thorough. One case I'd add: with the adaptive scheduler, rescale a job in place over REST, then fail over the JobManager. Which wins, the override or the persisted resource requirements? That's the path the operator uses for in-place scaling on 2.x.
Backport. Since this is a regression from FLINK-36065, it'd be worth backporting to the maintained 2.x branches. We run 2.3 with this commit backported; results are in a separate comment.
|
Some test results for this PR (operator 1.16.1, Flink 2.3.0, application mode, Fluss sources and sinks). Without the fix (Flink 2.3.0):
With this PR (commit
Tested only for streaming SQL jobs, in application mode. |
…Graph submissions No test submitted a StreamGraph with pipeline.jobvertex-parallelism-overrides set. These fail on master, except the control cases: - ExecutionPlanSubmissionParityITCase: the same program as StreamGraph and as JobGraph yields the same vertices at the same parallelism on the default and the adaptive scheduler, with and without overrides. - ParallelismOverridesITCase: env.execute() with the map in the cluster configuration, the job configuration and both. - StreamingJobGraphGeneratorParallelismOverridesTest: over random programs an override changes exactly the overridden vertices; ids, operator ids, chaining and edges stay the same. - ParallelismOverridesJMFailoverITCase and ParallelismOverridesSavepointITCase: the override survives a job master failover and a savepoint restore. - ParallelismOverridesRescaleRecoveryITCase: after an in-place rescale through the resource requirements, a JobManager failover keeps the rescaled parallelism instead of the override. - DispatcherParallelismOverridesTest: the Dispatcher attaches the merged map to a StreamGraph, rejects invalid entries of the job configuration and leaves a recovered plan alone. - AdaptiveExecutionHandlerFactoryTest: the adaptive batch scheduler warns that it ignores the map for an incrementally generated StreamGraph. Generated-by: Claude Code (Claude Fable 5.1, Claude Opus 5.5)
…mGraph submissions The Dispatcher applied pipeline.jobvertex-parallelism-overrides only to a submitted JobGraph. Since FLINK-36065 clients submit a StreamGraph, which the job master turns into a JobGraph later, so the option had no effect. - Resolve the map once in the Dispatcher (job configuration over cluster configuration) and store it in the plan's job configuration, so a recovered plan replays it. - Apply it in StreamingJobGraphGenerator.createJobVertex, after the vertex id is computed; ids and chaining do not change. - Check the values of the job configuration at submission for both plan types, and reject an override above the max parallelism configured for the vertex. - Drop entries whose key is not a job vertex id with a warning. - The incremental generator of the adaptive batch scheduler sizes the inputs of a vertex before the vertex id exists, so it does not apply the map and the scheduler logs a warning instead. Generated-by: Claude Code (Claude Fable 5.1, Claude Opus 5.5)
…or StreamGraphs too Generated-by: Claude Code (Claude Opus 5.5)
c7936e9 to
77b3fcb
Compare
|
Thanks for testing this. Adaptive batch warns instead of failing, since a map in the cluster configuration would fail unrelated batch jobs. After an in-place rescale and a failover the persisted requirements win, see |

What is the purpose of the change
pipeline.jobvertex-parallelism-overridesis applied by the Dispatcher only to a submitted JobGraph. Since FLINK-36065 clients submit a StreamGraph, so on 2.x the option has no effect; the operator autoscaler writes its decisions into it. Verified with a probe job: 1.20.5 applies it in session and application mode, 2.3.0 does not;git bisectnames 64cbcd2.The Dispatcher writes the resolved map into the submitted plan's job configuration. A StreamGraph persisted in HA before this fix recovers without overrides, as a JobGraph does today.
The adaptive batch scheduler logs a warning and does not apply the map to a StreamGraph it generates incrementally; fixing that is a follow-up.
Supersedes #27334, which moved the overrides into the scheduler factories; the diagnosis and the
env.execute()test idea are Barak's.Brief change log
JobVertexParallelismOverrides) and store it in a StreamGraph's job configurationStreamingJobGraphGenerator.createJobVertexapplies it after the vertex id is computedVerifying this change
This change added tests and can be verified as follows:
ForwardEdgeParallelismMismatchOverridesITCasenow also submits StreamGraphsGET /jobs/<id>shows 4 and the job master logsChanging job vertex ... parallelism from 1 to 4, in session and application mode, as on 1.20.5Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Claude Fable 5.1, Claude Opus 5.5)