diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-1623.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-1623.txt index be8708c552..37e6e4acac 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-1623.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-1623.txt @@ -19,3 +19,5 @@ HDFS-2231. Configuration changes for HA namenode. (suresh) HDFS-2418. Change ConfiguredFailoverProxyProvider to take advantage of HDFS-2231. (atm) HDFS-2393. Mark appropriate methods of ClientProtocol with the idempotent annotation. (atm) + +HDFS-2523. Small NN fixes to include HAServiceProtocol and prevent NPE on shutdown. (todd) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java index 456f8d6b75..4eb080105f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java @@ -572,7 +572,9 @@ public void stop() { stopRequested = true; } try { - state.exitState(haContext); + if (state != null) { + state.exitState(haContext); + } } catch (ServiceFailedException e) { LOG.warn("Encountered exception while exiting state ", e); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java index d79614f7d4..6546b8fe06 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java @@ -39,6 +39,7 @@ import org.apache.hadoop.fs.permission.PermissionStatus; import static org.apache.hadoop.hdfs.DFSConfigKeys.*; +import org.apache.hadoop.ha.HAServiceProtocol; import org.apache.hadoop.ha.HealthCheckFailedException; import org.apache.hadoop.ha.ServiceFailedException; import org.apache.hadoop.hdfs.HDFSPolicyProvider; @@ -156,6 +157,7 @@ public NameNodeRpcServer(Configuration conf, NameNode nn) this.server.addProtocol(RefreshAuthorizationPolicyProtocol.class, this); this.server.addProtocol(RefreshUserMappingsProtocol.class, this); this.server.addProtocol(GetUserMappingsProtocol.class, this); + this.server.addProtocol(HAServiceProtocol.class, this); // set service-level authorization security policy @@ -225,6 +227,8 @@ public long getProtocolVersion(String protocol, return RefreshUserMappingsProtocol.versionID; } else if (protocol.equals(GetUserMappingsProtocol.class.getName())){ return GetUserMappingsProtocol.versionID; + } else if (protocol.equals(HAServiceProtocol.class.getName())) { + return HAServiceProtocol.versionID; } else { throw new IOException("Unknown protocol to name node: " + protocol); }