1996fanrui commented on code in PR #29548:
URL: https://github.com/apache/flink/pull/29548#discussion_r4372171101
##########
flink-runtime/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java:
##########
@@ -1816,13 +1819,64 @@
List<RecordWriter<SerializationDelegate<StreamRecord<OUT>>>> createRecordWriters
private static void
replaceForwardPartitionerIfConsumerParallelismDoesNotMatch(
Environment environment, NonChainedOutput streamOutput, int
outputIndex) {
- if (streamOutput.getPartitioner() instanceof ForwardPartitioner
- &&
environment.getWriter(outputIndex).getNumberOfSubpartitions()
- !=
environment.getTaskInfo().getNumberOfParallelSubtasks()) {
- LOG.debug(
- "Replacing forward partitioner with rebalance for {}",
- environment.getTaskInfo().getTaskNameWithSubtasks());
- streamOutput.setPartitioner(new RebalancePartitioner<>());
+ final int producerParallelism =
environment.getTaskInfo().getNumberOfParallelSubtasks();
+ // The number of subpartitions isn't the consumer parallelism on a
POINTWISE edge, so the
+ // actual consumer parallelism is passed through the deployment
descriptor.
+ final int consumerParallelism =
environment.getWriterConsumerParallelism(outputIndex);
Review Comment:
Thanks for the reveiew.
Yes, it's intended. Before this fix:
- AdaptiveScheduler: always rebalances on a mismatch.
- DefaultScheduler: inconsistent. 1→M became a rebalance, but 2→4 didn't,
because the check used the number of subpartitions, which isn't the consumer
parallelism on POINTWISE edges.
Now both schedulers rebalance, as FLINK-30213 intended. Users who need the
old behavior can set KEEP_FORWARD.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]