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


##########
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:
   This CAS operation seems confusing.
   
   1. `hasSoughtByTime` is set with true in `internalSeekByTime`, so concurrent 
seek could happen. In Java client, it's prevented by 
`seekStatus.compareAndSet(SeekStatus.NOT_STARTED, SeekStatus.IN_PROGRESS)`.
   2. Here it's changed from true to false, which means next time `hasNext` is 
called, it will skip the code block here.



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