Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ public static <ResType> Iterable<ResType> filterAuthorizedResources(
throw new ISE("No authorizer found with name: [%s].", authenticationResult.getAuthorizerName());
}

if (authorizer instanceof AllowAllAuthorizer) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

earlier this code will filter a resource if resourceActionGenerator.apply(resource) returns null but now it won't. does that difference matter?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looks like this isn't the right thing to do.
Also, the following loop needs to be executed because there could be duplicates in Iterable<ResourceAction. Will file an issue and a PR to revert this change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you intend to get rid of the duplicates or keep them? From the description in #11012, it seems we want to de-dup the entries though that wasn't happening earlier.

return resources;
}

final Map<ResourceAction, Access> resultCache = new HashMap<>();
final Iterable<ResType> filteredResources = Iterables.filter(
resources,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,14 @@ private static RowSignature analysisToRowSignature(final SegmentAnalysis analysi

Map<SegmentId, AvailableSegmentMetadata> getSegmentMetadataSnapshot()
{
final Map<SegmentId, AvailableSegmentMetadata> segmentMetadata = new HashMap<>();
synchronized (lock) {
final Map<SegmentId, AvailableSegmentMetadata> segmentMetadata = Maps.newHashMapWithExpectedSize(
segmentMetadataInfo.values().stream().mapToInt(v -> v.size()).sum());
for (TreeMap<SegmentId, AvailableSegmentMetadata> val : segmentMetadataInfo.values()) {
segmentMetadata.putAll(val);
}
return segmentMetadata;
}
return segmentMetadata;
}

int getTotalSegments()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.net.HostAndPort;
import com.google.common.util.concurrent.Futures;
import com.google.inject.Inject;
Expand Down Expand Up @@ -90,7 +91,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -287,7 +287,7 @@ public Enumerable<Object[]> scan(DataContext root)
// Coordinator.
final Iterator<SegmentWithOvershadowedStatus> metadataStoreSegments = metadataView.getPublishedSegments();

final Set<SegmentId> segmentsAlreadySeen = new HashSet<>();
final Set<SegmentId> segmentsAlreadySeen = Sets.newHashSetWithExpectedSize(druidSchema.getTotalSegments());

final FluentIterable<Object[]> publishedSegments = FluentIterable
.from(() -> getAuthorizedPublishedSegments(metadataStoreSegments, root))
Expand Down