shibd commented on code in PR #1340:
URL: https://github.com/apache/pulsar-client-go/pull/1340#discussion_r1972995691


##########
pulsar/consumer_partition.go:
##########
@@ -2195,6 +2226,24 @@ func (pc *partitionConsumer) 
discardCorruptedMessage(msgID *pb.MessageIdData,
 }
 
 func (pc *partitionConsumer) hasNext() bool {
+
+       // If a seek by time has been performed, then the `startMessageId` 
becomes irrelevant.
+       // We need to compare `markDeletePosition` and `lastMessageId`,
+       // and then reset `startMessageID` to `markDeletePosition`.
+       if pc.hasSoughtByTime.CompareAndSwap(true, false) {

Review Comment:
   > Here it's changed from true to false, which means next time hasNext is 
called, it will skip the code block here.
   
   Yes, After executing `seekByTime`, we only need to enter this method once, 
as it updates startMessageID to markDeletePosition. Now, it clearly knows what 
the messageId was from the last execution of seekByTime



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

Reply via email to