HBASE-10193 - Cleanup HRegion if one of the store fails to open at region initialization (Aditya Kishore)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1552716 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
edb5f7c0ae
commit
28c3e3a61c
|
@ -692,6 +692,7 @@ public class HRegion implements HeapSize { // , Writable{
|
|||
}
|
||||
});
|
||||
}
|
||||
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 { // , Writable{
|
|||
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);
|
||||
|
|
|
@ -524,11 +524,13 @@ public class HStore implements Store {
|
|||
}
|
||||
if (ioe != null) {
|
||||
// close StoreFile readers
|
||||
try {
|
||||
for (StoreFile file : results) {
|
||||
try {
|
||||
if (file != null) file.closeReader(true);
|
||||
} catch (IOException e) {
|
||||
LOG.warn(e.getMessage());
|
||||
}
|
||||
}
|
||||
} catch (IOException e) { }
|
||||
throw ioe;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue