This is an automated email from the ASF dual-hosted git repository.

cwylie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 6fd48104ede consolidate duplicate implementations of 
ServerManagerForQueryErrorTest and CliHistoricalForQueryErrorTest (#18703)
6fd48104ede is described below

commit 6fd48104edec20ac3ddb5f8031e021cc1092f899
Author: Clint Wylie <[email protected]>
AuthorDate: Thu Oct 30 04:10:13 2025 -0700

    consolidate duplicate implementations of ServerManagerForQueryErrorTest and 
CliHistoricalForQueryErrorTest (#18703)
---
 .../tools/CliHistoricalForQueryErrorTest.java      |   2 +-
 .../tools/ServerManagerForQueryErrorTest.java      |  92 ++++--
 integration-tests/pom.xml                          |  13 -
 .../druid/cli/CliHistoricalForQueryErrorTest.java  |  57 ----
 .../druid/cli/QueryRetryTestCommandCreator.java    |  31 ---
 .../ServerManagerForQueryErrorTest.java            | 310 ---------------------
 .../org.apache.druid.cli.CliCommandCreator         |  16 --
 .../apache/druid/tests/query/ITQueryErrorTest.java |   2 +-
 .../query/ITQueryRetryTestOnMissingSegments.java   |   2 +-
 pom.xml                                            |   2 +-
 .../java/org/apache/druid/cli/CliHistorical.java   |   2 +-
 11 files changed, 73 insertions(+), 456 deletions(-)

diff --git 
a/integration-tests-ex/tools/src/main/java/org/apache/druid/testing/tools/CliHistoricalForQueryErrorTest.java
 
b/integration-tests-ex/tools/src/main/java/org/apache/druid/testing/tools/CliHistoricalForQueryErrorTest.java
index 4fc1e8d220e..89989bd5d51 100644
--- 
a/integration-tests-ex/tools/src/main/java/org/apache/druid/testing/tools/CliHistoricalForQueryErrorTest.java
+++ 
b/integration-tests-ex/tools/src/main/java/org/apache/druid/testing/tools/CliHistoricalForQueryErrorTest.java
@@ -30,7 +30,7 @@ import org.apache.druid.query.QuerySegmentWalker;
 import java.util.Properties;
 
 @Command(
-    name = "historical-for-query-error-test-ex",
+    name = "historical-for-query-error-test",
     description = "Runs a Historical node modified for query error test"
 )
 public class CliHistoricalForQueryErrorTest extends CliHistorical
diff --git 
a/integration-tests-ex/tools/src/main/java/org/apache/druid/testing/tools/ServerManagerForQueryErrorTest.java
 
b/integration-tests-ex/tools/src/main/java/org/apache/druid/testing/tools/ServerManagerForQueryErrorTest.java
index 8b358e4b11f..ff5d997567f 100644
--- 
a/integration-tests-ex/tools/src/main/java/org/apache/druid/testing/tools/ServerManagerForQueryErrorTest.java
+++ 
b/integration-tests-ex/tools/src/main/java/org/apache/druid/testing/tools/ServerManagerForQueryErrorTest.java
@@ -55,21 +55,27 @@ import org.apache.druid.server.initialization.ServerConfig;
 import org.apache.druid.timeline.DataSegment;
 import org.apache.druid.timeline.VersionedIntervalTimeline;
 
-import java.util.HashSet;
 import java.util.Optional;
-import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * This server manager is designed to test various query failures.
- *
- * - Missing segments. A segment can be missing during a query if a historical 
drops the segment
+ * <ul>
+ *  <li> Missing segments. A segment can be missing during a query if a 
historical drops the segment
  *   after the broker issues the query to the historical. To mimic this 
situation, the historical
- *   with this server manager announces all segments assigned, but reports 
missing segments for the
- *   first 3 segments specified in the query. See 
ITQueryRetryTestOnMissingSegments.
- * - Other query errors. This server manager returns a sequence that always 
throws an exception
- *   based on a given query context value. See ITQueryErrorTest.
+ *   with this server manager announces all segments assigned, and reports 
missing segments based on the following:
+ *   <ul>
+ *     <li> If {@link #QUERY_RETRY_UNAVAILABLE_SEGMENT_IDX_KEY} and {@link 
#QUERY_RETRY_TEST_CONTEXT_KEY} are set,
+ *           the segment at that index is reported as missing exactly 
once.</li>
+ *     <li> If {@link #QUERY_RETRY_UNAVAILABLE_SEGMENT_IDX_KEY} is not set or 
is -1, it simulates missing segments
+ *     starting from the beginning, up to {@link 
#MAX_NUM_FALSE_MISSING_SEGMENTS_REPORTS}.</li>
+ *   </ul>
+ *   The missing report is only generated once for the first time. Post that 
report, upon retry, all segments are served
+ *   for the datasource. See ITQueryRetryTestOnMissingSegments. </li>
+ * <li> Other query errors. This server manager returns a sequence that always 
throws an exception
+ *   based on a given query context value. See ITQueryErrorTest. </li>
+ * </ul>
  *
  * @see org.apache.druid.query.RetryQueryRunner for query retrying.
  * @see org.apache.druid.client.JsonParserIterator for handling query errors 
from historicals.
@@ -83,11 +89,21 @@ public class ServerManagerForQueryErrorTest extends 
ServerManager
   public static final String QUERY_UNSUPPORTED_TEST_CONTEXT_KEY = 
"query-unsupported-test";
   public static final String RESOURCE_LIMIT_EXCEEDED_TEST_CONTEXT_KEY = 
"resource-limit-exceeded-test";
   public static final String QUERY_FAILURE_TEST_CONTEXT_KEY = 
"query-failure-test";
+  /**
+   * Query context that indicates which segment should be marked as 
unavilable/missing.
+   * This should be used in conjunction with {@link 
#QUERY_RETRY_TEST_CONTEXT_KEY}.
+   * <p>
+   * A value of {@code 0} means the first segment will be reported as missing, 
{@code 1} for the second, and so on.
+   * If this key is not set (default = -1), the test will instead simulate 
missing up to
+   * {@link #MAX_NUM_FALSE_MISSING_SEGMENTS_REPORTS} segments from the 
beginning.
+   * </p>
+   */
+  public static final String QUERY_RETRY_UNAVAILABLE_SEGMENT_IDX_KEY = 
"unavailable-segment-idx";
+  private static final int MAX_NUM_FALSE_MISSING_SEGMENTS_REPORTS = 1;
 
   private static final Logger LOG = new 
Logger(ServerManagerForQueryErrorTest.class);
-  private static final int MAX_NUM_FALSE_MISSING_SEGMENTS_REPORTS = 3;
 
-  private final ConcurrentHashMap<String, Set<SegmentDescriptor>> 
queryToIgnoredSegments = new ConcurrentHashMap<>();
+  private final ConcurrentHashMap<String, Integer> queryToIgnoredSegments = 
new ConcurrentHashMap<>();
 
   @Inject
   public ServerManagerForQueryErrorTest(
@@ -137,30 +153,43 @@ public class ServerManagerForQueryErrorTest extends 
ServerManager
                    .map(segment -> {
                           final QueryContext queryContext = query.context();
                           if 
(queryContext.getBoolean(QUERY_RETRY_TEST_CONTEXT_KEY, false)) {
+                            final int unavailableSegmentIdx = 
queryContext.getInt(QUERY_RETRY_UNAVAILABLE_SEGMENT_IDX_KEY, -1);
                             final MutableBoolean isIgnoreSegment = new 
MutableBoolean(false);
                             queryToIgnoredSegments.compute(
                                 query.getMostSpecificId(),
-                                (queryId, ignoredSegments) -> {
-                                  if (ignoredSegments == null) {
-                                    ignoredSegments = new HashSet<>();
+                                (queryId, ignoreCounter) -> {
+                                  if (ignoreCounter == null) {
+                                    ignoreCounter = 0;
                                   }
-                                  if (ignoredSegments.size() < 
MAX_NUM_FALSE_MISSING_SEGMENTS_REPORTS) {
-                                    
ignoredSegments.add(ref.getSegmentDescriptor());
+
+                                  if (unavailableSegmentIdx >= 0 && 
unavailableSegmentIdx == ignoreCounter) {
+                                    // Fail exactly once when counter matches 
the configured retry index
+                                    ignoreCounter++;
+                                    isIgnoreSegment.setTrue();
+                                  } else if (ignoreCounter < 
MAX_NUM_FALSE_MISSING_SEGMENTS_REPORTS) {
+                                    // Fail up to N times for this query
+                                    ignoreCounter++;
                                     isIgnoreSegment.setTrue();
                                   }
-                                  return ignoredSegments;
+                                  return ignoreCounter;
                                 }
                             );
 
                             if (isIgnoreSegment.isTrue()) {
-                              LOG.info("Pretending I don't have segment [%s]", 
ref.getSegmentReference());
+                              LOG.info(
+                                  "Pretending I don't have segment[%s]",
+                                  ref.getSegmentDescriptor()
+                              );
                               return new 
ReportTimelineMissingSegmentQueryRunner<T>(ref.getSegmentDescriptor());
                             }
                           } else if 
(queryContext.getBoolean(QUERY_TIMEOUT_TEST_CONTEXT_KEY, false)) {
                             return (QueryRunner<T>) (queryPlus, 
responseContext) -> new Sequence<>()
                             {
                               @Override
-                              public <OutType> OutType accumulate(OutType 
initValue, Accumulator<OutType, T> accumulator)
+                              public <OutType> OutType accumulate(
+                                  OutType initValue,
+                                  Accumulator<OutType, T> accumulator
+                              )
                               {
                                 throw new QueryTimeoutException("query timeout 
test");
                               }
@@ -178,10 +207,14 @@ public class ServerManagerForQueryErrorTest extends 
ServerManager
                             return (QueryRunner<T>) (queryPlus, 
responseContext) -> new Sequence<>()
                             {
                               @Override
-                              public <OutType> OutType accumulate(OutType 
initValue, Accumulator<OutType, T> accumulator)
+                              public <OutType> OutType accumulate(
+                                  OutType initValue,
+                                  Accumulator<OutType, T> accumulator
+                              )
                               {
                                 throw 
QueryCapacityExceededException.withErrorMessageAndResolvedHost(
-                                    "query capacity exceeded test");
+                                    "query capacity exceeded test"
+                                );
                               }
 
                               @Override
@@ -191,14 +224,18 @@ public class ServerManagerForQueryErrorTest extends 
ServerManager
                               )
                               {
                                 throw 
QueryCapacityExceededException.withErrorMessageAndResolvedHost(
-                                    "query capacity exceeded test");
+                                    "query capacity exceeded test"
+                                );
                               }
                             };
                           } else if 
(queryContext.getBoolean(QUERY_UNSUPPORTED_TEST_CONTEXT_KEY, false)) {
                             return (QueryRunner<T>) (queryPlus, 
responseContext) -> new Sequence<>()
                             {
                               @Override
-                              public <OutType> OutType accumulate(OutType 
initValue, Accumulator<OutType, T> accumulator)
+                              public <OutType> OutType accumulate(
+                                  OutType initValue,
+                                  Accumulator<OutType, T> accumulator
+                              )
                               {
                                 throw new QueryUnsupportedException("query 
unsupported test");
                               }
@@ -216,7 +253,10 @@ public class ServerManagerForQueryErrorTest extends 
ServerManager
                             return (QueryRunner<T>) (queryPlus, 
responseContext) -> new Sequence<>()
                             {
                               @Override
-                              public <OutType> OutType accumulate(OutType 
initValue, Accumulator<OutType, T> accumulator)
+                              public <OutType> OutType accumulate(
+                                  OutType initValue,
+                                  Accumulator<OutType, T> accumulator
+                              )
                               {
                                 throw new 
ResourceLimitExceededException("resource limit exceeded test");
                               }
@@ -234,7 +274,10 @@ public class ServerManagerForQueryErrorTest extends 
ServerManager
                             return (QueryRunner<T>) (queryPlus, 
responseContext) -> new Sequence<>()
                             {
                               @Override
-                              public <OutType> OutType accumulate(OutType 
initValue, Accumulator<OutType, T> accumulator)
+                              public <OutType> OutType accumulate(
+                                  OutType initValue,
+                                  Accumulator<OutType, T> accumulator
+                              )
                               {
                                 throw new RuntimeException("query failure 
test");
                               }
@@ -249,6 +292,7 @@ public class ServerManagerForQueryErrorTest extends 
ServerManager
                               }
                             };
                           }
+
                           return buildQueryRunnerForSegment(
                               ref.getSegmentDescriptor(),
                               segment,
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 1a282684efa..b6d2b4feef6 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -49,14 +49,6 @@
             <artifactId>druid-it-tools</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.github.rvesse</groupId>
-            <artifactId>airline</artifactId>
-        </dependency>
         <dependency>
             <groupId>com.amazonaws</groupId>
             <artifactId>aws-java-sdk-kinesis</artifactId>
@@ -227,11 +219,6 @@
             <artifactId>druid-multi-stage-query</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.druid</groupId>
-            <artifactId>druid-services</artifactId>
-            <version>${project.parent.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.apache.druid</groupId>
             <artifactId>druid-server</artifactId>
diff --git 
a/integration-tests/src/main/java/org/apache/druid/cli/CliHistoricalForQueryErrorTest.java
 
b/integration-tests/src/main/java/org/apache/druid/cli/CliHistoricalForQueryErrorTest.java
deleted file mode 100644
index c559b2ff842..00000000000
--- 
a/integration-tests/src/main/java/org/apache/druid/cli/CliHistoricalForQueryErrorTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.cli;
-
-import com.github.rvesse.airline.annotations.Command;
-import com.google.inject.Binder;
-import com.google.inject.Inject;
-import org.apache.druid.guice.LazySingleton;
-import org.apache.druid.java.util.common.logger.Logger;
-import org.apache.druid.query.QuerySegmentWalker;
-import org.apache.druid.server.coordination.ServerManagerForQueryErrorTest;
-
-import java.util.Properties;
-
-@Command(
-    name = "historical-for-query-error-test",
-    description = "Runs a Historical node modified for query error test"
-)
-public class CliHistoricalForQueryErrorTest extends CliHistorical
-{
-  private static final Logger log = new 
Logger(CliHistoricalForQueryErrorTest.class);
-
-  public CliHistoricalForQueryErrorTest()
-  {
-    super();
-  }
-
-  @Inject
-  @Override
-  public void configure(Properties properties)
-  {
-    log.info("Historical is configured for testing query error on missing 
segments");
-  }
-
-  @Override
-  public void bindQuerySegmentWalker(Binder binder)
-  {
-    
binder.bind(QuerySegmentWalker.class).to(ServerManagerForQueryErrorTest.class).in(LazySingleton.class);
-  }
-}
diff --git 
a/integration-tests/src/main/java/org/apache/druid/cli/QueryRetryTestCommandCreator.java
 
b/integration-tests/src/main/java/org/apache/druid/cli/QueryRetryTestCommandCreator.java
deleted file mode 100644
index fb00126da81..00000000000
--- 
a/integration-tests/src/main/java/org/apache/druid/cli/QueryRetryTestCommandCreator.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.cli;
-
-import com.github.rvesse.airline.builder.CliBuilder;
-
-public class QueryRetryTestCommandCreator implements CliCommandCreator
-{
-  @Override
-  public void addCommands(CliBuilder builder)
-  {
-    
builder.withGroup("server").withCommands(CliHistoricalForQueryErrorTest.class);
-  }
-}
diff --git 
a/integration-tests/src/main/java/org/apache/druid/server/coordination/ServerManagerForQueryErrorTest.java
 
b/integration-tests/src/main/java/org/apache/druid/server/coordination/ServerManagerForQueryErrorTest.java
deleted file mode 100644
index 62db7527ea8..00000000000
--- 
a/integration-tests/src/main/java/org/apache/druid/server/coordination/ServerManagerForQueryErrorTest.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * 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.server.coordination;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.inject.Inject;
-import org.apache.commons.lang3.mutable.MutableBoolean;
-import org.apache.druid.client.cache.Cache;
-import org.apache.druid.client.cache.CacheConfig;
-import org.apache.druid.client.cache.CachePopulator;
-import org.apache.druid.guice.annotations.Smile;
-import org.apache.druid.java.util.common.guava.Accumulator;
-import org.apache.druid.java.util.common.guava.FunctionalIterable;
-import org.apache.druid.java.util.common.guava.Sequence;
-import org.apache.druid.java.util.common.guava.Yielder;
-import org.apache.druid.java.util.common.guava.YieldingAccumulator;
-import org.apache.druid.java.util.common.io.Closer;
-import org.apache.druid.java.util.common.logger.Logger;
-import org.apache.druid.java.util.emitter.service.ServiceEmitter;
-import org.apache.druid.query.Query;
-import org.apache.druid.query.QueryCapacityExceededException;
-import org.apache.druid.query.QueryContext;
-import org.apache.druid.query.QueryProcessingPool;
-import org.apache.druid.query.QueryRunner;
-import org.apache.druid.query.QueryRunnerFactory;
-import org.apache.druid.query.QueryRunnerFactoryConglomerate;
-import org.apache.druid.query.QueryTimeoutException;
-import org.apache.druid.query.QueryToolChest;
-import org.apache.druid.query.QueryUnsupportedException;
-import org.apache.druid.query.ReportTimelineMissingSegmentQueryRunner;
-import org.apache.druid.query.ResourceLimitExceededException;
-import org.apache.druid.query.SegmentDescriptor;
-import org.apache.druid.query.policy.NoopPolicyEnforcer;
-import org.apache.druid.segment.SegmentMapFunction;
-import org.apache.druid.server.SegmentManager;
-import org.apache.druid.server.ServerManager;
-import org.apache.druid.server.initialization.ServerConfig;
-import org.apache.druid.timeline.DataSegment;
-import org.apache.druid.timeline.VersionedIntervalTimeline;
-
-import java.util.Optional;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * This server manager is designed to test various query failures.
- * <ul>
- *  <li> Missing segments. A segment can be missing during a query if a 
historical drops the segment
- *   after the broker issues the query to the historical. To mimic this 
situation, the historical
- *   with this server manager announces all segments assigned, and reports 
missing segments based on the following:
- *   <ul>
- *     <li> If {@link #QUERY_RETRY_UNAVAILABLE_SEGMENT_IDX_KEY} and {@link 
#QUERY_RETRY_TEST_CONTEXT_KEY} are set,
- *           the segment at that index is reported as missing exactly 
once.</li>
- *     <li> If {@link #QUERY_RETRY_UNAVAILABLE_SEGMENT_IDX_KEY} is not set or 
is -1, it simulates missing segments
- *     starting from the beginning, up to {@link 
#MAX_NUM_FALSE_MISSING_SEGMENTS_REPORTS}.</li>
- *   </ul>
- *   The missing report is only generated once for the first time. Post that 
report, upon retry, all segments are served
- *   for the datasource. See ITQueryRetryTestOnMissingSegments. </li>
- * <li> Other query errors. This server manager returns a sequence that always 
throws an exception
- *   based on a given query context value. See ITQueryErrorTest. </li>
- * </ul>
- *
- * @see org.apache.druid.query.RetryQueryRunner for query retrying.
- * @see org.apache.druid.client.JsonParserIterator for handling query errors 
from historicals.
- */
-public class ServerManagerForQueryErrorTest extends ServerManager
-{
-  // Query context key that indicates this query is for query retry testing.
-  public static final String QUERY_RETRY_TEST_CONTEXT_KEY = "query-retry-test";
-  public static final String QUERY_TIMEOUT_TEST_CONTEXT_KEY = 
"query-timeout-test";
-  public static final String QUERY_CAPACITY_EXCEEDED_TEST_CONTEXT_KEY = 
"query-capacity-exceeded-test";
-  public static final String QUERY_UNSUPPORTED_TEST_CONTEXT_KEY = 
"query-unsupported-test";
-  public static final String RESOURCE_LIMIT_EXCEEDED_TEST_CONTEXT_KEY = 
"resource-limit-exceeded-test";
-  public static final String QUERY_FAILURE_TEST_CONTEXT_KEY = 
"query-failure-test";
-  /**
-   * Query context that indicates which segment should be marked as 
unavilable/missing.
-   * This should be used in conjunction with {@link 
#QUERY_RETRY_TEST_CONTEXT_KEY}.
-   * <p>
-   * A value of {@code 0} means the first segment will be reported as missing, 
{@code 1} for the second, and so on.
-   * If this key is not set (default = -1), the test will instead simulate 
missing up to
-   * {@link #MAX_NUM_FALSE_MISSING_SEGMENTS_REPORTS} segments from the 
beginning.
-   * </p>
-   */
-  public static final String QUERY_RETRY_UNAVAILABLE_SEGMENT_IDX_KEY = 
"unavailable-segment-idx";
-  private static final int MAX_NUM_FALSE_MISSING_SEGMENTS_REPORTS = 1;
-
-  private static final Logger LOG = new 
Logger(ServerManagerForQueryErrorTest.class);
-
-  private final ConcurrentHashMap<String, Integer> queryToIgnoredSegments = 
new ConcurrentHashMap<>();
-
-  @Inject
-  public ServerManagerForQueryErrorTest(
-      QueryRunnerFactoryConglomerate conglomerate,
-      ServiceEmitter emitter,
-      QueryProcessingPool queryProcessingPool,
-      CachePopulator cachePopulator,
-      @Smile ObjectMapper objectMapper,
-      Cache cache,
-      CacheConfig cacheConfig,
-      SegmentManager segmentManager,
-      ServerConfig serverConfig
-  )
-  {
-    super(
-        conglomerate,
-        emitter,
-        queryProcessingPool,
-        cachePopulator,
-        objectMapper,
-        cache,
-        cacheConfig,
-        segmentManager,
-        serverConfig,
-        NoopPolicyEnforcer.instance()
-    );
-  }
-
-  @Override
-  protected <T> FunctionalIterable<QueryRunner<T>> getQueryRunnersForSegments(
-      final VersionedIntervalTimeline<String, DataSegment> timeline,
-      final Iterable<SegmentDescriptor> specs,
-      final Query<T> query,
-      final QueryRunnerFactory<T, Query<T>> factory,
-      final QueryToolChest<T, Query<T>> toolChest,
-      final SegmentMapFunction segmentMapFn,
-      final AtomicLong cpuTimeAccumulator,
-      final Optional<byte[]> cacheKeyPrefix,
-      final Closer closer
-  )
-  {
-    return FunctionalIterable
-        .create(getSegmentReferences(timeline, specs, segmentMapFn, 
query.context().getTimeout()))
-        .transform(
-            ref ->
-                ref.getSegmentReference()
-                   .map(segment -> {
-                          final QueryContext queryContext = query.context();
-                          if 
(queryContext.getBoolean(QUERY_RETRY_TEST_CONTEXT_KEY, false)) {
-                            final int unavailableSegmentIdx = 
queryContext.getInt(QUERY_RETRY_UNAVAILABLE_SEGMENT_IDX_KEY, -1);
-                            final MutableBoolean isIgnoreSegment = new 
MutableBoolean(false);
-                            queryToIgnoredSegments.compute(
-                                query.getMostSpecificId(),
-                                (queryId, ignoreCounter) -> {
-                                  if (ignoreCounter == null) {
-                                    ignoreCounter = 0;
-                                  }
-
-                                  if (unavailableSegmentIdx >= 0 && 
unavailableSegmentIdx == ignoreCounter) {
-                                    // Fail exactly once when counter matches 
the configured retry index
-                                    ignoreCounter++;
-                                    isIgnoreSegment.setTrue();
-                                  } else if (ignoreCounter < 
MAX_NUM_FALSE_MISSING_SEGMENTS_REPORTS) {
-                                    // Fail up to N times for this query
-                                    ignoreCounter++;
-                                    isIgnoreSegment.setTrue();
-                                  }
-                                  return ignoreCounter;
-                                }
-                            );
-
-                            if (isIgnoreSegment.isTrue()) {
-                              LOG.info(
-                                  "Pretending I don't have segment[%s]",
-                                  ref.getSegmentDescriptor()
-                              );
-                              return new 
ReportTimelineMissingSegmentQueryRunner<T>(ref.getSegmentDescriptor());
-                            }
-                          } else if 
(queryContext.getBoolean(QUERY_TIMEOUT_TEST_CONTEXT_KEY, false)) {
-                            return (QueryRunner<T>) (queryPlus, 
responseContext) -> new Sequence<>()
-                            {
-                              @Override
-                              public <OutType> OutType accumulate(
-                                  OutType initValue,
-                                  Accumulator<OutType, T> accumulator
-                              )
-                              {
-                                throw new QueryTimeoutException("query timeout 
test");
-                              }
-
-                              @Override
-                              public <OutType> Yielder<OutType> toYielder(
-                                  OutType initValue,
-                                  YieldingAccumulator<OutType, T> accumulator
-                              )
-                              {
-                                throw new QueryTimeoutException("query timeout 
test");
-                              }
-                            };
-                          } else if 
(queryContext.getBoolean(QUERY_CAPACITY_EXCEEDED_TEST_CONTEXT_KEY, false)) {
-                            return (QueryRunner<T>) (queryPlus, 
responseContext) -> new Sequence<>()
-                            {
-                              @Override
-                              public <OutType> OutType accumulate(
-                                  OutType initValue,
-                                  Accumulator<OutType, T> accumulator
-                              )
-                              {
-                                throw 
QueryCapacityExceededException.withErrorMessageAndResolvedHost(
-                                    "query capacity exceeded test"
-                                );
-                              }
-
-                              @Override
-                              public <OutType> Yielder<OutType> toYielder(
-                                  OutType initValue,
-                                  YieldingAccumulator<OutType, T> accumulator
-                              )
-                              {
-                                throw 
QueryCapacityExceededException.withErrorMessageAndResolvedHost(
-                                    "query capacity exceeded test"
-                                );
-                              }
-                            };
-                          } else if 
(queryContext.getBoolean(QUERY_UNSUPPORTED_TEST_CONTEXT_KEY, false)) {
-                            return (QueryRunner<T>) (queryPlus, 
responseContext) -> new Sequence<>()
-                            {
-                              @Override
-                              public <OutType> OutType accumulate(
-                                  OutType initValue,
-                                  Accumulator<OutType, T> accumulator
-                              )
-                              {
-                                throw new QueryUnsupportedException("query 
unsupported test");
-                              }
-
-                              @Override
-                              public <OutType> Yielder<OutType> toYielder(
-                                  OutType initValue,
-                                  YieldingAccumulator<OutType, T> accumulator
-                              )
-                              {
-                                throw new QueryUnsupportedException("query 
unsupported test");
-                              }
-                            };
-                          } else if 
(queryContext.getBoolean(RESOURCE_LIMIT_EXCEEDED_TEST_CONTEXT_KEY, false)) {
-                            return (QueryRunner<T>) (queryPlus, 
responseContext) -> new Sequence<>()
-                            {
-                              @Override
-                              public <OutType> OutType accumulate(
-                                  OutType initValue,
-                                  Accumulator<OutType, T> accumulator
-                              )
-                              {
-                                throw new 
ResourceLimitExceededException("resource limit exceeded test");
-                              }
-
-                              @Override
-                              public <OutType> Yielder<OutType> toYielder(
-                                  OutType initValue,
-                                  YieldingAccumulator<OutType, T> accumulator
-                              )
-                              {
-                                throw new 
ResourceLimitExceededException("resource limit exceeded test");
-                              }
-                            };
-                          } else if 
(queryContext.getBoolean(QUERY_FAILURE_TEST_CONTEXT_KEY, false)) {
-                            return (QueryRunner<T>) (queryPlus, 
responseContext) -> new Sequence<>()
-                            {
-                              @Override
-                              public <OutType> OutType accumulate(
-                                  OutType initValue,
-                                  Accumulator<OutType, T> accumulator
-                              )
-                              {
-                                throw new RuntimeException("query failure 
test");
-                              }
-
-                              @Override
-                              public <OutType> Yielder<OutType> toYielder(
-                                  OutType initValue,
-                                  YieldingAccumulator<OutType, T> accumulator
-                              )
-                              {
-                                throw new RuntimeException("query failure 
test");
-                              }
-                            };
-                          }
-
-                          return buildQueryRunnerForSegment(
-                              ref.getSegmentDescriptor(),
-                              segment,
-                              factory,
-                              toolChest,
-                              cpuTimeAccumulator,
-                              cacheKeyPrefix
-                          );
-                        }
-                   ).orElse(
-                       new 
ReportTimelineMissingSegmentQueryRunner<>(ref.getSegmentDescriptor())
-                   )
-        );
-  }
-}
diff --git 
a/integration-tests/src/main/resources/META-INF/services/org.apache.druid.cli.CliCommandCreator
 
b/integration-tests/src/main/resources/META-INF/services/org.apache.druid.cli.CliCommandCreator
deleted file mode 100644
index b2467a1be06..00000000000
--- 
a/integration-tests/src/main/resources/META-INF/services/org.apache.druid.cli.CliCommandCreator
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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.
-
-org.apache.druid.cli.QueryRetryTestCommandCreator
diff --git 
a/integration-tests/src/test/java/org/apache/druid/tests/query/ITQueryErrorTest.java
 
b/integration-tests/src/test/java/org/apache/druid/tests/query/ITQueryErrorTest.java
index fd8ce5aabc7..7322a32eb5a 100644
--- 
a/integration-tests/src/test/java/org/apache/druid/tests/query/ITQueryErrorTest.java
+++ 
b/integration-tests/src/test/java/org/apache/druid/tests/query/ITQueryErrorTest.java
@@ -23,8 +23,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.inject.Inject;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.query.QueryContexts;
-import org.apache.druid.server.coordination.ServerManagerForQueryErrorTest;
 import org.apache.druid.testing.guice.DruidTestModuleFactory;
+import org.apache.druid.testing.tools.ServerManagerForQueryErrorTest;
 import org.apache.druid.testing.utils.DataLoaderHelper;
 import org.apache.druid.testing.utils.SqlTestQueryHelper;
 import org.apache.druid.testing.utils.TestQueryHelper;
diff --git 
a/integration-tests/src/test/java/org/apache/druid/tests/query/ITQueryRetryTestOnMissingSegments.java
 
b/integration-tests/src/test/java/org/apache/druid/tests/query/ITQueryRetryTestOnMissingSegments.java
index 2b096ca4a87..eb7bcacdb13 100644
--- 
a/integration-tests/src/test/java/org/apache/druid/tests/query/ITQueryRetryTestOnMissingSegments.java
+++ 
b/integration-tests/src/test/java/org/apache/druid/tests/query/ITQueryRetryTestOnMissingSegments.java
@@ -26,12 +26,12 @@ import org.apache.druid.java.util.common.ISE;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.java.util.http.client.response.StatusResponseHolder;
 import org.apache.druid.query.QueryContexts;
-import org.apache.druid.server.coordination.ServerManagerForQueryErrorTest;
 import org.apache.druid.testing.clients.CoordinatorResourceTestClient;
 import org.apache.druid.testing.clients.QueryResourceTestClient;
 import org.apache.druid.testing.guice.DruidTestModuleFactory;
 import org.apache.druid.testing.tools.ITRetryUtil;
 import org.apache.druid.testing.tools.IntegrationTestingConfig;
+import org.apache.druid.testing.tools.ServerManagerForQueryErrorTest;
 import org.apache.druid.testing.utils.QueryResultVerifier;
 import org.apache.druid.testing.utils.QueryWithResults;
 import org.apache.druid.testing.utils.TestQueryHelper;
diff --git a/pom.xml b/pom.xml
index 17a3358a68f..0b4046e2cfd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -265,7 +265,7 @@
         <module>extensions-contrib/druid-ranger-security</module>
         <!-- distribution packaging -->
         <module>distribution</module>
-        <!-- Revised integration tests -->
+        <!-- more test stuff -->
         <module>integration-tests-ex/tools</module>
         <module>quidem-ut</module>
         <module>embedded-tests</module>
diff --git a/services/src/main/java/org/apache/druid/cli/CliHistorical.java 
b/services/src/main/java/org/apache/druid/cli/CliHistorical.java
index 17f173bd243..3c48dbc3565 100644
--- a/services/src/main/java/org/apache/druid/cli/CliHistorical.java
+++ b/services/src/main/java/org/apache/druid/cli/CliHistorical.java
@@ -161,7 +161,7 @@ public class CliHistorical extends ServerRunnable
   }
 
   /**
-   * This method is visible for testing query retry on missing segments. See 
{@link CliHistoricalForQueryErrorTest}.
+   * This method is visible for testing query retry on missing segments.
    */
   @VisibleForTesting
   public void bindQuerySegmentWalker(Binder binder)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to