spuru9 commented on code in PR #305:
URL:
https://github.com/apache/flink-connector-kafka/pull/305#discussion_r3971043240
##########
flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/enumerator/KafkaSourceEnumerator.java:
##########
@@ -565,6 +588,14 @@ PartitionChange getPartitionChange(
(reader, splits) ->
splits.forEach(
split ->
dedupOrMarkAsRemoved.accept(split.getTopicPartition())));
+ // Exclude partitions whose split initialization is currently
in-flight on the
+ // worker thread. Without this, a discovery cycle that fires before
+ // handlePartitionSplitChanges runs would re-dispatch
initializePartitionSplits
+ // for the same partitions, leading to duplicate split assignments.
+ partitionsBeingInitialized.forEach(
+ (tp) -> {
+ newPartitions.remove(tp);
+ });
Review Comment:
**nit:** Can just be `removeAll`, no need to loop.
```suggestion
newPartitions.removeAll(partitionsBeingInitialized);
```
--
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]