You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2019/10/10 14:32:10 UTC

[GitHub] [incubator-hudi] leesf commented on a change in pull request #947: [HUDI-292] Consume more entries from kafka than specified sourceLimit.

leesf commented on a change in pull request #947: [HUDI-292] Consume more entries from kafka than specified sourceLimit.
URL: https://github.com/apache/incubator-hudi/pull/947#discussion_r333555948
 
 

 ##########
 File path: hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/KafkaOffsetGen.java
 ##########
 @@ -127,6 +127,10 @@ public static String offsetsToStr(OffsetRange[] ranges) {
               exhaustedPartitions.add(range.partition());
             }
             allocedEvents += toOffset - range.untilOffset();
+            // We need recompute toOffset if allocaedEvents larger than numEvents.
+            if (allocedEvents > numEvents) {
+              toOffset = (range.untilOffset() + eventsPerPartition) + (numEvents - allocedEvents);
+            }
 
 Review comment:
   ```
   long offsetsToAdd = Math.min(eventsPerPartition, (numEvents - allocedEvents));
   toOffset = Math.min(toOffsetMax, toOffset + offsetsToAdd);
   ```
   This code snippet works.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services