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

 ##########
 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:
   I think we still need the Math.min(..) check here to handle the case where 
toOffset is being set to the maximum range (partitions can have skew for eg.) 
in L125 above.. 
   
   I am also wondering if introducing a new variable like below will fix the 
issue (top of my head)
   ```
   long offsetsToAdd = Math.max(eventsPerPartition, (numEvents - allocedEvents))
   long toOffset. = Math.min(toOffsetMax,  range.untilOffset() + offsetsToAdd)
   ```
   
   and keep the flow simpler.  

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to