This is an automated email from the ASF dual-hosted git repository.
larsh pushed a commit to branch 4.x-HBase-1.3
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/4.x-HBase-1.3 by this push:
new 41e3c88 PHOENIX-5291 Ensure that Phoenix coprocessor close all
scanners.
41e3c88 is described below
commit 41e3c8890e2e6c9ab4b07af51eeb472f2b9cf498
Author: Lars Hofhansl <[email protected]>
AuthorDate: Wed May 22 22:40:34 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 dc7567b..dc61a98 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
@@ -1175,7 +1175,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();
@@ -1204,8 +1204,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
@@ -1442,6 +1445,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);