tju-yxq opened a new issue, #1435:
URL: https://github.com/apache/rocketmq-dashboard/issues/1435

   ## Bug Report
   
   ### 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
   
   OS: Ubuntu 20.04 / Any OS running RocketMQ Studio
   
   ### RocketMQ version
   
   branch: rocketmq-studio
   version: 5.3.2+
   Git commit id: f727341
   
   ### JDK Version
   
   OpenJDK 21
   
   ### Describe the Bug
   
   `RocketMQDLQProvider.resendMessages()` classifies the resend outcome as 
`failed == 0 ? "SUCCESS" : "PARTIAL"`. This produces misleading results in two 
scenarios:
   
   1. **Zero messages matched** (`matched=0, resent=0, failed=0`): Outcome is 
`"SUCCESS"`, implying the resend succeeded. In reality, nothing was resent 
because no dead-letter messages were found in the time range.
   
   2. **All resends failed** (`matched>0, resent=0, failed>0`): Outcome is 
`"PARTIAL"`, implying some succeeded. In reality, zero messages were resent 
successfully — this is a total failure, not a partial success.
   
   ```java
   .outcome(failed == 0 ? "SUCCESS" : "PARTIAL")
   ```
   
   ### Steps to Reproduce
   
   **Scenario 1**: Select a consumer group with no dead-letter messages in the 
chosen time range, trigger resend. The API returns `outcome="SUCCESS"` with 
`matched=0, resent=0`.
   
   **Scenario 2**: Stop all brokers, trigger resend for a group with dead 
letters. The API returns `outcome="PARTIAL"` with `matched=N, resent=0, 
failed=N`.
   
   ### What Did You Expect to See?
   
   - `matched=0`: outcome should be `"NO_MESSAGES"` — clearly indicates no 
messages were found.
   - `resent=0 && failed>0`: outcome should be `"FAILED"` — clearly indicates 
all resends failed.
   - `resent>0 && failed>0`: outcome should remain `"PARTIAL"`.
   - `resent>0 && failed=0`: outcome should remain `"SUCCESS"`.
   
   ### What Did You See Instead?
   
   Zero-match reported as SUCCESS; total failure reported as PARTIAL.
   
   ### Additional Context
   
   **Affected file**: 
`server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQDLQProvider.java`,
 method `resendMessages()` at approximately line 172.
   
   **Fix**: Replace the single-line outcome with a proper classification:
   
   ```java
   private String classifyOutcome(int matched, int resent, int failed) {
       if (matched == 0) {
           return "NO_MESSAGES";
       }
       if (resent == 0 && failed > 0) {
           return "FAILED";
       }
       if (failed > 0) {
           return "PARTIAL";
       }
       return "SUCCESS";
   }
   ```
   
   This adds approximately 12 lines.
   


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