gaoyf commented on code in PR #7603:
URL: https://github.com/apache/rocketmq/pull/7603#discussion_r1413285830


##########
store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:
##########
@@ -1140,8 +1146,8 @@ public MessageExtBrokerInner convertMessage(MessageExt 
msgExt, boolean needRoll)
         } else {
             
msgInner.setTopic(msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC));
             
msgInner.setQueueId(Integer.parseInt(msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)));
-            MessageAccessor.clearProperty(msgInner, 
MessageConst.PROPERTY_REAL_TOPIC);
-            MessageAccessor.clearProperty(msgInner, 
MessageConst.PROPERTY_REAL_QUEUE_ID);
+            // MessageAccessor.clearProperty(msgInner, 
MessageConst.PROPERTY_REAL_TOPIC);

Review Comment:
   I extracted 
[TimerDequeuePutMessageService](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1486)‘s
 some key codes, as follows:
   ```
   while (!isStopped() && !doRes) {
       try {
           MessageExtBrokerInner msg = convert(msgExt, tr.getEnqueueTime(), 
needRoll(tr.getMagic()));
           doRes = PUT_NEED_RETRY != doPut(msg, needRoll(tr.getMagic()));
       } catch (Throwable t) {
           LOGGER.info("Unknown error", t);
       }
   }
   ```
   If method  `doPut` throw exception, the logic try to execute method 
`convert` in a loop。
   However, `MessageExtBrokerInner` and `MessageExt` hold the same Map of 
`properties`, 
[convertMessage](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1122)
 FYI, so the following code will return null:
   ```
   msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC)
   msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)
   ```
   Because property `MessageConst.PROPERTY_REAL_QUEUE_ID` has been removed in 
the first execution.
   **So canot remove these properties for the retry logic.**
   On the other hand,**the original logic**: `MessageExtBrokerInner` will be 
reputed to commitlog,it will contains property 
`MessageConst.PROPERTY_REAL_TOPIC` and 
`MessageConst.PROPERTY_REAL_TOPIC`,because the fllowing 
[code](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1127):
   ```
   
msgInner.setPropertiesString(MessageDecoder.messageProperties2String(msgExt.getProperties()));
   ```
   That is to say, when retrieving this message, it must contains these two 
properties,So I don't think commenting out these codes will affect the previous 
functionality



-- 
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-unsubscr...@rocketmq.apache.org

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

Reply via email to