89799969 opened a new pull request, #11112:
URL: https://github.com/apache/rocketmq/pull/11112

   ### Which Issue(s) This PR Fixes
   
   - Fixes #11041
   
   ### Brief Description
   
   The split-metadata pagination loops stop one entry too early. After a 
successful page, the client/broker increments `topicSeq`/`groupSeq` by the page 
size, then breaks when:
   
   ```java
   if (topicSeq >= totalTopicNum - 1)
   ```
   
   The broker pages `[seq, seq + maxNum)` with no overlap, so after page *k* 
the caller has fetched `k · pageSize` entries. The condition `k · pageSize >= N 
− 1` is already true when exactly one entry remains, i.e. for every `N ≡ 1 (mod 
pageSize)`.
   
   Example: 2001 topics with default page size 2000 — page 1 returns 2000 
entries, `2000 >= 2001 - 1` is true, the loop breaks, and topic #2001 is never 
requested.
   
   This change uses `>= total` in all four call sites:
   
   - `MQClientAPIImpl#getAllTopicConfig`
   - `MQClientAPIImpl#getAllSubscriptionGroup`
   - `BrokerOuterAPI#getAllTopicConfig`
   - `BrokerOuterAPI#getAllSubscriptionGroupConfig`
   
   `SlaveSynchronize#syncTopicConfig` uses `BrokerOuterAPI#getAllTopicConfig`, 
so a slave whose master has `N ≡ 1 (mod pageSize)` topics previously 
permanently missed the last topic.
   
   ### How Did You Test This Change?
   
   Logic verification of the stop condition against the broker paging contract 
(`[seq, seq + maxNum)`, `totalTopicNum = size()`):
   
   | N | pageSize | pages fetched before old stop | missing |
   |---|----------|-------------------------------|---------|
   | 2000 | 2000 | 1 page (2000) | none (edge: `2000 >= 1999` true after first 
page — still complete) |
   | 2001 | 2000 | 1 page (2000) | **entry 2001** |
   | 4001 | 2000 | 2 pages (4000) | **entry 4001** |
   | 2001 | 2000 (fixed) | 2 pages (2001) | none |
   
   Change is four one-line comparison updates in already-covered reactor 
modules. Full `mvn compile` of `-pl client,broker -am` was started against 
Temurin 21 + local m2 cache; the reactor was still running when this PR was 
opened.
   
   AI-assisted contribution; implementation was reviewed and verified locally 
against the issue reproduction math.
   


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