Github user pnowojski commented on the issue:
https://github.com/apache/flink/pull/5200
Btw, doesn't the
`org.apache.flink.streaming.connectors.kafka.internal.KafkaConsumerThread#setOffsetsToCommit`
have a race condition on those lines:
```
// record the work to be committed by the main consumer thread
and make sure the consumer notices that
if (nextOffsetsToCommit.getAndSet(offsetsToCommit) != null) {
log.warn("Committing offsets to Kafka takes longer than
the checkpoint interval. " +
"Skipping commit of previous offsets
because newer complete checkpoint offsets are available. " +
"This does not compromise Flink's
checkpoint integrity.");
}
this.offsetCommitCallback = commitCallback;
```
(`getAndSet` followed by `volatile`) with
`org.apache.flink.streaming.connectors.kafka.internal.KafkaConsumerThread#run`?
However currently it doesn't seem to be so important, since:
1. it's used only for metrics
2. and only first `successfulCommits.inc()` can be omitted because of
that., because (at least now) `offsetCommitCallback` is a `write-once`
variable, and any subsequent overwrites, are overwriting it to the same value.
---