hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-16012 Major compaction can't work due to obsolete scanner read point in RegionServer (Guanghao Zhang)
Date Wed, 22 Jun 2016 09:09:42 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 6ba67ab8d -> ba631b4d9


HBASE-16012 Major compaction can't work due to obsolete scanner read point in RegionServer
(Guanghao Zhang)


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

Branch: refs/heads/branch-1
Commit: ba631b4d920c77532990f16d12b538b90b22611e
Parents: 6ba67ab
Author: tedyu <yuzhihong@gmail.com>
Authored: Wed Jun 22 02:09:35 2016 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Wed Jun 22 02:09:35 2016 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/HRegion.java      | 28 +++++++++++++++-----
 .../hbase/regionserver/RSRpcServices.java       | 20 ++++++++------
 2 files changed, 34 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ba631b4d/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index a661d24..25535ed 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -5714,12 +5714,8 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
           }
         }
         initializeKVHeap(scanners, joinedScanners, region);
-      } catch (IOException e) {
-        // close all already instantiated scanners before throwing the exception
-        for (KeyValueScanner scanner : instantiatedScanners) {
-          scanner.close();
-        }
-        throw e;
+      } catch (Throwable t) {
+        throw handleException(instantiatedScanners, t);
       }
     }
 
@@ -5732,6 +5728,26 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
       }
     }
 
+    private IOException handleException(List<KeyValueScanner> instantiatedScanners,
+        Throwable t) {
+      // remove scaner read point before throw the exception
+      scannerReadPoints.remove(this);
+      if (storeHeap != null) {
+        storeHeap.close();
+        storeHeap = null;
+        if (joinedHeap != null) {
+          joinedHeap.close();
+          joinedHeap = null;
+        }
+      } else {
+        // close all already instantiated scanners before throwing the exception
+        for (KeyValueScanner scanner : instantiatedScanners) {
+          scanner.close();
+        }
+      }
+      return t instanceof IOException ? (IOException) t : new IOException(t);
+    }
+
     @Override
     public long getMaxResultSize() {
       return maxResultSize;

http://git-wip-us.apache.org/repos/asf/hbase/blob/ba631b4d/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
index 80eb9ec..640cd8f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
@@ -305,19 +305,23 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
         RegionScanner s = rsh.s;
         LOG.info("Scanner " + this.scannerName + " lease expired on region "
           + s.getRegionInfo().getRegionNameAsString());
+        Region region = null;
         try {
-          Region region = regionServer.getRegion(s.getRegionInfo().getRegionName());
+          region = regionServer.getRegion(s.getRegionInfo().getRegionName());
           if (region != null && region.getCoprocessorHost() != null) {
             region.getCoprocessorHost().preScannerClose(s);
           }
-
-          s.close();
-          if (region != null && region.getCoprocessorHost() != null) {
-            region.getCoprocessorHost().postScannerClose(s);
-          }
         } catch (IOException e) {
-          LOG.error("Closing scanner for "
-            + s.getRegionInfo().getRegionNameAsString(), e);
+          LOG.error("Closing scanner for " + s.getRegionInfo().getRegionNameAsString(), e);
+        } finally {
+          try {
+            s.close();
+            if (region != null && region.getCoprocessorHost() != null) {
+              region.getCoprocessorHost().postScannerClose(s);
+            }
+          } catch (IOException e) {
+            LOG.error("Closing scanner for " + s.getRegionInfo().getRegionNameAsString(),
e);
+          }
         }
       } else {
         LOG.warn("Scanner " + this.scannerName + " lease expired, but no related" +


Mime
View raw message