danielcweeks commented on code in PR #17933:
URL: https://github.com/apache/iceberg/pull/17933#discussion_r3938230688


##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/Channel.java:
##########
@@ -122,8 +122,11 @@ protected void consumeAvailable(Duration pollDuration) {
       records.forEach(
           record -> {
             // the consumer stores the offsets that corresponds to the next 
record to consume,
-            // so increment the record offset by one
-            controlTopicOffsets.put(record.partition(), record.offset() + 1);
+            // so increment the record offset by one. Keep the highest 
position seen for the
+            // partition: a re-read of the control topic, e.g. after a 
rebalance resumes from the
+            // last committed offsets, would otherwise move the tracked 
position backwards and
+            // commit a consumer offset behind records that were already 
handled.
+            controlTopicOffsets.merge(record.partition(), record.offset() + 1, 
Long::max);

Review Comment:
   @twthorn Does this address the same issue as 
https://github.com/apache/iceberg/pull/17552?



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to