You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/10/28 08:40:18 UTC

[GitHub] [rocketmq] HScarb opened a new issue #3438: Statistics topic may wrong when CommitLog putting a delay message

HScarb opened a new issue #3438:
URL: https://github.com/apache/rocketmq/issues/3438


   In `CommitLog#putMessage(final MessageExtBrokerInner msg)`, there are two lines of code for statistics.
   
   https://github.com/apache/rocketmq/blob/master/store/src/main/java/org/apache/rocketmq/store/CommitLog.java#L710-L711
   
   ```java
           // Statistics
           storeStatsService.getSinglePutMessageTopicTimesTotal(msg.getTopic()).add(1);
           storeStatsService.getSinglePutMessageTopicSizeTotal(topic).add(result.getWroteBytes());
   ```
   
   As above, `getSinglePutMessageTopicSizeTotal(topic)` use `topic` variable which declare before.
   But if the message is a delay message, `topic` will be change to `"SCHEDULE_TOPIC_XXXX"`, and will keep this value until the very end. 
   
   https://github.com/apache/rocketmq/blob/master/store/src/main/java/org/apache/rocketmq/store/CommitLog.java#L600-L623
   
   So I consider it should be `getSinglePutMessageTopicSizeTotal(msg.getTopic())`
   


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

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



[GitHub] [rocketmq] panzhi33 commented on issue #3438: Statistics topic may wrong when CommitLog putting a delay message

Posted by GitBox <gi...@apache.org>.
panzhi33 commented on issue #3438:
URL: https://github.com/apache/rocketmq/issues/3438#issuecomment-953669703


   Someone has fixed it, you can see https://github.com/apache/rocketmq/pull/2684


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

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



[GitHub] [rocketmq] HScarb commented on issue #3438: Statistics topic may wrong when CommitLog putting a delay message

Posted by GitBox <gi...@apache.org>.
HScarb commented on issue #3438:
URL: https://github.com/apache/rocketmq/issues/3438#issuecomment-953749404


   > > > Someone has fixed it, you can see #2684
   > > 
   > > 
   > > I see, but the `topic` variable problem still remains
   > 
   > The two values of topic and msg.getTopic() are the same
   
   The delay message logic will modify the `topic` value to `SCHEDULE_TOPIC_XXXX`, and is not same as `msg.getTopic()`
   
   ```java
           String topic = msg.getTopic();
           int queueId = msg.getQueueId();
   
           final int tranType = MessageSysFlag.getTransactionValue(msg.getSysFlag());
           if (tranType == MessageSysFlag.TRANSACTION_NOT_TYPE
                   || tranType == MessageSysFlag.TRANSACTION_COMMIT_TYPE) {
               // Delay Delivery
               if (msg.getDelayTimeLevel() > 0) {
                   if (msg.getDelayTimeLevel() > this.defaultMessageStore.getScheduleMessageService().getMaxDelayLevel()) {
                       msg.setDelayTimeLevel(this.defaultMessageStore.getScheduleMessageService().getMaxDelayLevel());
                   }
   
                   // !!! here modifies the topic value
                   topic = TopicValidator.RMQ_SYS_SCHEDULE_TOPIC;
                   queueId = ScheduleMessageService.delayLevel2QueueId(msg.getDelayTimeLevel());
   
                   // Backup real topic, queueId
                   MessageAccessor.putProperty(msg, MessageConst.PROPERTY_REAL_TOPIC, msg.getTopic());
                   MessageAccessor.putProperty(msg, MessageConst.PROPERTY_REAL_QUEUE_ID, String.valueOf(msg.getQueueId()));
                   msg.setPropertiesString(MessageDecoder.messageProperties2String(msg.getProperties()));
   
                   msg.setTopic(topic);
                   msg.setQueueId(queueId);
               }
           }
   ```


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

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



[GitHub] [rocketmq] HScarb removed a comment on issue #3438: Statistics topic may wrong when CommitLog putting a delay message

Posted by GitBox <gi...@apache.org>.
HScarb removed a comment on issue #3438:
URL: https://github.com/apache/rocketmq/issues/3438#issuecomment-953749404


   > > > Someone has fixed it, you can see #2684
   > > 
   > > 
   > > I see, but the `topic` variable problem still remains
   > 
   > The two values of topic and msg.getTopic() are the same
   
   The delay message logic will modify the `topic` value to `SCHEDULE_TOPIC_XXXX`, and is not same as `msg.getTopic()`
   
   ```java
           String topic = msg.getTopic();
           int queueId = msg.getQueueId();
   
           final int tranType = MessageSysFlag.getTransactionValue(msg.getSysFlag());
           if (tranType == MessageSysFlag.TRANSACTION_NOT_TYPE
                   || tranType == MessageSysFlag.TRANSACTION_COMMIT_TYPE) {
               // Delay Delivery
               if (msg.getDelayTimeLevel() > 0) {
                   if (msg.getDelayTimeLevel() > this.defaultMessageStore.getScheduleMessageService().getMaxDelayLevel()) {
                       msg.setDelayTimeLevel(this.defaultMessageStore.getScheduleMessageService().getMaxDelayLevel());
                   }
   
                   // !!! here modifies the topic value
                   topic = TopicValidator.RMQ_SYS_SCHEDULE_TOPIC;
                   queueId = ScheduleMessageService.delayLevel2QueueId(msg.getDelayTimeLevel());
   
                   // Backup real topic, queueId
                   MessageAccessor.putProperty(msg, MessageConst.PROPERTY_REAL_TOPIC, msg.getTopic());
                   MessageAccessor.putProperty(msg, MessageConst.PROPERTY_REAL_QUEUE_ID, String.valueOf(msg.getQueueId()));
                   msg.setPropertiesString(MessageDecoder.messageProperties2String(msg.getProperties()));
   
                   msg.setTopic(topic);
                   msg.setQueueId(queueId);
               }
           }
   ```


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

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



[GitHub] [rocketmq] HScarb commented on issue #3438: Statistics topic may wrong when CommitLog putting a delay message

Posted by GitBox <gi...@apache.org>.
HScarb commented on issue #3438:
URL: https://github.com/apache/rocketmq/issues/3438#issuecomment-953725127


   > Someone has fixed it, you can see #2684
   
   I see, but the `topic` variable problem still remains


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

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



[GitHub] [rocketmq] panzhi33 commented on issue #3438: Statistics topic may wrong when CommitLog putting a delay message

Posted by GitBox <gi...@apache.org>.
panzhi33 commented on issue #3438:
URL: https://github.com/apache/rocketmq/issues/3438#issuecomment-953738717


   > > Someone has fixed it, you can see #2684
   > 
   > I see, but the `topic` variable problem still remains
   
   The two values of topic and msg.getTopic() are the same


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

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



[GitHub] [rocketmq] HScarb closed issue #3438: Statistics topic may wrong when CommitLog putting a delay message

Posted by GitBox <gi...@apache.org>.
HScarb closed issue #3438:
URL: https://github.com/apache/rocketmq/issues/3438


   


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

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