gianm commented on a change in pull request #7595: Optimize overshadowed
segments computation
URL: https://github.com/apache/incubator-druid/pull/7595#discussion_r288015848
##########
File path:
server/src/main/java/org/apache/druid/server/http/MetadataResource.java
##########
@@ -189,17 +188,13 @@ public Response getDatabaseSegments(
private Iterable<SegmentWithOvershadowedStatus>
findAuthorizedSegmentWithOvershadowedStatus(
HttpServletRequest req,
- Collection<ImmutableDruidDataSource> druidDataSources,
Stream<DataSegment> metadataSegments
)
{
- // It's fine to add all overshadowed segments to a single collection
because only
- // a small fraction of the segments in the cluster are expected to be
overshadowed,
- // so building this collection shouldn't generate a lot of garbage.
- final Set<DataSegment> overshadowedSegments = new HashSet<>();
- for (ImmutableDruidDataSource dataSource : druidDataSources) {
-
overshadowedSegments.addAll(ImmutableDruidDataSource.determineOvershadowedSegments(dataSource.getSegments()));
- }
+ // If metadata store hasn't been polled yet, use empty overshadowed list
+ final Collection<DataSegment> overshadowedSegments = Optional
Review comment:
Keep this as a Set, please. Later on, we're doing
`overshadowedSegments.contains(segment)`, and that's scary if `overshadowed` is
any kind of Collection other than a Set (or very short List).
By the way, it would be clearer to make this a `Set<SegmentId>` rather than
`Set<DataSegment>`.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]