hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anoopsamj...@apache.org
Subject svn commit: r1552736 - in /hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver: HRegion.java HStore.java
Date Fri, 20 Dec 2013 16:54:32 GMT
Author: anoopsamjohn
Date: Fri Dec 20 16:54:32 2013
New Revision: 1552736

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

Modified:
    hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
    hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java

Modified: hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1552736&r1=1552735&r2=1552736&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
(original)
+++ hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Fri Dec 20 16:54:32 2013
@@ -692,6 +692,7 @@ public class HRegion implements HeapSize
           }
         });
       }
+      boolean allStoresOpened = false;
       try {
         for (int i = 0; i < htableDescriptor.getFamilies().size(); i++) {
           Future<HStore> future = completionService.take();
@@ -712,12 +713,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.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java?rev=1552736&r1=1552735&r2=1552736&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
(original)
+++ hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
Fri Dec 20 16:54:32 2013
@@ -524,11 +524,13 @@ public class HStore implements Store {
     }
     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