redlsz opened a new issue, #7540: URL: https://github.com/apache/rocketmq/issues/7540
### 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 centos / macos ### RocketMQ version 5.1 ### JDK Version jdk8 ### Describe the Bug When using compaction topic to store some kv data, the earlier (but alive) messages in compaction topic may cannot be consumed by clients, resulting in data loss. And the cause is that clients get wrong minOffset of queue when calling seekToBegin. <img width="758" alt="image" src="https://github.com/apache/rocketmq/assets/103550934/b763f0ac-0bc5-4e16-ad47-abcdc552b8d6"> <img width="980" alt="image" src="https://github.com/apache/rocketmq/assets/103550934/82da84c3-7edc-4d90-b677-1f3ddd5cd00d"> For compaction topics, broker should query offsets from compactionStore. Because normal consume queue files could be deleted when the commitlog minimal physical offset moves forward. ### Steps to Reproduce 1. create a compaction topic 2. send enough messages to this topic and trigger commitlog cleanup 3. start a pullconsumer to try to fetch all kv data ([ref](https://github.com/apache/rocketmq/blob/develop/docs/en/Example_Compaction_Topic.md#consume-message)) ### What Did You Expect to See? All alive kv data in compaction topic can be consumed by client. ### What Did You See Instead? Some earlier data get lost. ### Additional Context _No response_ -- 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.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org