RockteMQ-AI commented on issue #10529:
URL: https://github.com/apache/rocketmq/issues/10529#issuecomment-4739494246

   **Issue Evaluation**
   
   Category: `type/bug` | Status: **Confirmed**
   
   The reported issue has been verified against the current codebase on 
`develop` branch.
   
   **Root Cause:**
   
   In `RouteActivity#genMessageQueueFromQueueData` (line 241–299), when `perm` 
is both readable and writable, the code correctly calculates the *counts* of 
read-only (`r`), write-only (`w`), and read-write (`rw`) queues:
   
   ```java
   rw = Math.min(writeQueueNums, readQueueNums);
   r = readQueueNums - rw;
   w = writeQueueNums - rw;
   ```
   
   However, it then assigns queue IDs in the wrong order: **read-only first → 
write-only second → read-write last**. This means queue IDs `0..r-1` get 
`READ`, `r..r+w-1` get `WRITE`, and `r+w..total-1` get `READ_WRITE`.
   
   Per the `QueueData` convention (confirmed by `MQClientInstance`), queue IDs 
are ranges:
   - IDs `0..readQueueNums-1` are readable
   - IDs `0..writeQueueNums-1` are writable
   - Overlap (`0..min(read,write)-1`) should be `READ_WRITE`
   
   So the correct order should be: **read-write first → write-only → 
read-only** (or equivalently, derive permission per queue ID based on whether 
`id < readQueueNums` and/or `id < writeQueueNums`).
   
   **Why existing tests didn't catch it:** The test `partitionWith4R8WPermRW` 
only asserts the *count* of each permission type (4 WRITE + 4 READ_WRITE), but 
does not verify which queue IDs received which permission.
   
   **Impact:** gRPC clients receive incorrect per-queue permissions in 
`QueryRouteResponse`. This could cause clients to incorrectly skip sending to 
or reading from specific queues.
   
   **Severity:** Medium — functional correctness issue for topics with 
asymmetric read/write queue counts.
   
   An automated fix proposal will be generated. Reply `/approve` to proceed 
with PR generation.
   
   ---
   *Automated evaluation by github-manager-bot*


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