From 97fbf7da76a06a39a0503476290abd459bd6e79f Mon Sep 17 00:00:00 2001 From: Jim Kellerman Date: Tue, 4 Nov 2008 00:58:28 +0000 Subject: [PATCH] HBASE-964 Startup stuck "waiting for root region" git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@711149 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 ++- .../hbase/regionserver/HRegionServer.java | 24 +++++++++---------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index c1412b56f6a..3e3825d9256 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -60,7 +60,8 @@ Release 0.19.0 - Unreleased HBASE-976 HADOOP 0.19.0 RC0 is broke; replace with HEAD of branch-0.19 HBASE-977 Arcane HStoreKey comparator bug HBASE-979 REST web app is not started automatically - + HBASE-964 Startup stuck "waiting for root region" + IMPROVEMENTS HBASE-901 Add a limit to key length, check key and value length on client side HBASE-890 Alter table operation and also related changes in REST interface diff --git a/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 9a524234f8b..9f2aad8e829 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -123,7 +123,6 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable { protected final HBaseConfiguration conf; private final ServerConnection connection; - private final AtomicBoolean haveRootRegion = new AtomicBoolean(false); private FileSystem fs; private Path rootDir; private final Random rand = new Random(); @@ -304,8 +303,20 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable { boolean quiesceRequested = false; // A sleeper that sleeps for msgInterval. Sleeper sleeper = new Sleeper(this.msgInterval, this.stopRequested); + boolean haveRootRegion = false; try { init(reportForDuty(sleeper)); + // Try to get the root region location from the master. + if (!haveRootRegion) { + HServerAddress rootServer = hbaseMaster.getRootRegionLocation(); + if (rootServer != null) { + // By setting the root region location, we bypass the wait imposed on + // HTable for all regions being assigned. + this.connection.setRootRegionLocation( + new HRegionLocation(HRegionInfo.ROOT_REGIONINFO, rootServer)); + haveRootRegion = true; + } + } long lastMsg = 0; // Now ask master what it wants us to do and tell it what we have done for (int tries = 0; !stopRequested.get() && isHealthy();) { @@ -693,17 +704,6 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable { * the end of the main HRegionServer run loop. */ private void housekeeping() { - // Try to get the root region location from the master. - if (!haveRootRegion.get()) { - HServerAddress rootServer = hbaseMaster.getRootRegionLocation(); - if (rootServer != null) { - // By setting the root region location, we bypass the wait imposed on - // HTable for all regions being assigned. - this.connection.setRootRegionLocation( - new HRegionLocation(HRegionInfo.ROOT_REGIONINFO, rootServer)); - haveRootRegion.set(true); - } - } // If the todo list has > 0 messages, iterate looking for open region // messages. Send the master a message that we're working on its // processing so it doesn't assign the region elsewhere.