HBASE-18150: Do not call FSUtils.setVersion() and FSUtils.checkVersion() when using checkRootDir() to check hbase.wal.dir

Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
Xiang Li 2017-06-03 00:45:41 +08:00 committed by tedyu
parent 8252fe4fbb
commit 69d3e332f1
1 changed files with 27 additions and 14 deletions

View File

@ -469,6 +469,12 @@ public class MasterFileSystem {
} else { } else {
fs.mkdirs(rd); fs.mkdirs(rd);
} }
// HBASE-17437 updates createInitialFileSystemLayout() to re-use checkRootDir()
// to check hbase.wal.dir after checking hbase.rootdir.
// But FSUtils.setVersion() is supposed to be called only when checking hbase.rootdir,
// while it is supposed to be bypassed when checking hbase.wal.dir.
if (dirConfKey.equals(HConstants.HBASE_DIR)) {
// DFS leaves safe mode with 0 DNs when there are 0 blocks. // DFS leaves safe mode with 0 DNs when there are 0 blocks.
// We used to handle this by checking the current DN count and waiting until // We used to handle this by checking the current DN count and waiting until
// it is nonzero. With security, the check for datanode count doesn't work -- // it is nonzero. With security, the check for datanode count doesn't work --
@ -476,9 +482,10 @@ public class MasterFileSystem {
// and simply retry file creation during bootstrap indefinitely. As soon as // and simply retry file creation during bootstrap indefinitely. As soon as
// there is one datanode it will succeed. Permission problems should have // there is one datanode it will succeed. Permission problems should have
// already been caught by mkdirs above. // already been caught by mkdirs above.
FSUtils.setVersion(fs, rd, c.getInt(HConstants.THREAD_WAKE_FREQUENCY, FSUtils.setVersion(fs, rd,
10 * 1000), c.getInt(HConstants.VERSION_FILE_WRITE_ATTEMPTS, c.getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000),
HConstants.DEFAULT_VERSION_FILE_WRITE_ATTEMPTS)); c.getInt(HConstants.VERSION_FILE_WRITE_ATTEMPTS, HConstants.DEFAULT_VERSION_FILE_WRITE_ATTEMPTS));
}
} else { } else {
if (!fs.isDirectory(rd)) { if (!fs.isDirectory(rd)) {
throw new IllegalArgumentException(rd.toString() + " is not a directory"); throw new IllegalArgumentException(rd.toString() + " is not a directory");
@ -493,10 +500,16 @@ public class MasterFileSystem {
+ "and restarting the master"); + "and restarting the master");
fs.setPermission(rd, dirPerms); fs.setPermission(rd, dirPerms);
} }
// as above
FSUtils.checkVersion(fs, rd, true, c.getInt(HConstants.THREAD_WAKE_FREQUENCY, // HBASE-17437 updates createInitialFileSystemLayout() to re-use checkRootDir()
10 * 1000), c.getInt(HConstants.VERSION_FILE_WRITE_ATTEMPTS, // to check hbase.wal.dir after checking hbase.rootdir.
HConstants.DEFAULT_VERSION_FILE_WRITE_ATTEMPTS)); // But FSUtils.checkVersion() is supposed to be called only when checking hbase.rootdir,
// while it is supposed to be bypassed when checking hbase.wal.dir.
if (dirConfKey.equals(HConstants.HBASE_DIR)) {
FSUtils.checkVersion(fs, rd, true,
c.getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000),
c.getInt(HConstants.VERSION_FILE_WRITE_ATTEMPTS, HConstants.DEFAULT_VERSION_FILE_WRITE_ATTEMPTS));
}
} }
} catch (DeserializationException de) { } catch (DeserializationException de) {
LOG.fatal("Please fix invalid configuration for " + dirConfKey, de); LOG.fatal("Please fix invalid configuration for " + dirConfKey, de);