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 2020/05/27 03:26:02 UTC

[GitHub] [hudi] wangxianghu commented on a change in pull request #1652: [HUDI-918] Fix kafkaOffsetGen can not read kafka data bug

wangxianghu commented on a change in pull request #1652:
URL: https://github.com/apache/hudi/pull/1652#discussion_r429972776



##########
File path: hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/KafkaOffsetGen.java
##########
@@ -207,6 +208,11 @@ public KafkaOffsetGen(TypedProperties props) {
     maxEventsToReadFromKafka = (maxEventsToReadFromKafka == Long.MAX_VALUE || maxEventsToReadFromKafka == Integer.MAX_VALUE)
         ? Config.maxEventsFromKafkaSource : maxEventsToReadFromKafka;
     long numEvents = sourceLimit == Long.MAX_VALUE ? maxEventsToReadFromKafka : sourceLimit;
+
+    if (numEvents < toOffsets.size()) {

Review comment:
       Hi @garyli1019, IMO, throwing an exception makes sense, because the 'sourceLimit' is one-time config binding with the job. If the 'sourceLimit' is lesser than the partitions of Kafka, the job will never consume data from Kafka, running correctly is meaningless.
   

##########
File path: hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/KafkaOffsetGen.java
##########
@@ -207,6 +208,11 @@ public KafkaOffsetGen(TypedProperties props) {
     maxEventsToReadFromKafka = (maxEventsToReadFromKafka == Long.MAX_VALUE || maxEventsToReadFromKafka == Integer.MAX_VALUE)
         ? Config.maxEventsFromKafkaSource : maxEventsToReadFromKafka;
     long numEvents = sourceLimit == Long.MAX_VALUE ? maxEventsToReadFromKafka : sourceLimit;
+
+    if (numEvents < toOffsets.size()) {

Review comment:
       Hi @garyli1019, IMO, throwing an exception makes sense, because the 'sourceLimit' is one-time config binding with the job. If the 'sourceLimit' is lesser than the partitions of Kafka, the job will never consume data from Kafka, running correctly without exception is meaningless.
   




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