elephone-184 opened a new pull request, #5047:
URL: https://github.com/apache/rocketmq-dashboard/pull/5047
## What is the purpose of the change
In RocketMQ broker storage, disk space utilization is gated by strict
watermark thresholds (`cleanFileForciblyEnable`, `diskMaxUsedSpaceRatio` at
75%, 85%, 90%, 95%). When a broker's disk usage exceeds 90% (`DANGEROUS`),
message writes are actively rejected or degraded by broker-side flow control.
Once reaching 95% (`SHUTDOWN`), the broker refuses all commitLog appends to
protect against filesystem corruption.
Currently, operators only discover disk issues after writes fail. This PR
introduces an automated `BrokerDiskWatermarkForecaster`:
1. `BrokerDiskForecasterReportVO`, `BrokerDiskAssessmentVO`, &
`CapacityPlanActionVO`: Domain reports capturing current disk usage ratios,
watermark categories (`NORMAL`, `CLEAN_RESOURCE`, `WARN`, `DANGEROUS`,
`SHUTDOWN`), projected hours until shutdown, and prioritized capacity planning
actions (`EXPAND_STORAGE_VOLUME`, `PURGE_EXPIRED_COMMITLOG`,
`TIGHTEN_RETENTION`).
2. `BrokerDiskWatermarkForecaster`: Inspects live `BrokerVO` runtime
properties (`diskUsage`, `putMessagesToday`, `putMessagesYesterday`, `tpsIn`).
It correlates daily message volume growth with remaining storage margins to
predict time-to-exhaustion and surfaces blocking alerts before writes are
impacted.
3. Controller & Service wiring: Integrates through
`ClusterService.forecastBrokerDiskWatermark` and exposes
`/api/clusters/{id}/disk-watermark-forecast` in `ClusterController`.
4. Comprehensive unit test suite covering normal watermarks, warning
thresholds, blocking states (>=90%), ratio boundaries, and controller/service
integration.
## Brief changelog
- Add `BrokerDiskForecasterReportVO.java` domain model.
- Add `BrokerDiskWatermarkForecaster.java` forecasting engine.
- Add `forecastBrokerDiskWatermark` in `ClusterService`.
- Expose `/api/clusters/{id}/disk-watermark-forecast` endpoint in
`ClusterController`.
- Add `BrokerDiskWatermarkForecasterTest.java` and expand
`ClusterServiceTest.java` and `ClusterControllerTest.java`.
## Verifying this change
- `BrokerDiskWatermarkForecasterTest`: verifies ratio parsing (0..1 and
percentage), watermark grading (75/85/90/95%), hours-to-shutdown projections,
and blocking alert generation.
- `ClusterServiceTest`: verifies cluster broker discovery and forecaster
delegation.
- `ClusterControllerTest`: verifies
`/api/clusters/{id}/disk-watermark-forecast` 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]