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 {
|
try {
|
||||||
for (int i = 0; i < htableDescriptor.getFamilies().size(); i++) {
|
for (int i = 0; i < htableDescriptor.getFamilies().size(); i++) {
|
||||||
Future<HStore> future = completionService.take();
|
Future<HStore> future = completionService.take();
|
||||||
@ -712,12 +713,24 @@ public class HRegion implements HeapSize { // , Writable{
|
|||||||
maxMemstoreTS = maxStoreMemstoreTS;
|
maxMemstoreTS = maxStoreMemstoreTS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
allStoresOpened = true;
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
throw new IOException(e.getCause());
|
throw new IOException(e.getCause());
|
||||||
} finally {
|
} finally {
|
||||||
storeOpenerThreadPool.shutdownNow();
|
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);
|
mvcc.initialize(maxMemstoreTS + 1);
|
||||||
|
@ -524,11 +524,13 @@ public class HStore implements Store {
|
|||||||
}
|
}
|
||||||
if (ioe != null) {
|
if (ioe != null) {
|
||||||
// close StoreFile readers
|
// close StoreFile readers
|
||||||
try {
|
|
||||||
for (StoreFile file : results) {
|
for (StoreFile file : results) {
|
||||||
|
try {
|
||||||
if (file != null) file.closeReader(true);
|
if (file != null) file.closeReader(true);
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOG.warn(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) { }
|
|
||||||
throw ioe;
|
throw ioe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user