syhily commented on code in PR #20725:
URL: https://github.com/apache/flink/pull/20725#discussion_r960277130
##########
flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/enumerator/PulsarSourceEnumerator.java:
##########
@@ -114,7 +135,12 @@ public void addSplitsBack(List<PulsarPartitionSplit>
splits, int subtaskId) {
// If the failed subtask has already restarted, we need to assign
pending splits to it.
if (context.registeredReaders().containsKey(subtaskId)) {
- assignPendingPartitionSplits(singletonList(subtaskId));
+ LOG.debug(
+ "Reader {} has been restarted after crashing, we will put
splits back to it.",
+ subtaskId);
+ // Reassign for all readers in case of adding splits after scale
up/down.
+ List<Integer> readers = new
ArrayList<>(context.registeredReaders().keySet());
+ assignPendingPartitionSplits(readers);
Review Comment:
This is a good question. Flink will restart the pipeline every time we scale
up/down.
`addSplitsback` is called only when we enable [Restart Pipelined Region
Failover
Strategy](https://nightlies.apache.org/flink/flink-docs-master/docs/ops/state/task_failure_recovery/#restart-pipelined-region-failover-strategy)
and some readers failed. We will put these splits back to Enumerator and
reassign them after the failed readers started.
--
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]