You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/03/04 06:24:57 UTC

[GitHub] [druid] jihoonson commented on a change in pull request #10892: Avoid expensive findEntry call in segment metadata query

jihoonson commented on a change in pull request #10892:
URL: https://github.com/apache/druid/pull/10892#discussion_r587171546



##########
File path: server/src/test/java/org/apache/druid/client/CachingClusteredClientPerfTest.java
##########
@@ -0,0 +1,255 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.client;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterators;
+import com.google.common.collect.Ordering;
+import org.apache.druid.client.cache.CacheConfig;
+import org.apache.druid.client.cache.CachePopulator;
+import org.apache.druid.client.cache.MapCache;
+import org.apache.druid.client.selector.HighestPriorityTierSelectorStrategy;
+import org.apache.druid.client.selector.QueryableDruidServer;
+import org.apache.druid.client.selector.RandomServerSelectorStrategy;
+import org.apache.druid.client.selector.ServerSelector;
+import org.apache.druid.guice.http.DruidHttpClientConfig;
+import org.apache.druid.java.util.common.Intervals;
+import org.apache.druid.java.util.common.guava.Sequence;
+import org.apache.druid.java.util.common.guava.TestSequence;
+import org.apache.druid.query.BaseQuery;
+import org.apache.druid.query.DataSource;
+import org.apache.druid.query.DruidProcessingConfig;
+import org.apache.druid.query.Query;
+import org.apache.druid.query.QueryPlus;
+import org.apache.druid.query.QueryRunner;
+import org.apache.druid.query.QueryToolChest;
+import org.apache.druid.query.QueryToolChestWarehouse;
+import org.apache.druid.query.SegmentDescriptor;
+import org.apache.druid.query.TableDataSource;
+import org.apache.druid.query.context.ResponseContext;
+import org.apache.druid.query.filter.DimFilter;
+import org.apache.druid.query.spec.MultipleIntervalSegmentSpec;
+import org.apache.druid.query.spec.MultipleSpecificSegmentSpec;
+import org.apache.druid.query.spec.QuerySegmentSpec;
+import org.apache.druid.segment.TestHelper;
+import org.apache.druid.segment.join.NoopJoinableFactory;
+import org.apache.druid.server.QueryScheduler;
+import org.apache.druid.server.coordination.ServerManagerTest;
+import org.apache.druid.server.coordination.ServerType;
+import org.apache.druid.timeline.DataSegment;
+import org.apache.druid.timeline.VersionedIntervalTimeline;
+import org.apache.druid.timeline.partition.LinearShardSpec;
+import org.joda.time.Interval;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ForkJoinPool;
+
+import static org.mockito.ArgumentMatchers.any;
+
+/**
+ * Performance tests for {@link CachingClusteredClient} can be added here. There is one test for a scenario

Review comment:
       What performance does this class test? Is it a scalability test? It would be nice to make it clear.

##########
File path: core/src/test/java/org/apache/druid/timeline/VersionedIntervalTimelineTestBase.java
##########
@@ -98,6 +98,16 @@ static void assertValues(
     Assert.assertEquals(expected, actualSet);
   }
 
+  static void assertSingleElementChunks(
+      PartitionChunk<OvershadowableInteger> expected,
+      PartitionChunk<OvershadowableInteger> actual
+  )
+  {
+    SingleElementPartitionChunk<OvershadowableInteger> expectedSingle = (SingleElementPartitionChunk<OvershadowableInteger>) expected;

Review comment:
       `SingleElementPartitionChunk` is used only by deprecated things such as `NoneShardSpec` and `Tranquility`. We should deprecate `SingleElementPartitionChunk` as well and stop using it.

##########
File path: core/src/main/java/org/apache/druid/timeline/VersionedIntervalTimeline.java
##########
@@ -849,4 +851,37 @@ public int hashCode()
       return Objects.hash(trueInterval, version, partitionHolder);
     }
   }
+
+  public static class PartitionChunkEntry<VersionType, ObjectType>
+  {
+    private final Interval interval;

Review comment:
       Please add javadoc explaining what this interval is. There are two types of interval in timeline. See `LogicalSegment`.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org