amogh-jahagirdar commented on code in PR #17713:
URL: https://github.com/apache/iceberg/pull/17713#discussion_r4032523362


##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/Channel.java:
##########
@@ -119,21 +120,32 @@ protected void send(List<Event> events, 
Map<TopicPartition, Offset> sourceOffset
   protected void consumeAvailable(Duration pollDuration) {
     ConsumerRecords<String, byte[]> records = consumer.poll(pollDuration);
     while (!records.isEmpty()) {
-      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);
-
-            Event event = AvroUtil.decode(record.value());
-
-            if (event.groupId().equals(connectGroupId)) {
-              LOG.debug("Received event of type: {}", event.type().name());
-              if (receive(new Envelope(event, record.partition(), 
record.offset()))) {
-                LOG.info("Handled event of type: {}", event.type().name());
-              }
-            }
-          });
+      for (ConsumerRecord<String, byte[]> record : records) {
+        Long nextOffset = controlTopicOffsets.get(record.partition());
+        // A rebalance may revoke and later reassign this control partition to 
the same

Review Comment:
   Nit, I think a shorter comment would do here:
   ```
   // A rebalance can rewind the consumer to the committed offset, which can 
lag the in-memory
   //position. Skip already-processed records.
   ```



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