BewareMyPower commented on code in PR #20948:
URL: https://github.com/apache/pulsar/pull/20948#discussion_r1303928403


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:
##########
@@ -1449,6 +1449,15 @@ private ByteBuf processMessageChunk(ByteBuf 
compressedPayload, MessageMetadata m
         // discard message if chunk is out-of-order
         if (chunkedMsgCtx == null || chunkedMsgCtx.chunkedMsgBuffer == null

Review Comment:
   Should we handle `chunkedMsgCtx == null` in a separated block?
   
   There are actually two cases (assuming the message is split into 2 chunks):
   1. Consumer received chunk-1  before chunk-0. In this case, `chunkedMsgCtx` 
is null.
   2. Consumer has received chunk-0, then it received chunk-0 again. In this 
case, `chunkedMsgCtx` is not null and `msgMetadata.getChunkId() <= 
chunkedMsgCtx.lastChunkedMessageId`.
   
   The 1st case should be an unexpected case because message disordering 
happens. The 2nd case might be expected (I'm not sure) so that consumer should 
filter duplicated messages.
   
   /cc @liangyepianzhou @poorbarcode 



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