suvodeep-pyne opened a new pull request, #17036:
URL: https://github.com/apache/pinot/pull/17036
## Summary
This PR refactors the reload job status logic in the controller by
extracting it from `PinotTableReloadService` into a new dedicated
`PinotTableReloadStatusReporter` class. This improves separation of concerns
and makes the codebase more maintainable.
### Key Changes
1. **Created new `PinotTableReloadStatusReporter` class**
- Extracted `getReloadJobStatus()` method from `PinotTableReloadService`
- Extracted `getServerToSegments()` helper method
- Added helper methods for computing time metrics:
`computeTimeElapsedInMinutes()`, `computeEstimatedRemainingTimeInMinutes()`,
`computeTotalSegments()`
- Registered as a Singleton in `BaseControllerStarter`
2. **Updated `PinotTableReloadResource`**
- Injected `PinotTableReloadStatusReporter` alongside existing
`PinotTableReloadService`
- Delegated reload job status queries to the new reporter class
- Renamed field `_pinotTableReloadService` to `_service` for brevity
- Renamed method `getTableReloadMetadata()` to `needReload()` for clarity
3. **Refactored `ServerReloadControllerJobStatusResponse`**
- Converted all setters to fluent style (return `this`) to enable method
chaining
- This allows for cleaner initialization in the new reporter class
4. **Simplified `PinotTableReloadService`**
- Removed reload status reporting logic (moved to reporter)
- Kept core reload functionality focused on actual reload operations
- Maintained `needReload()` method (renamed from
`getTableReloadMetadata()`)
5. **Updated test class**
- Renamed `PinotTableReloadServiceTest` to
`PinotTableReloadStatusReporterTest`
- Updated to test the new reporter class
### Benefits
- **Better separation of concerns**: Service now focuses on reload
operations, reporter on status reporting
- **Improved code organization**: Status reporting logic is isolated and
easier to maintain
- **Fluent API**: Method chaining in response objects makes code more
readable
- **No functional changes**: Only refactoring, behavior remains the same
### Test Plan
- Existing unit tests updated and passing
- No API changes (endpoint paths and responses remain the same)
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]