From 9e355719653c5e7b48b601090634882e4f29a743 Mon Sep 17 00:00:00 2001 From: Kihwal Lee Date: Fri, 19 Sep 2014 17:07:06 -0500 Subject: [PATCH] HDFS-7046. HA NN can NPE upon transition to active. Contributed by Kihwal Lee. --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 ++ .../apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 9d4d8edf129..8c45d699c08 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -782,6 +782,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 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 2b033628d04..4dc278667d1 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 @@ -1156,8 +1156,9 @@ void startActiveServices() throws IOException { cacheManager.startMonitorThread(); blockManager.getDatanodeManager().setShouldSendCachingCommands(true); } finally { - writeUnlock(); startingActiveService = false; + checkSafeMode(); + writeUnlock(); } } @@ -5570,6 +5571,9 @@ private void checkMode() { // 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()) {