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

   ### Which Issue(s) This PR Fixes
   
   - Fixes #10929
   
   ### Brief Description
   
   Several lite-topic hot paths (`doFullDispatchForWildcardGroup`, 
`getLiteTopicCount`, `collectByParentTopic`, `cleanByParentTopic`) iterate the 
entire consume-queue table on every invocation, so their cost grows with the 
total number of lmqs on the broker instead of the lmqs under the target parent 
topic.
   
   This PR adds `LmqPrefixIndex`, a prefix-ordered in-memory index over lmq 
names:
   
   - **Index lifecycle**: bootstrapped once at startup 
(`bootstrapLmqPrefixIndex` after lifecycle `init`), then maintained on the lmq 
hot path via `onLmqCreate` (first message of a new lmq) and `onLmqDelete` hooks.
   - **Index-backed iteration**: new `forEachLiteTopicByPrefix` / 
`forEachLiteTopicByParent` APIs; wildcard full dispatch, topic count and 
cleanup are rewritten on top of them, turning O(total lmqs) scans into 
O(matched lmqs). Cleanup switches to collect-then-delete to avoid lock nesting 
between iteration and deletion.
   - **Subscription model refinement**: replace `SubscriberWrapper` with a 
plain `Map<String, List<ClientGroup>>` return from `getAllSubscribers` (exact + 
wildcard sources), simplify `getWildcardGroupClients` signature, rename 
`getLiteTopicSet` to `getLmqSet`, and make `LiteCtlListener` callbacks default 
methods.
   
   No protocol or external API change; dispatch and cleanup behavior stays 
equivalent.
   
   ### How Did You Test This Change?
   
   - New unit tests `LmqPrefixIndexTest` covering prefix lookup boundaries, 
bootstrap and create/delete hooks
   - Extended `AbstractLiteLifecycleManagerTest` / `LiteEventDispatcherTest` 
for index-backed dispatch, count and cleanup paths
   - Rewritten `LiteSubscriptionRegistryImplTest` and new 
`LiteSubscriptionTest` for the subscription model refactoring
   - Full regression on the touched modules: `mvn -pl broker -am test` related 
suites (128+ tests) plus `common`/`proxy` lite suites, all green; `mvn 
checkstyle` clean


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