This is an automated email from the ASF dual-hosted git repository.
larsh pushed a commit to branch 4.x-HBase-1.4
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/4.x-HBase-1.4 by this push:
new cd59f27 PHOENIX-5291 Ensure that Phoenix coprocessor close all
scanners.
cd59f27 is described below
commit cd59f2787f883457fa7e71cbc2529d9302266883
Author: Lars Hofhansl <[email protected]>
AuthorDate: Wed May 22 22:38:20 2019 -0700
PHOENIX-5291 Ensure that Phoenix coprocessor close all scanners.
---
.../coprocessor/UngroupedAggregateRegionObserver.java | 17 ++++++++++++++---
1 file changed, 14 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 a965a87..f6569f5 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
@@ -1181,7 +1181,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();
@@ -1210,8 +1210,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
@@ -1448,6 +1451,14 @@ public class UngroupedAggregateRegionObserver extends
BaseScannerRegionObserver
+ fullTableName);
Scan scan = new Scan();
scan.setMaxVersions();
+
+ // close the passed scanner since we are
returning a brand-new one
+ try {
+ if (s != null) {
+ s.close();
+ }
+ } catch (IOException ignore) {}
+
return new StoreScanner(store,
store.getScanInfo(), scan, scanners,
ScanType.COMPACT_RETAIN_DELETES,
store.getSmallestReadPoint(),
HConstants.OLDEST_TIMESTAMP);