HBASE-8705-RS holding META when restarted in a single node setup may hang infinitely without META assignment (Ram)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1495705 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ramkrishna 2013-06-22 11:38:09 +00:00
parent 8781231132
commit acfe2f9fd2
1 changed files with 21 additions and 0 deletions

View File

@ -135,6 +135,12 @@ public class AssignmentManager extends ZooKeeperListener {
*/ */
private final int maximumAttempts; private final int maximumAttempts;
/**
* The sleep time for which the assignment will wait before retrying in case of META assignment
* failure due to lack of availability of region plan
*/
private final long sleepTimeBeforeRetryingMetaAssignment;
/** Plans for region movement. Key is the encoded version of a region name*/ /** Plans for region movement. Key is the encoded version of a region name*/
// TODO: When do plans get cleaned out? Ever? In server open and in server // TODO: When do plans get cleaned out? Ever? In server open and in server
// shutdown processing -- St.Ack // shutdown processing -- St.Ack
@ -246,6 +252,8 @@ public class AssignmentManager extends ZooKeeperListener {
this.zkTable = new ZKTable(this.watcher); this.zkTable = new ZKTable(this.watcher);
this.maximumAttempts = this.maximumAttempts =
this.server.getConfiguration().getInt("hbase.assignment.maximum.attempts", 10); this.server.getConfiguration().getInt("hbase.assignment.maximum.attempts", 10);
this.sleepTimeBeforeRetryingMetaAssignment = this.server.getConfiguration().getLong(
"hbase.meta.assignment.retry.sleeptime", 1000l);
this.balancer = balancer; this.balancer = balancer;
int maxThreads = conf.getInt("hbase.assignment.threads.max", 30); int maxThreads = conf.getInt("hbase.assignment.threads.max", 30);
this.threadPoolExecutorService = Threads.getBoundedCachedThreadPool( this.threadPoolExecutorService = Threads.getBoundedCachedThreadPool(
@ -1769,6 +1777,19 @@ public class AssignmentManager extends ZooKeeperListener {
if (tomActivated){ if (tomActivated){
this.timeoutMonitor.setAllRegionServersOffline(true); this.timeoutMonitor.setAllRegionServersOffline(true);
} else { } else {
if (region.isMetaRegion()) {
try {
if (i != maximumAttempts) {
Thread.sleep(this.sleepTimeBeforeRetryingMetaAssignment);
continue;
}
// TODO : Ensure HBCK fixes this
LOG.error("Unable to determine a plan to assign META even after repeated attempts. Run HBCK to fix this");
} catch (InterruptedException e) {
LOG.error("Got exception while waiting for META assignment");
Thread.currentThread().interrupt();
}
}
regionStates.updateRegionState(region, RegionState.State.FAILED_OPEN); regionStates.updateRegionState(region, RegionState.State.FAILED_OPEN);
} }
return; return;