liangyepianzhou commented on code in PR #20948:
URL: https://github.com/apache/pulsar/pull/20948#discussion_r1311004938
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/MessageDeduplication.java:
##########
@@ -341,7 +344,23 @@ public MessageDupStatus isDuplicate(PublishContext
publishContext, ByteBuf heade
publishContext.setOriginalHighestSequenceId(highestSequenceId);
headersAndPayload.readerIndex(readerIndex);
}
-
+ long chunkID = -1;
+ long totalChunk = -1;
+ if (publishContext.isChunked()) {
+ if (md == null) {
+ int readerIndex = headersAndPayload.readerIndex();
+ md = Commands.parseMessageMetadata(headersAndPayload);
+ headersAndPayload.readerIndex(readerIndex);
+ }
+ chunkID = md.getChunkId();
+ totalChunk = md.getNumChunksFromMsg();
+ }
+ // All chunks of a message use the same message metadata and sequence
ID,
+ // so we only need to check the sequence ID for the last chunk in a
chunk message.
+ if (chunkID != -1 && chunkID != totalChunk - 1) {
Review Comment:
We only need to deduplicate the last chunk in the chunk message. And as long
as the last chunk is dropped, the chunk message is incomplete. The consumer can
handle it.
--
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]