HBASE-537 Wait for hdfs to exit safe mode

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@639858 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jim Kellerman 2008-03-21 21:31:23 +00:00
parent a9d8d51663
commit e7b705a808
2 changed files with 19 additions and 2 deletions

View File

@ -49,7 +49,8 @@ Hbase Change Log
HBASE-528 table 'does not exist' when it does
HBASE-531 Merge tool won't merge two overlapping regions (port HBASE-483 to
trunk)
HBASE-537 Wait for hdfs to exit safe mode
IMPROVEMENTS
HBASE-415 Rewrite leases to use DelayedBlockingQueue instead of polling
HBASE-35 Make BatchUpdate public in the API

View File

@ -36,6 +36,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.dfs.DistributedFileSystem;
import org.apache.hadoop.dfs.FSConstants;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.io.Cell;
@ -171,10 +173,25 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
throws IOException {
this.conf = conf;
this.rootdir = rd;
this.threadWakeFrequency = conf.getInt(THREAD_WAKE_FREQUENCY, 10 * 1000);
// The filesystem hbase wants to use is probably not what is set into
// fs.default.name; its value is probably the default.
this.conf.set("fs.default.name", this.rootdir.toString());
this.fs = FileSystem.get(conf);
if (this.fs instanceof DistributedFileSystem) {
// Make sure dfs is not in safe mode
String message = "Waiting for dfs to exit safe mode...";
while (((DistributedFileSystem) fs).setSafeMode(
FSConstants.SafeModeAction.SAFEMODE_GET)) {
System.out.println(message);
LOG.info(message);
try {
Thread.sleep(this.threadWakeFrequency);
} catch (InterruptedException e) {
//continue
}
}
}
this.conf.set(HConstants.HBASE_DIR, this.rootdir.toString());
this.rand = new Random();
Path rootRegionDir =
@ -215,7 +232,6 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
throw e;
}
this.threadWakeFrequency = conf.getInt(THREAD_WAKE_FREQUENCY, 10 * 1000);
this.numRetries = conf.getInt("hbase.client.retries.number", 2);
this.maxRegionOpenTime =
conf.getLong("hbase.hbasemaster.maxregionopen", 60 * 1000);