HBASE-3914 ROOT region appeared in two regionserver's onlineRegions at the same time

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1127158 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-05-24 17:25:42 +00:00
parent b488975ddd
commit 06b8461cc5
2 changed files with 28 additions and 2 deletions

View File

@ -285,6 +285,8 @@ Release 0.90.4 - Unreleased
HBASE-3908 TableSplit not implementing "hashCode" problem (Daniel Iancu) HBASE-3908 TableSplit not implementing "hashCode" problem (Daniel Iancu)
HBASE-3915 Binary row keys in hbck and other miscellaneous binary key HBASE-3915 Binary row keys in hbck and other miscellaneous binary key
display issues display issues
HBASE-3914 ROOT region appeared in two regionserver's onlineRegions at
the same time (Jieshan Bean)
IMPROVEMENT IMPROVEMENT
HBASE-3882 hbase-config.sh needs to be updated so it can auto-detects the HBASE-3882 hbase-config.sh needs to be updated so it can auto-detects the

View File

@ -73,6 +73,26 @@ public class ServerShutdownHandler extends EventHandler {
} }
} }
/**
* Before assign the ROOT region, ensure it haven't
* been assigned by other place
* <p>
* Under some scenarios, the ROOT region can be opened twice, so it seemed online
* in two regionserver at the same time.
* If the ROOT region has been assigned, so the operation can be canceled.
* @throws InterruptedException
* @throws IOException
* @throws KeeperException
*/
private void verifyAndAssignRoot()
throws InterruptedException, IOException, KeeperException {
long timeout = this.server.getConfiguration().
getLong("hbase.catalog.verification.timeout", 1000);
if (!this.server.getCatalogTracker().verifyRootRegionLocation(timeout)) {
this.services.getAssignmentManager().assignRoot();
}
}
/** /**
* @return True if the server we are processing was carrying <code>-ROOT-</code> * @return True if the server we are processing was carrying <code>-ROOT-</code>
*/ */
@ -104,10 +124,14 @@ public class ServerShutdownHandler extends EventHandler {
// Assign root and meta if we were carrying them. // Assign root and meta if we were carrying them.
if (isCarryingRoot()) { // -ROOT- if (isCarryingRoot()) { // -ROOT-
try { try {
this.services.getAssignmentManager().assignRoot(); verifyAndAssignRoot();
} catch (KeeperException e) { } catch (KeeperException e) {
this.server.abort("In server shutdown processing, assigning root", e); this.server.abort("In server shutdown processing, assigning root", e);
throw new IOException("Aborting", e); throw new IOException("Aborting", e);
} catch (InterruptedException e1) {
LOG.warn("Interrupted while verifying root region's location", e1);
Thread.currentThread().interrupt();
throw new IOException(e1);
} }
} }