Coordinator API /druid/coordinator/v1/metadata/segments?includeOvershadowedStatus builds VersionedIntervalTimeline which can be memory intensive and expensive if this API is called multiple times but multiple brokers in a cluster.
The comment here suggests :
isOvershadowed becomes a non-final field of DataSegment object itself, not participating in equals() and hashCode().
- Add
interface SegmentsAccess { ImmutableDruidDataSource prepare(String dataSource); Iterable<DataSegment> iterateAll(); } (strawman naming)
- Add
DataSourceAccess computeOvershadowed() method to SQLSegmentMetadataManager, which performs this computation for every snapshot of SQLSegmentMetadataManager.dataSources (which is updated in poll()) at most once, lazily.
- Both endpoints in
MetadataResource and Coordination balancing logic (which currently computes isOvershadowed status on its own, too) use this API.
- On the side of
MetadataSegmentView, maintain something like a Map<DataSegment, DataSegment> and update overshadowed status like map.get(segmentFromCoordinator).setOvershadowed(segmentFromCoordinator.isOvershadowed())
Coordinator API
/druid/coordinator/v1/metadata/segments?includeOvershadowedStatusbuildsVersionedIntervalTimelinewhich can be memory intensive and expensive if this API is called multiple times but multiple brokers in a cluster.The comment here suggests :
isOvershadowedbecomes a non-final field ofDataSegmentobject itself, not participating inequals()andhashCode().interface SegmentsAccess { ImmutableDruidDataSource prepare(String dataSource); Iterable<DataSegment> iterateAll(); }(strawman naming)DataSourceAccess computeOvershadowed()method toSQLSegmentMetadataManager, which performs this computation for every snapshot ofSQLSegmentMetadataManager.dataSources(which is updated inpoll()) at most once, lazily.MetadataResourceand Coordination balancing logic (which currently computes isOvershadowed status on its own, too) use this API.MetadataSegmentView, maintain something like aMap<DataSegment, DataSegment>and update overshadowed status likemap.get(segmentFromCoordinator).setOvershadowed(segmentFromCoordinator.isOvershadowed())