hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject svn commit: r1552718 - in /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver: HRegion.java Store.java
Date Fri, 20 Dec 2013 16:22:39 GMT
Author: ramkrishna
Date: Fri Dec 20 16:22:38 2013
New Revision: 1552718

URL: http://svn.apache.org/r1552718
Log:
HBASE-10193 - Cleanup HRegion if one of the store fails to open at region initialization (Aditya
Kishore


Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1552718&r1=1552717&r2=1552718&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Fri
Dec 20 16:22:38 2013
@@ -602,6 +602,7 @@ public class HRegion implements HeapSize
           }
         });
       }
+      boolean allStoresOpened = false;
       try {
         for (int i = 0; i < htableDescriptor.getFamilies().size(); i++) {
           Future<Store> future = completionService.take();
@@ -621,12 +622,24 @@ public class HRegion implements HeapSize
             maxMemstoreTS = maxStoreMemstoreTS;
           }
         }
+        allStoresOpened = true;
       } catch (InterruptedException e) {
         throw new IOException(e);
       } catch (ExecutionException e) {
         throw new IOException(e.getCause());
       } finally {
         storeOpenerThreadPool.shutdownNow();
+        if (!allStoresOpened) {
+          // something went wrong, close all opened stores
+          LOG.error("Could not initialize all stores for the region=" + this);
+          for (Store store : this.stores.values()) {
+            try {
+              store.close();
+            } catch (IOException e) { 
+              LOG.warn(e.getMessage());
+            }
+          }
+        }
       }
     }
     mvcc.initialize(maxMemstoreTS + 1);

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java?rev=1552718&r1=1552717&r2=1552718&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java Fri
Dec 20 16:22:38 2013
@@ -487,11 +487,13 @@ public class Store extends SchemaConfigu
     }
     if (ioe != null) {
       // close StoreFile readers
-      try {
-        for (StoreFile file : results) {
+      for (StoreFile file : results) {
+        try {
           if (file != null) file.closeReader(true);
+        } catch (IOException e) { 
+          LOG.warn(e.getMessage());
         }
-      } catch (IOException e) { }
+      }
       throw ioe;
     }
 



Mime
View raw message