tju-yxq opened a new pull request, #2043:
URL: https://github.com/apache/rocketmq-dashboard/pull/2043
## Summary
This PR fixes #1828 with a stronger topic-query ordering guarantee than
simply sorting the records already collected from the first scanned queues.
`RocketMQMessageProvider.queryByTopic(...)` used to append messages in queue
scan order and stop once the default topic-query limit was reached. That means
a busy earlier queue could fill the limit before later queues were scanned, so
newer records from later queues could be omitted entirely.
Changes:
- Keep a bounded min-heap of the newest topic-query records while scanning
queues.
- Scan all returned message queues instead of stopping as soon as the first
queues fill the result limit.
- Return the bounded candidates sorted by `storeTime` descending.
- Add focused tests for:
- newest-first ordering across two queues;
- preserving newer messages from later queues even when an earlier queue
fills the default limit.
## Verification
```bash
cd server
mvn -DskipTests=false
"-Dtest=RocketMQMessageProviderTest#queryByTopicSortsMessagesAcrossQueuesNewestFirst+queryByTopicKeepsNewestMessagesWhenEarlierQueuesFillTheDefaultLimit+queryByTopicStopsWhenPullOffsetDoesNotAdvance"
test
```
Result: `BUILD SUCCESS`; `Tests run: 3, Failures: 0, Errors: 0, Skipped: 0`.
## Evidence boundary
- Verified by code inspection and mocked unit tests around
`DefaultMQPullConsumer`.
- Not verified with a live multi-queue RocketMQ broker or browser UI.
--
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]