You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "BewareMyPower (via GitHub)" <gi...@apache.org> on 2023/08/24 07:37:06 UTC

[GitHub] [pulsar] BewareMyPower commented on a diff in pull request #20948: [fix][broker]Fix chunked messages will be filtered by duplicating

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


##########
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
                 || msgMetadata.getChunkId() != (chunkedMsgCtx.lastChunkedMessageId + 1)) {
+            // Filter duplicated chunks instead of discard it.
+            if (chunkedMsgCtx == null || msgMetadata.getChunkId() <= chunkedMsgCtx.lastChunkedMessageId) {

Review Comment:
   It happens when there is no cached `chunkedMsgCtx` while the consumer receives a chunk whose id is not 0. Normally, the consumer should not receive the chunk-i (i > 0) before receiving chunk-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-unsubscribe@pulsar.apache.org

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