Repository: hadoop
Updated Branches:
  refs/heads/branch-2 ee508c1b3 -> b55aa50ec


HDFS-7046. HA NN can NPE upon transition to active. Contributed by
Kihwal Lee.
(cherry picked from commit 9e355719653c5e7b48b601090634882e4f29a743)


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

Branch: refs/heads/branch-2
Commit: b55aa50ec6f91e9dce4086ebd5a3c6e6c424eb91
Parents: ee508c1
Author: Kihwal Lee <kih...@apache.org>
Authored: Fri Sep 19 17:08:30 2014 -0500
Committer: Kihwal Lee <kih...@apache.org>
Committed: Fri Sep 19 17:08:30 2014 -0500

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt                    | 2 ++
 .../org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java   | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b55aa50e/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt 
b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index f660eaa..b288c50 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -445,6 +445,8 @@ Release 2.6.0 - UNRELEASED
     HDFS-7096. Fix TestRpcProgramNfs3 to use DFS_ENCRYPTION_KEY_PROVIDER_URI
     (clamb via cmccabe)
 
+    HDFS-7046. HA NN can NPE upon transition to active. (kihwal)
+
     BREAKDOWN OF HDFS-6134 AND HADOOP-10150 SUBTASKS AND RELATED JIRAS
   
       HDFS-6387. HDFS CLI admin tool for creating & deleting an

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b55aa50e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
 
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
index c6961a6..baa240e 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
@@ -1155,8 +1155,9 @@ public class FSNamesystem implements Namesystem, 
FSClusterStats,
       cacheManager.startMonitorThread();
       blockManager.getDatanodeManager().setShouldSendCachingCommands(true);
     } finally {
-      writeUnlock();
       startingActiveService = false;
+      checkSafeMode();
+      writeUnlock();
     }
   }
 
@@ -5530,6 +5531,9 @@ public class FSNamesystem implements Namesystem, 
FSClusterStats,
       // Have to have write-lock since leaving safemode initializes
       // repl queues, which requires write lock
       assert hasWriteLock();
+      if (inTransitionToActive()) {
+        return;
+      }
       // if smmthread is already running, the block threshold must have been 
       // reached before, there is no need to enter the safe mode again
       if (smmthread == null && needEnter()) {

Reply via email to