xdkxlk commented on code in PR #5611:
URL: https://github.com/apache/rocketmq/pull/5611#discussion_r1040632785
##########
broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:
##########
@@ -586,9 +587,37 @@ private long popMsgFromQueue(boolean isRetry,
GetMessageResult getMessageResult,
} finally {
queueLockManager.unLock(lockKey);
}
+
if (getMessageTmpResult != null) {
+ String brokerName =
brokerController.getBrokerConfig().getBrokerName();
for (SelectMappedBufferResult mapedBuffer :
getMessageTmpResult.getMessageMapedList()) {
- getMessageResult.addMessage(mapedBuffer);
+ // We should not recode buffer for normal topic message
+ if (!isRetry) {
+ getMessageResult.addMessage(mapedBuffer);
+ } else {
+ List<MessageExt> messageExtList =
MessageDecoder.decodesBatch(mapedBuffer.getByteBuffer(),
+ true, false, true);
+ mapedBuffer.release();
+ for (MessageExt messageExt : messageExtList) {
+ try {
+ String ckInfo =
ExtraInfoUtil.buildExtraInfo(offset, popTime, requestHeader.getInvisibleTime(),
+ reviveQid, messageExt.getTopic(), brokerName,
messageExt.getQueueId(), messageExt.getQueueOffset());
+
messageExt.getProperties().putIfAbsent(MessageConst.PROPERTY_POP_CK, ckInfo);
+
+ // Set retry message topic to origin topic and
clear message store size to recode
+ messageExt.setTopic(requestHeader.getTopic());
+ messageExt.setStoreSize(0);
+
+ byte[] encode = MessageDecoder.encode(messageExt,
true);
Review Comment:
message is not been decompressed at
MessageDecoder.decodesBatch(mapedBuffer.getByteBuffer(),true, false, true)
and will be compressed here
which means, messages will be compressed twice
--
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]