Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2108#discussion_r68086007
  
    --- Diff: 
flink-streaming-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducerBase.java
 ---
    @@ -261,7 +298,9 @@ public void invoke(IN next) throws Exception {
                } else {
                        record = new ProducerRecord<>(targetTopic, 
partitioner.partition(next, serializedKey, serializedValue, partitions.length), 
serializedKey, serializedValue);
                }
    -
    +           if(flushOnCheckpoint) {
    +                   pendingRecords++;
    --- End diff --
    
    The increment and decrement operations are not atomic. Thus, we have to 
guard them from concurrent access. Concurrent modifications can happen when 
you're in the `invoke` method and a callback is executed at the same time.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to