surekhasaharan commented on a change in pull request #7595: Optimize
overshadowed segments computation
URL: https://github.com/apache/incubator-druid/pull/7595#discussion_r288857115
##########
File path:
server/src/main/java/org/apache/druid/metadata/SQLMetadataSegmentManager.java
##########
@@ -615,29 +619,30 @@ public ImmutableDruidDataSource getDataSource(String
dataSourceName)
@Nullable
public Collection<ImmutableDruidDataSource> getDataSources()
{
- return Optional.ofNullable(dataSources)
- .map(m ->
- m.values()
- .stream()
- .map(DruidDataSource::toImmutableDruidDataSource)
- .collect(Collectors.toList())
- )
- .orElse(null);
+ return Optional.ofNullable(dataSourcesSnapshot).map(m ->
m.getDataSources()).orElse(null);
}
@Override
@Nullable
public Iterable<DataSegment> iterateAllSegments()
{
- final ConcurrentHashMap<String, DruidDataSource> dataSourcesSnapshot =
dataSources;
- if (dataSourcesSnapshot == null) {
+ final Collection<ImmutableDruidDataSource> dataSources =
Optional.ofNullable(dataSourcesSnapshot)
+ .map(m ->
m.getDataSources())
+
.orElse(null);
+ if (dataSources == null) {
return null;
}
- return () -> dataSourcesSnapshot.values()
- .stream()
- .flatMap(dataSource ->
dataSource.getSegments().stream())
- .iterator();
+ return () -> dataSources.stream()
+ .flatMap(dataSource ->
dataSource.getSegments().stream())
+ .iterator();
+ }
+
+ @Override
+ @Nullable
+ public Set<SegmentId> getOvershadowedSegments()
Review comment:
ok, updating the snapshot on dataSources and segments update.
----------------------------------------------------------------
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]