diff --git a/processing/src/main/java/io/druid/query/RetryQueryRunner.java b/processing/src/main/java/io/druid/query/RetryQueryRunner.java index 2bd8f34a46a..054ac19313d 100644 --- a/processing/src/main/java/io/druid/query/RetryQueryRunner.java +++ b/processing/src/main/java/io/druid/query/RetryQueryRunner.java @@ -32,11 +32,13 @@ public class RetryQueryRunner implements QueryRunner { private final QueryRunner baseRunner; private final QueryToolChest> toolChest; + private final RetryQueryRunnerConfig config; - public RetryQueryRunner(QueryRunner baseRunner, QueryToolChest> toolChest) + public RetryQueryRunner(QueryRunner baseRunner, QueryToolChest> toolChest, RetryQueryRunnerConfig config) { this.baseRunner = baseRunner; this.toolChest = toolChest; + this.config = config; } @Override @@ -44,7 +46,7 @@ public class RetryQueryRunner implements QueryRunner { Sequence returningSeq = baseRunner.run(query, metadata); - for (int i = RetryQueryRunnerConfig.numTries(); i > 0; i--) { + for (int i = config.numTries(); i > 0; i--) { for (int j = metadata.get("missingSegments").size(); j > 0; j--) { QuerySegmentSpec segmentSpec = new SpecificSegmentSpec((SegmentDescriptor)metadata.get("missingSegments").remove(0)); returningSeq = toolChest.mergeSequences( diff --git a/processing/src/main/java/io/druid/query/RetryQueryRunnerConfig.java b/processing/src/main/java/io/druid/query/RetryQueryRunnerConfig.java index f917c18c1b5..5b5ed2639b5 100644 --- a/processing/src/main/java/io/druid/query/RetryQueryRunnerConfig.java +++ b/processing/src/main/java/io/druid/query/RetryQueryRunnerConfig.java @@ -24,7 +24,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class RetryQueryRunnerConfig { @JsonProperty - private static int numTries = 1; + private int numTries = 1; - public static int numTries() { return numTries; } + public int numTries() { return numTries; } } diff --git a/server/src/main/java/io/druid/server/ClientQuerySegmentWalker.java b/server/src/main/java/io/druid/server/ClientQuerySegmentWalker.java index 4a5e6ef40ac..6c6a2d801f0 100644 --- a/server/src/main/java/io/druid/server/ClientQuerySegmentWalker.java +++ b/server/src/main/java/io/druid/server/ClientQuerySegmentWalker.java @@ -32,6 +32,7 @@ import io.druid.query.QuerySegmentWalker; import io.druid.query.QueryToolChest; import io.druid.query.QueryToolChestWarehouse; import io.druid.query.RetryQueryRunner; +import io.druid.query.RetryQueryRunnerConfig; import io.druid.query.SegmentDescriptor; import io.druid.query.UnionQueryRunner; import org.joda.time.Interval; @@ -45,17 +46,20 @@ public class ClientQuerySegmentWalker implements QuerySegmentWalker private final ServiceEmitter emitter; private final CachingClusteredClient baseClient; private final QueryToolChestWarehouse warehouse; + private final RetryQueryRunnerConfig retryConfig; @Inject public ClientQuerySegmentWalker( ServiceEmitter emitter, CachingClusteredClient baseClient, - QueryToolChestWarehouse warehouse + QueryToolChestWarehouse warehouse, + RetryQueryRunnerConfig retryConfig ) { this.emitter = emitter; this.baseClient = baseClient; this.warehouse = warehouse; + this.retryConfig = retryConfig; } @Override @@ -87,7 +91,7 @@ public class ClientQuerySegmentWalker implements QuerySegmentWalker return toolChest.makeMetricBuilder(query); } }, - toolChest.preMergeQueryDecoration(new RetryQueryRunner(baseClient, toolChest) + toolChest.preMergeQueryDecoration(new RetryQueryRunner(baseClient, toolChest, retryConfig) ) ).withWaitMeasuredFromNow(), toolChest