elephone-184 opened a new pull request, #5036:
URL: https://github.com/apache/rocketmq-dashboard/pull/5036
## What is the purpose of the change
In RocketMQ, all consumer client instances within the same consumer group
MUST subscribe to identical topics and identical tag/SQL92 filter expressions.
When client application deployments are partially updated or improperly
configured, inconsistent subscriptions arise. This leads to erratic partition
rebalance, intermittent message loss, and random message skipping.
This PR introduces an automated `ConsumerSubscriptionConsistencyValidator`:
1. `SubscriptionConsistencyReportVO` & `TopicSubscriptionMismatchVO`: Domain
report capturing `consistent` status, inconsistent topic counts, and detailed
per-client subscription comparisons.
2. `ConsumerSubscriptionConsistencyValidator`: Iterates over live
`ConsumerRunningInfo` subscription tables (`SubscriptionData`) across all
connected clients in a group. It automatically detects partial topic
subscriptions (some clients subscribe while others do not), expression
mismatches (e.g. `TagA` vs `TagB`), and filter expression type divergence (TAG
vs SQL92).
3. Provider & Controller wiring: Connects through
`RocketMQConsumerDiagnosticsProvider` and exposes
`/api/groups/{name}/subscription-consistency` in `ConsumerGroupController`.
4. Comprehensive unit test suite covering consistent subscriptions,
expression divergence, partial subscriptions, single-client groups, and
controller/service integration.
## Brief changelog
- Add `SubscriptionConsistencyReportVO.java` domain model.
- Add `ConsumerSubscriptionConsistencyValidator.java` validation engine.
- Add `validateSubscriptionConsistency` in `ConsumerDiagnosticsProvider` and
`ConsumerDiagnosticsService`.
- Expose `/api/groups/{name}/subscription-consistency` endpoint in
`ConsumerGroupController`.
- Add `ConsumerSubscriptionConsistencyValidatorTest.java` and expand
`ConsumerDiagnosticsServiceTest.java` and `ConsumerGroupControllerTest.java`.
## Verifying this change
- `ConsumerSubscriptionConsistencyValidatorTest`: verifies empty client
maps, single clients, identical subscriptions, expression mismatches, and
partial group subscriptions.
- `ConsumerDiagnosticsServiceTest`: verifies diagnostics provider delegation.
- `ConsumerGroupControllerTest`: verifies
`/api/groups/{name}/subscription-consistency` REST endpoint serialization.
--
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]