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


##########
pulsar/consumer_partition.go:
##########
@@ -2256,12 +2306,14 @@ func convertToMessageID(id *pb.MessageIdData) 
*trackingMessageID {
 
        msgID := &trackingMessageID{
                messageID: &messageID{
-                       ledgerID: int64(*id.LedgerId),
-                       entryID:  int64(*id.EntryId),
+                       ledgerID:  int64(id.GetLedgerId()),
+                       entryID:   int64(id.GetEntryId()),
+                       batchIdx:  id.GetBatchIndex(),
+                       batchSize: id.GetBatchSize(),
                },
        }
-       if id.BatchIndex != nil {
-               msgID.batchIdx = *id.BatchIndex
+       if msgID.batchIdx == -1 {
+               msgID.batchIdx = 0

Review Comment:
   If remove this, when seek to a messageId(no batch), let say`(3141:1:0:0)`, 
When we compare, there will be unexpected behavior because the `lastMessageId` 
we get from the broker is: `3141:1:-1:0`.
   
   What are your main concerns? Currently, this method is only used for 
comparison in `hasNext`.
   
   I think we need to maintain consistency because now the non-batch message ID 
returned by the producer and consumer is `batchIndex=0`.



-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to