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

tdsilva pushed a commit to branch 4.14-HBase-1.4
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/4.14-HBase-1.4 by this push:
     new 393d972  PHOENIX-5126 RegionScanner leak leading to store files not 
getting cleared
393d972 is described below

commit 393d972eddc860fc2fec0b7da5a4fa80be905f2c
Author: Abhishek Singh Chouhan <abhishekchouhan...@gmail.com>
AuthorDate: Thu Feb 7 13:51:15 2019 -0800

    PHOENIX-5126 RegionScanner leak leading to store files not getting cleared
---
 .../phoenix/hbase/index/covered/data/LocalTable.java      | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/data/LocalTable.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/data/LocalTable.java
index 85c54ce..402620f 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/data/LocalTable.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/data/LocalTable.java
@@ -70,14 +70,15 @@ public class LocalTable implements LocalHBaseState {
         s.setTimeRange(0,ts);
     }
     Region region = this.env.getRegion();
-    RegionScanner scanner = region.getScanner(s);
-    List<Cell> kvs = new ArrayList<Cell>(1);
-    boolean more = scanner.next(kvs);
-    assert !more : "Got more than one result when scanning" + " a single row 
in the primary table!";
+    try (RegionScanner scanner = region.getScanner(s)) {
+      List<Cell> kvs = new ArrayList<Cell>(1);
+      boolean more = scanner.next(kvs);
+      assert !more : "Got more than one result when scanning"
+          + " a single row in the primary table!";
 
-    Result r = Result.create(kvs);
-    scanner.close();
-    return r;
+      Result r = Result.create(kvs);
+      return r;
+    }
   }
 
     // Returns the smallest timestamp in the given cell lists.

Reply via email to