HBASE-1960 Master should wait for DFS to come up when creating hbase.version

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@892072 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Kyle Purtell 2009-12-18 01:33:25 +00:00
parent 54ffc46537
commit 21bd10825a
2 changed files with 14 additions and 3 deletions

View File

@ -131,6 +131,8 @@ Release 0.21.0 - Unreleased
HBASE-2048 Small inconsistency in the "Example API Usage" HBASE-2048 Small inconsistency in the "Example API Usage"
(Benoit Sigoure via JD) (Benoit Sigoure via JD)
HBASE-2044 HBASE-1822 removed not-deprecated APIs HBASE-2044 HBASE-1822 removed not-deprecated APIs
HBASE-1960 Master should wait for DFS to come up when creating
hbase.version
IMPROVEMENTS IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable HBASE-1760 Cleanup TODOs in HTable

View File

@ -20,7 +20,6 @@
package org.apache.hadoop.hbase.util; package org.apache.hadoop.hbase.util;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
@ -249,10 +248,20 @@ public class FSUtils {
FileSystem fs = FileSystem.get(conf); FileSystem fs = FileSystem.get(conf);
if (!(fs instanceof DistributedFileSystem)) return; if (!(fs instanceof DistributedFileSystem)) return;
DistributedFileSystem dfs = (DistributedFileSystem)fs; DistributedFileSystem dfs = (DistributedFileSystem)fs;
// Are there any data nodes up yet?
// Currently the safe mode check falls through if the namenode is up but no
// datanodes have reported in yet.
while (dfs.getDataNodeStats().length == 0) {
LOG.info("Waiting for dfs to come up...");
try {
Thread.sleep(wait);
} catch (InterruptedException e) {
//continue
}
}
// Make sure dfs is not in safe mode // Make sure dfs is not in safe mode
String message = "Waiting for dfs to exit safe mode...";
while (dfs.setSafeMode(FSConstants.SafeModeAction.SAFEMODE_GET)) { while (dfs.setSafeMode(FSConstants.SafeModeAction.SAFEMODE_GET)) {
LOG.info(message); LOG.info("Waiting for dfs to exit safe mode...");
try { try {
Thread.sleep(wait); Thread.sleep(wait);
} catch (InterruptedException e) { } catch (InterruptedException e) {