HBASE-1960 Master should wait for DFS to come up when creating hbase.version; catch another corner case

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1080371 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Kyle Purtell 2011-03-10 22:12:32 +00:00
parent a82042205a
commit 79eb3c26a2
2 changed files with 19 additions and 2 deletions

View File

@ -241,7 +241,9 @@ public class MasterFileSystem {
FSUtils.setVersion(fs, rd, c.getInt(HConstants.THREAD_WAKE_FREQUENCY,
10 * 1000));
} else {
FSUtils.checkVersion(fs, rd, true);
// as above
FSUtils.checkVersion(fs, rd, true, c.getInt(HConstants.THREAD_WAKE_FREQUENCY,
10 * 1000));
}
// Make sure the root region directory exists!
if (!FSUtils.rootRegionExists(fs, rd)) {

View File

@ -175,13 +175,28 @@ public class FSUtils {
*/
public static void checkVersion(FileSystem fs, Path rootdir,
boolean message) throws IOException {
checkVersion(fs, rootdir, message, 0);
}
/**
* Verifies current version of file system
*
* @param fs file system
* @param rootdir root directory of HBase installation
* @param message if true, issues a message on System.out
* @param wait wait interval for retry if > 0
*
* @throws IOException e
*/
public static void checkVersion(FileSystem fs, Path rootdir,
boolean message, int wait) throws IOException {
String version = getVersion(fs, rootdir);
if (version == null) {
if (!rootRegionExists(fs, rootdir)) {
// rootDir is empty (no version file and no root region)
// just create new version file (HBASE-1195)
FSUtils.setVersion(fs, rootdir);
FSUtils.setVersion(fs, rootdir, wait);
return;
}
} else if (version.compareTo(HConstants.FILE_SYSTEM_VERSION) == 0)