vrajat commented on code in PR #12157:
URL: https://github.com/apache/pinot/pull/12157#discussion_r1429452785


##########
pinot-plugins/pinot-stream-ingestion/pinot-kafka-2.0/src/main/java/org/apache/pinot/plugin/stream/kafka20/KafkaPartitionLevelConsumer.java:
##########
@@ -46,6 +50,20 @@ public KafkaPartitionLevelConsumer(String clientId, 
StreamConfig streamConfig, i
     super(clientId, streamConfig, partition);
   }
 
+  @Override
+  public void validateStreamState(StreamPartitionMsgOffset startMsgOffset) 
throws PermanentConsumerException {
+    final long startOffset = ((LongMsgOffset) startMsgOffset).getOffset();
+    Map<TopicPartition, Long> beginningOffsets =
+            
_consumer.beginningOffsets(Collections.singletonList(_topicPartition));
+
+    final long beginningOffset = 
beginningOffsets.getOrDefault(_topicPartition, 0L);
+    if (startOffset < beginningOffset) {

Review Comment:
   Yes. That is the common scenario. 
[KafkaConsumer::position](https://kafka.apache.org/0110/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html#position(org.apache.kafka.common.TopicPartition))
 specifies the next record that is somewhere in the middle or end of the 
stream. Also `startOffset` is usually the same as `KafkaConsumer::position` if 
the consumer is keeping up.  



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to