You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/12/06 08:20:11 UTC

[GitHub] [rocketmq] xdkxlk commented on a diff in pull request #5611: [ISSUE #5568] Support long length group and topic for pop mode consumption

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: commits-unsubscribe@rocketmq.apache.org

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