gogodjzhu opened a new issue, #9425: URL: https://github.com/apache/rocketmq/issues/9425
### Before Creating the Bug Report - [x] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq/discussions). - [x] I have searched the [GitHub Issues](https://github.com/apache/rocketmq/issues) and [GitHub Discussions](https://github.com/apache/rocketmq/discussions) of this repository and believe that this is not a duplicate. - [x] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ. ### Runtime platform environment Ubuntu 20.04 ### RocketMQ version develop ### JDK Version Oracle JDK 12 ### Describe the Bug # Misleading log in ConsumeQueue.recover(): offset and size always printed as 0 In [org.apache.rocketmq.store.ConsumeQueue#recover()](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java#L139), when recovering a ConsumeQueue file, this log line is used: ```java log.info("recover current consume queue file over, " + mappedFile.getFileName() + " " + offset + " " + size + " " + tagsCode); ``` However, this line always prints `offset=0`, `size=0`, and `tagsCode=0` because it's triggered only when the condition `offset < 0 || size <= 0` is met — i.e., invalid data. This makes the log confusing, since it looks like the file ended at offset 0 with size 0, even if valid entries were processed. Maybe the log should mention it's the **end** of valid data, or print the **last valid offset/position** instead. --- # `ConsumeQueue.recover()` 方法中的日志可能存在误导:offset 和 size 总是为 0 在 [org.apache.rocketmq.store.ConsumeQueue#recover()](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java#L139) 方法中,当遍历 ConsumeQueue 文件结束时,会打印如下日志: ```java log.info("recover current consume queue file over, " + mappedFile.getFileName() + " " + offset + " " + size + " " + tagsCode); ``` 但这条日志总是打印 `offset=0`、`size=0`,因为它只在 `offset < 0 || size <= 0` 的情况下触发(也就是数据无效时)。 这会让人误以为整个文件没有有效数据。建议改为打印“已恢复到文件末尾”之类的提示,或者输出最后一个有效位置,更具参考价值。 ### Steps to Reproduce Just start it, logs show everything. ### What Did You Expect to See? I expected the log to reflect the actual end position of valid entries in the ConsumeQueue file ### What Did You See Instead? always 0 in the log line ### Additional Context Easy to fix. -- 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]
