From 257fb3f18eba7595c7df06bd2c4bf23c8fe18dd0 Mon Sep 17 00:00:00 2001 From: fjy Date: Fri, 12 Sep 2014 15:47:41 -0700 Subject: [PATCH] fix retry logic --- .../src/main/java/io/druid/query/RetryQueryRunner.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/processing/src/main/java/io/druid/query/RetryQueryRunner.java b/processing/src/main/java/io/druid/query/RetryQueryRunner.java index d7c8eaa5724..9f3921bd87d 100644 --- a/processing/src/main/java/io/druid/query/RetryQueryRunner.java +++ b/processing/src/main/java/io/druid/query/RetryQueryRunner.java @@ -27,6 +27,7 @@ import com.metamx.common.guava.Sequence; import com.metamx.common.guava.Yielder; import com.metamx.common.guava.YieldingAccumulator; import com.metamx.common.guava.YieldingSequenceBase; +import io.druid.query.spec.MultipleSpecificSegmentSpec; import io.druid.segment.SegmentMissingException; import java.util.List; @@ -73,13 +74,18 @@ public class RetryQueryRunner implements QueryRunner for (int i = 0; i < config.numTries(); i++) { context.put(MISSING_SEGMENTS_KEY, Lists.newArrayList()); - yielder = baseRunner.run(query, context).toYielder(initValue, accumulator); + final Query retryQuery = query.withQuerySegmentSpec( + new MultipleSpecificSegmentSpec( + missingSegments + ) + ); + yielder = baseRunner.run(retryQuery, context).toYielder(initValue, accumulator); if (getMissingSegments(context).isEmpty()) { break; } } - final List finalMissingSegs= getMissingSegments(context); + final List finalMissingSegs = getMissingSegments(context); if (!config.returnPartialResults() && !finalMissingSegs.isEmpty()) { throw new SegmentMissingException("No results found for segments[%s]", finalMissingSegs); }