You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "unbridled-41 (via GitHub)" <gi...@apache.org> on 2026/09/05 10:21:14 UTC
[I] [Bug] Paginated metadata sync silently drops the last topic/subscription group when count is one over a page boundary [rocketmq]
unbridled-41 opened a new issue, #11041:
URL: https://github.com/apache/rocketmq/issues/11041
### 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
Linux, JDK 21, develop (ff8f6f74c)
### RocketMQ version
5.x develop
### Describe the Bug
The split-metadata pagination loops terminate one entry too early. The client-side loops in `MQClientAPIImpl` break when:
```java
if (topicSeq >= totalTopicNum - 1) { // line 3125
if (groupSeq >= totalGroupNum - 1) { // line 3033
```
The broker pages `[seq, seq + maxNum)` with no overlap (TopicConfigManager#subTopicConfig / SubscriptionGroupManager#subGroupTable, `totalTopicNum = size()`), so after page k the client has fetched `k·pageSize` entries. The loop therefore stops when `k·pageSize >= N − 1`, which is already true when exactly **one** entry remains unfetched, i.e. for every N ≡ 1 (mod pageSize).
Example: 2001 topics with the default page size 2000 — page 1 returns 2000 entries, `2000 >= 2001 - 1` is true, the loop breaks, and topic #2001 is never requested. No error, no retry — silently truncated metadata.
The same off-by-one exists broker-side in `BrokerOuterAPI` (getAllTopicConfig at line 834, getAllSubscriptionGroup at line 984); `BrokerOuterAPI#getAllTopicConfig` is used by `SlaveSynchronize#syncTopicConfig`, so a slave whose master has N ≡ 1 (mod 2000) topics permanently misses the last topic (the dataVersion comparison then matches, so no resync happens).
### Steps to Reproduce
1. Set `maxPageSizeInGetMetadata` to 100 (or have 2001 topics with the default 2000).
2. Call `DefaultMQAdminExt#getAllTopicConfig` on a broker with 101 topics.
3. Result contains 100 topics — the last one is missing.
### Expected Behavior
The loop must terminate only when `seq >= totalNum`; the last entry must be fetched.
--
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: commits-unsubscribe@rocketmq.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Paginated metadata sync silently drops the last topic/subscription group when count is one over a page boundary [rocketmq]
Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #11041:
URL: https://github.com/apache/rocketmq/issues/11041#issuecomment-5552036478
**Issue Evaluation**
Category: `bug` | Status: **Confirmed**
The off-by-one error in paginated metadata sync is verified against the current codebase:
- `MQClientAPIImpl.java:3125` — `topicSeq >= totalTopicNum - 1` (should be `>= totalTopicNum`)
- `MQClientAPIImpl.java:3033` — `groupSeq >= totalGroupNum - 1` (same)
- `BrokerOuterAPI.java:834` / `984` — identical pattern, affects slave sync via `SlaveSynchronize#syncTopicConfig`
When topic/group count N ≡ 1 (mod pageSize), the last entry is silently dropped. The `DataVersion` comparison then matches, so no resync occurs — the missing entry persists indefinitely.
**Severity:** Medium-High — silent data loss for exactly one topic/group per page boundary; slave brokers permanently miss the last topic
**Impact:** Client metadata sync, master-slave replication
Fix PR #11042 correctly changes the termination condition to `seq >= totalNum`.
---
*Automated evaluation by github-manager*
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Paginated metadata sync silently drops the last topic/subscription group when count is one over a page boundary [rocketmq]
Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #11041:
URL: https://github.com/apache/rocketmq/issues/11041#issuecomment-5556532266
**Issue Evaluation**
Category: `bug` | Status: **Confirmed**
Verified against `MQClientAPIImpl` pagination logic. The off-by-one error is clear:
```java
if (topicSeq >= totalTopicNum - 1) { // line 3125
if (groupSeq >= totalGroupNum - 1) { // line 3033
```
When `N ≡ 1 (mod pageSize)` (e.g., 2001 topics with pageSize 2000), the loop terminates after fetching `k*pageSize` entries, leaving exactly one entry unfetched.
**Note:** A fix PR already exists — [#11042](https://github.com/apache/rocketmq/pull/11042).
**Severity:** Medium — silent metadata truncation with no error or retry.
---
*Automated evaluation by RockteMQ-AI*
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Paginated metadata sync silently drops the last topic/subscription group when count is one over a page boundary [rocketmq]
Posted by "RongtongJin (via GitHub)" <gi...@apache.org>.
RongtongJin closed issue #11041: [Bug] Paginated metadata sync silently drops the last topic/subscription group when count is one over a page boundary
URL: https://github.com/apache/rocketmq/issues/11041
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org