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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7928985  PHOENIX-5291 Ensure that Phoenix coprocessor close all 
scanners.
7928985 is described below

commit 7928985eec8d5758af678784bd815575a8ba06cc
Author: Lars Hofhansl <[email protected]>
AuthorDate: Wed May 22 22:43:34 2019 -0700

    PHOENIX-5291 Ensure that Phoenix coprocessor close all scanners.
---
 .../phoenix/coprocessor/UngroupedAggregateRegionObserver.java    | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
index 40b6faa..f739d38 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
@@ -1212,7 +1212,7 @@ public class UngroupedAggregateRegionObserver extends 
BaseScannerRegionObserver
         long rowCount = 0; // in case of async, we report 0 as number of rows 
updated
         StatisticsCollectionRunTracker statsRunTracker =
                 StatisticsCollectionRunTracker.getInstance(config);
-        boolean runUpdateStats = 
statsRunTracker.addUpdateStatsCommandRegion(region.getRegionInfo(),scan.getFamilyMap().keySet());
+        final boolean runUpdateStats = 
statsRunTracker.addUpdateStatsCommandRegion(region.getRegionInfo(),scan.getFamilyMap().keySet());
         if (runUpdateStats) {
             if (!async) {
                 rowCount = callable.call();
@@ -1241,8 +1241,11 @@ public class UngroupedAggregateRegionObserver extends 
BaseScannerRegionObserver
 
             @Override
             public void close() throws IOException {
-                // No-op because we want to manage closing of the inner 
scanner ourselves.
-                // This happens inside StatsCollectionCallable.
+                // If we ran/scheduled StatsCollectionCallable the delegate
+                // scanner is closed there. Otherwise close it here.
+                if (!runUpdateStats) {
+                    super.close();
+                }
             }
 
             @Override

Reply via email to