Index: src/java/org/apache/hadoop/hbase/master/RegionServerOperationQueue.java =================================================================== --- src/java/org/apache/hadoop/hbase/master/RegionServerOperationQueue.java (revision 941143) +++ src/java/org/apache/hadoop/hbase/master/RegionServerOperationQueue.java (working copy) @@ -14,6 +14,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HMsg; import org.apache.hadoop.hbase.HServerInfo; +import org.apache.hadoop.hbase.HServerAddress; import org.apache.hadoop.hbase.RemoteExceptionHandler; import org.apache.hadoop.hbase.util.Sleeper; import org.apache.hadoop.ipc.RemoteException; @@ -90,17 +91,17 @@ /** * Try to get an operation off of the queue and process it. - * @param skipDelayedToDos If true, do not do delayed todos first but instead - * move straight to the current todos list. This is set when we want to be - * sure that recently queued events are processed first such as the onlining - * of root region (Root region needs to be online before we can do meta - * onlining; meta onlining needs to be done before we can do... and so on). + * @param rootRegionLocation Location of the root region. * @return {@link ProcessingResultCode#PROCESSED}, * {@link ProcessingResultCode#REQUEUED}, * {@link ProcessingResultCode#REQUEUED_BUT_PROBLEM} */ - public synchronized ProcessingResultCode process(final boolean skipDelayedToDos) { - RegionServerOperation op = delayedToDoQueue.poll(); + public synchronized ProcessingResultCode process(final HServerAddress rootRegionLocation) { + // Only process the delayed queue if root region is online. If offline, + // the operation to put it online is probably in the toDoQueue. Process + // it first. + RegionServerOperation op = null; + if (rootRegionLocation != null) op = delayedToDoQueue.poll(); // if there aren't any todo items in the queue, sleep for a bit. if (op == null) { try { @@ -233,4 +234,4 @@ } return true; } -} \ No newline at end of file +} Index: src/java/org/apache/hadoop/hbase/master/HMaster.java =================================================================== --- src/java/org/apache/hadoop/hbase/master/HMaster.java (revision 941143) +++ src/java/org/apache/hadoop/hbase/master/HMaster.java (working copy) @@ -428,8 +428,8 @@ break; } } - boolean doDelayQueue = this.regionManager.getRootRegionLocation() != null; - switch (this.regionServerOperationQueue.process(doDelayQueue)) { + switch (this.regionServerOperationQueue. + process(this.regionManager.getRootRegionLocation())) { case FAILED: break FINISHED; case REQUEUED_BUT_PROBLEM: @@ -1242,4 +1242,4 @@ public static void main(String [] args) { doMain(args, HMaster.class); } -} \ No newline at end of file +}