Repository: hbase
Updated Branches:
  refs/heads/branch-1 8252fe4fb -> 69d3e332f


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

Signed-off-by: tedyu <yuzhih...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/69d3e332
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/69d3e332
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/69d3e332

Branch: refs/heads/branch-1
Commit: 69d3e332f1e0cf1ac581977483f2c865586f8d2d
Parents: 8252fe4
Author: Xiang Li <wate...@gmail.com>
Authored: Sat Jun 3 00:45:41 2017 +0800
Committer: tedyu <yuzhih...@gmail.com>
Committed: Tue Jun 6 05:44:29 2017 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/master/MasterFileSystem.java   | 41 +++++++++++++-------
 1 file changed, 27 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/69d3e332/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
index 332a726..c1bd930 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
@@ -469,16 +469,23 @@ public class MasterFileSystem {
         } else {
           fs.mkdirs(rd);
         }
-        // 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
-        // it is nonzero. With security, the check for datanode count doesn't 
work --
-        // it is a privileged op. So instead we adopt the strategy of the 
jobtracker
-        // and simply retry file creation during bootstrap indefinitely. As 
soon as
-        // there is one datanode it will succeed. Permission problems should 
have
-        // already been caught by mkdirs above.
-        FSUtils.setVersion(fs, rd, c.getInt(HConstants.THREAD_WAKE_FREQUENCY,
-          10 * 1000), c.getInt(HConstants.VERSION_FILE_WRITE_ATTEMPTS,
-            HConstants.DEFAULT_VERSION_FILE_WRITE_ATTEMPTS));
+
+        // 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.
+          // 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 a privileged op. So instead we adopt the strategy of the 
jobtracker
+          // and simply retry file creation during bootstrap indefinitely. As 
soon as
+          // there is one datanode it will succeed. Permission problems should 
have
+          // already been caught by mkdirs above.
+          FSUtils.setVersion(fs, rd,
+            c.getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000),
+            c.getInt(HConstants.VERSION_FILE_WRITE_ATTEMPTS, 
HConstants.DEFAULT_VERSION_FILE_WRITE_ATTEMPTS));
+        }
       } else {
         if (!fs.isDirectory(rd)) {
           throw new IllegalArgumentException(rd.toString() + " is not a 
directory");
@@ -493,10 +500,16 @@ public class MasterFileSystem {
               + "and restarting the master");
           fs.setPermission(rd, dirPerms);
         }
-        // as above
-        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));
+
+        // HBASE-17437 updates createInitialFileSystemLayout() to re-use 
checkRootDir()
+        // to check hbase.wal.dir after checking hbase.rootdir.
+        // 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) {
       LOG.fatal("Please fix invalid configuration for " + dirConfKey, de);

Reply via email to