elephone-184 opened a new pull request, #5038:
URL: https://github.com/apache/rocketmq-dashboard/pull/5038
## What is the purpose of the change
In RocketMQ multi-replica deployments (Master-Slave / Dledger), asynchronous
replication lag between Master (brokerId=0) and Slave replicas is a critical
high-availability indicator. When network partitions or heavy I/O saturation
slow down slave catch-up, unplanned master failover can result in message
truncation or lost writes. Currently, administrators lack an automated probe
that pairs master and slave offsets and alerts on elevated delta bytes.
This PR introduces an automated `BrokerReplicationHealthProbe`:
1. `BrokerHaReportVO`, `BrokerHaPairVO`, & `SlaveReplicationStatusVO`:
Domain report capturing overall cluster replication health, master-slave
pairings, byte deltas, and synchronization health status.
2. `BrokerReplicationHealthProbe`: Inspects live cluster topology via
`ClusterInfo.getBrokerAddrTable()`, queries commitLog `maxOffset()` across
master and all registered slave addresses, calculates exact replication lag
bytes, and classifies synchronization states (`IN_SYNC`, `MINOR_LAG` < 1MB,
`CRITICAL_LAG` > 64MB, `OFFLINE`). It also warns when master brokers have zero
configured slave replicas (single points of failure).
3. Controller & Service wiring: Integrates through
`ClusterService.probeBrokerReplication` and exposes
`/api/clusters/{id}/replication-probe` in `ClusterController`.
4. Comprehensive unit test suite covering synchronized replicas, minor lags,
critical lag thresholds, offline master recovery, and controller/service
integration.
## Brief changelog
- Add `BrokerHaReportVO.java` domain model.
- Add `BrokerReplicationHealthProbe.java` HA replication probe engine.
- Add `probeBrokerReplication` in `ClusterService`.
- Expose `/api/clusters/{id}/replication-probe` endpoint in
`ClusterController`.
- Add `BrokerReplicationHealthProbeTest.java` and expand
`ClusterServiceTest.java` and `ClusterControllerTest.java`.
## Verifying this change
- `BrokerReplicationHealthProbeTest`: verifies topology parsing, maxOffset
querying, delta byte thresholds (1MiB / 64MiB), and unreachable node detection.
- `ClusterServiceTest`: verifies runtime admin client resolution and
delegation.
- `ClusterControllerTest`: verifies `/api/clusters/{id}/replication-probe`
HTTP REST endpoint mapping.
--
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]