nodece commented on code in PR #1482:
URL: https://github.com/apache/pulsar-client-go/pull/1482#discussion_r3121544638


##########
pulsar/consumer_partition.go:
##########
@@ -1308,10 +1308,25 @@ func (pc *partitionConsumer) MessageReceived(response 
*pb.CommandMessage, header
        )
        for i := 0; i < numMsgs; i++ {
                smm, payload, err := reader.ReadMessage()
-               if err != nil || payload == nil {
+               isNullValue := msgMeta.GetNullValue() || (smm != nil && 
smm.GetNullValue())
+               if err != nil {
+                       // A null-value (tombstone) message has no payload 
bytes on the wire, so
+                       // the non-batched reader returns ErrEOM. Accept it 
instead of discarding
+                       // it as corrupted, matching the Java client's behavior 
for compaction
+                       // tombstones.
+                       if isNullValue && err == internal.ErrEOM {
+                               payload = nil
+                       } else {
+                               pc.discardCorruptedMessage(pbMsgID, 
pb.CommandAck_BatchDeSerializeError)
+                               return err
+                       }

Review Comment:
   I know that this logic looks hacky,  `ReadMessage` should be improved.



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