You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "bvaradar (via GitHub)" <gi...@apache.org> on 2024/04/25 04:16:23 UTC

Re: [PR] [HUDI-7511] Fixing offset range calculation for kafka [hudi]

bvaradar commented on code in PR #10875:
URL: https://github.com/apache/hudi/pull/10875#discussion_r1578824134


##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/KafkaOffsetGen.java:
##########
@@ -174,6 +174,13 @@ public static OffsetRange[] computeOffsetRanges(Map<TopicPartition, Long> fromOf
           }
         }
       }
+      // We need to ensure every partition is part of returned offset ranges even if we are not consuming any new msgs (for instance, if its already caught up).
+      // as this will be tracked as the checkpoint, we need to ensure all partitions are part of final ranges.
+      fromOffsetMap.entrySet()
+          .stream()
+          .filter((kv) -> !finalRanges.containsKey(kv.getKey()))
+          .forEach((kv) -> finalRanges.put(kv.getKey(), Collections.singletonList(OffsetRange.create(kv.getKey(), kv.getValue(), kv.getValue()))));

Review Comment:
   Made the change to address this.  



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org