AHeise commented on code in PR #192:
URL:
https://github.com/apache/flink-connector-kafka/pull/192#discussion_r2409592648
##########
flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/enumerator/KafkaSourceEnumerator.java:
##########
@@ -96,7 +96,7 @@ public class KafkaSourceEnumerator
// initializing partition discovery has finished.
private boolean noMoreNewPartitionSplits = false;
// this flag will be marked as true if initial partitions are discovered
after enumerator starts
- private boolean initialDiscoveryFinished;
+ private volatile boolean initialDiscoveryFinished;
Review Comment:
I added a comment explaining the access pattern. The short answer is that I
haven't found a way to inject the current state of variable into the worker
thread. I could schedule the first discovery differently with
`context.callAsync(() -> discover(true));` and then schedule periodic discovery
differently but that's a bigger change.
Since it's not on the hot path whatsoever, I'd leave it on a better
documented volatile.
--
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]