From a4b95af839a16dacc217ef2733fa2ea0391c1be1 Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Tue, 2 Aug 2016 21:02:30 -0700 Subject: [PATCH] Fix grouper closing in GroupByMergingQueryRunnerV2. (#3316) The grouperHolder should be closed on failure, not the grouper. --- .../groupby/epinephelinae/GroupByMergingQueryRunnerV2.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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(