ChenShuai1981 commented on code in PR #1761:
URL: https://github.com/apache/incubator-paimon/pull/1761#discussion_r1287908949
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/action/cdc/kafka/KafkaSchema.java:
##########
@@ -99,7 +100,15 @@ private static KafkaConsumer<String, String>
getKafkaEarliestConsumer(
}
int firstPartition =
partitionInfos.stream().map(PartitionInfo::partition).sorted().findFirst().get();
- consumer.assign(Collections.singletonList(new TopicPartition(topic,
firstPartition)));
+ Collection<TopicPartition> topicPartitions =
+ Collections.singletonList(new TopicPartition(topic,
firstPartition));
+ consumer.assign(topicPartitions);
+
+ Map<TopicPartition, Long> beginningOffsets =
consumer.beginningOffsets(topicPartitions);
+ for (TopicPartition tp : topicPartitions) {
+ Long offset = beginningOffsets.get(tp);
+ consumer.seek(tp, offset);
+ }
Review Comment:
> How about just using `consumer.seekToBeginning(topicPartitions);` ?
Yes, that's more straight forward, adopt your suggestion.
--
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]