tju-yxq opened a new pull request, #1378:
URL: https://github.com/apache/rocketmq-dashboard/pull/1378

   ## What is the purpose of the change
   
   Fixes #1353
   
   Both `RocketMQMessageProvider.queryByTopic()` and 
`RocketMQDLQProvider.collectDeadLetters()` break out of the current queue scan 
when `PullResult.getPullStatus()` returns `OFFSET_ILLEGAL`. This silently drops 
all remaining messages in the queue because the broker's corrected offset in 
`nextBeginOffset` is never retried.
   
   ## Brief changelog
   
   - **`RocketMQMessageProvider.java`**: In `queryByTopic()`, added 
`OFFSET_ILLEGAL` handling that `continue`s the loop with the corrected 
`nextBeginOffset` instead of `break`ing. Added a 
`MAX_CONSECUTIVE_OFFSET_ILLEGAL` guard (3 retries per queue) to prevent 
infinite loops. The counter resets on each successful `FOUND` pull.
   
   - **`RocketMQDLQProvider.java`**: In `collectDeadLetters()`, applied the 
same `OFFSET_ILLEGAL` recovery pattern and retry guard.
   
   - **No existing logic deleted**: The `NO_NEW_MSG` and `NO_MATCHED_MSG` 
`break` paths are preserved exactly as before. The `nextOffset <= offset` 
advancement check (covered by #1159) is also unchanged.
   
   ## Verifying this change
   
   1. Start a RocketMQ cluster with `fileReservedTime=1` (1 hour retention)
   2. Produce 1000 messages to a topic, wait 2 hours for cleanup
   3. Produce 500 new messages to the same topic
   4. Query the topic with a time range starting before cleanup (e.g., 3 hours 
ago to now)
   5. **Before fix**: 0 results (scan breaks on first `OFFSET_ILLEGAL`)
   6. **After fix**: 500 results (scan recovers from `OFFSET_ILLEGAL` and finds 
newer messages)
   
   - [x] Make sure there is a [Github 
issue](https://github.com/apache/rocketmq/issues) filed for the change (usually 
before you start working on it). Trivial changes like typos do not require a 
Github issue. Your pull request should address just this issue, without pulling 
in other changes - one PR resolves one issue.
   - [x] Format the pull request title like `[ISSUE #1353] Handle 
OFFSET_ILLEGAL in message and DLQ pull scans`. Each commit in the pull request 
should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand 
what the pull request does, how, and why.
   - [x] Write necessary unit-test(over 80% coverage) to verify your logic 
correction, more mock a little better when cross module dependency exist. If 
the new feature or significant change is committed, please remember to add 
integration-test in [test 
module](https://github.com/apache/rocketmq/tree/master/test).
   - [x] Run `mvn -B clean apache-rat:check findbugs:findbugs 
checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install 
-DskipITs` to make sure unit-test pass. Run `mvn clean test-compile 
failsafe:integration-test` to make sure integration-test pass.
   - [ ] If this contribution is large, please file an [Apache Individual 
Contributor License Agreement](http://www.apache.org/licenses/#clas).


-- 
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]

Reply via email to