hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [1/2] hbase git commit: HBASE-19502 Make sure we have closed all StoreFileScanner if we fail to open any StoreFileScanners
Date Thu, 14 Dec 2017 23:58:34 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 54ca1db6b -> ff023bcc4
  refs/heads/branch-1.4 58c5df64e -> 84ebc82eb


HBASE-19502 Make sure we have closed all StoreFileScanner if we fail to open any StoreFileScanners


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/84ebc82e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/84ebc82e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/84ebc82e

Branch: refs/heads/branch-1.4
Commit: 84ebc82eb45d358c74f1e3d812b56ac746548ffc
Parents: 58c5df6
Author: Chia-Ping Tsai <chia7712@gmail.com>
Authored: Wed Dec 13 21:47:27 2017 +0800
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Thu Dec 14 13:19:29 2017 -0800

----------------------------------------------------------------------
 .../hbase/regionserver/StoreFileScanner.java    | 22 ++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/84ebc82e/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
index 8132365..b3f7fa6 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
@@ -132,12 +132,22 @@ public class StoreFileScanner implements KeyValueScanner {
     List<StoreFileScanner> scanners = new ArrayList<StoreFileScanner>(files.size());
     List<StoreFile> sorted_files = new ArrayList<>(files);
     Collections.sort(sorted_files, StoreFile.Comparators.SEQ_ID);
-    for (int i = 0; i < sorted_files.size(); i++) {
-      StoreFile.Reader r = sorted_files.get(i).createReader(canUseDrop);
-      r.setReplicaStoreFile(isPrimaryReplica);
-      StoreFileScanner scanner = r.getStoreFileScanner(cacheBlocks, usePread, isCompaction,
readPt,
-        i, matcher != null ? !matcher.hasNullColumnInQuery() : false);
-      scanners.add(scanner);
+    boolean succ = false;
+    try {
+      for (int i = 0; i < sorted_files.size(); i++) {
+        StoreFile.Reader r = sorted_files.get(i).createReader(canUseDrop);
+        r.setReplicaStoreFile(isPrimaryReplica);
+        StoreFileScanner scanner = r.getStoreFileScanner(cacheBlocks, usePread, isCompaction,
readPt,
+            i, matcher != null ? !matcher.hasNullColumnInQuery() : false);
+        scanners.add(scanner);
+      }
+      succ = true;
+    } finally {
+      if (!succ) {
+        for (StoreFileScanner scanner : scanners) {
+          scanner.close();
+        }
+      }
     }
     return scanners;
   }


Mime
View raw message