diff --git a/processing/src/main/java/io/druid/query/groupby/epinephelinae/GroupByMergingQueryRunnerV2.java b/processing/src/main/java/io/druid/query/groupby/epinephelinae/GroupByMergingQueryRunnerV2.java index 95497c393c7..3b467e5917b 100644 --- a/processing/src/main/java/io/druid/query/groupby/epinephelinae/GroupByMergingQueryRunnerV2.java +++ b/processing/src/main/java/io/druid/query/groupby/epinephelinae/GroupByMergingQueryRunnerV2.java @@ -133,6 +133,8 @@ public class GroupByMergingQueryRunnerV2 implements QueryRunner String.format("druid-groupBy-%s_%s", UUID.randomUUID(), query.getId()) ); + final int priority = BaseQuery.getContextPriority(query, 0); + // Figure out timeoutAt time now, so we can apply the timeout to both the mergeBufferPool.take and the actual // query processing together. final Number queryTimeout = query.getContextValue(QueryContextKeys.TIMEOUT, null); @@ -181,9 +183,6 @@ public class GroupByMergingQueryRunnerV2 implements QueryRunner ); final Grouper grouper = pair.lhs; final Accumulator, Row> accumulator = pair.rhs; - closeOnFailure.add(grouper); - - final int priority = BaseQuery.getContextPriority(query, 0); final ReferenceCountingResourceHolder> grouperHolder = new ReferenceCountingResourceHolder<>( grouper, @@ -196,6 +195,7 @@ public class GroupByMergingQueryRunnerV2 implements QueryRunner } } ); + closeOnFailure.add(grouperHolder); ListenableFuture> futures = Futures.allAsList( Lists.newArrayList(