krishan1390 opened a new pull request, #18821:
URL: https://github.com/apache/pinot/pull/18821
## What
Adds three accessors to the `SegmentDataManager` base class and routes the
server's read-only
REST/observability endpoints through them, so those endpoints no longer
assume a manager is backed
by exactly one `ImmutableSegment`:
- `getReportableSegments()` — the index segment(s) a manager exposes under
their own names for
per-segment listings and metadata. Defaults to `List.of(getSegment())`, so
existing managers are
unchanged. A manager that fronts multiple physical segments under a single
map entry can override
it to expose each member.
- `getCrc()` — defaults to `getSegment().getSegmentMetadata().getCrc()`.
- `getTier()` — defaults to the backing `ImmutableSegment`'s tier (`null`
for a non-immutable
segment).
## Why
Several server endpoints (`TablesResource` index inventory /
table-index-metadata / CRC /
segment-validation, `TableSizeResource`, `TableTierResource`,
`DebugResource`) gate on
`instanceof ImmutableSegmentDataManager` and call `getSegment()` directly.
That hard-codes the
assumption that every entry in the server's segment-data-manager map is a
single immutable segment.
Routing these through the new accessors:
- lets each endpoint iterate per physical segment uniformly, and
- lets alternative `SegmentDataManager` implementations participate in
observability without every
endpoint growing another `instanceof` branch.
This is a pure extensibility refactor — default behavior is identical for
the existing managers.
## Changes
- `SegmentDataManager`: add `getReportableSegments()`, `getCrc()`,
`getTier()` with single-segment
defaults.
- `TablesResource`: iterate `getReportableSegments()` for the index
inventory and
table-index-metadata endpoints; use `getCrc()` for the segment-CRC and
segment-validation
endpoints.
- `TableSizeResource` / `DebugResource`: iterate `getReportableSegments()`
instead of
`instanceof ImmutableSegmentDataManager` + `getSegment()`.
- `TableTierResource`: report a tier via `getTier()` for every non-realtime
manager; only a
`RealtimeSegmentDataManager` is treated as a mutable (consuming) segment.
- `BaseResourceTest`: copy the Avro fixture out of the classpath into the
temp dir (so it is always
backed by a real file even when served from a packaged test-jar) and add a
`configureServerConf`
hook, so the base test can be reused from other modules.
## Compatibility
No wire/protocol change. `DuoSegmentDataManager` (realtime commit) uses the
default
`getReportableSegments()` → `[primary]`, so committing realtime segments are
not double-counted.
--
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]