lianetm commented on code in PR #23725:
URL: https://github.com/apache/kafka/pull/23725#discussion_r4297099589


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/CommitEvent.java:
##########
@@ -31,6 +32,11 @@ public abstract class CommitEvent extends 
CompletableApplicationEvent<Map<TopicP
      */
     private final Optional<Map<TopicPartition, OffsetAndMetadata>> offsets;
 
+    /**
+     * Offsets that is calculated.
+     */
+    private volatile Optional<Map<TopicPartition, OffsetAndMetadata>> 
calculatedOffsets;

Review Comment:
   agree with the question from @liuliuOD , if we can reuse the same `offsets` 
seems cleaner, in the end a commit event always has a single set of offsets to 
commit (it's just that we may not have it handy when we create the event and 
need to set it later on). Would just adding the missing setter be enough?



##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/CommitEvent.java:
##########
@@ -73,6 +80,14 @@ public void markOffsetsReady() {
         offsetsReady.complete(null);
     }
 
+    public void updateCalculatedOffsets(final Map<TopicPartition, 
OffsetAndMetadata> calculatedOffsets) {
+        this.calculatedOffsets = Optional.of(calculatedOffsets);

Review Comment:
   should we check that this is only called when `offsets` is empty? (to avoid 
accidentally "overwrites"..the commit event should always have a single set of 
non-empty offsets)



-- 
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]

Reply via email to