HDFS-2523. Small NN fixes to include HAServiceProtocol and prevent NPE on shutdown. Contributed by Todd Lipcon.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1195753 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Todd Lipcon 2011-11-01 01:29:59 +00:00
parent b4992f671d
commit 3ab295994a
3 changed files with 9 additions and 1 deletions

View File

@ -19,3 +19,5 @@ HDFS-2231. Configuration changes for HA namenode. (suresh)
HDFS-2418. Change ConfiguredFailoverProxyProvider to take advantage of HDFS-2231. (atm) HDFS-2418. Change ConfiguredFailoverProxyProvider to take advantage of HDFS-2231. (atm)
HDFS-2393. Mark appropriate methods of ClientProtocol with the idempotent annotation. (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)

View File

@ -572,7 +572,9 @@ public void stop() {
stopRequested = true; stopRequested = true;
} }
try { try {
state.exitState(haContext); if (state != null) {
state.exitState(haContext);
}
} catch (ServiceFailedException e) { } catch (ServiceFailedException e) {
LOG.warn("Encountered exception while exiting state ", e); LOG.warn("Encountered exception while exiting state ", e);
} }

View File

@ -39,6 +39,7 @@
import org.apache.hadoop.fs.permission.PermissionStatus; import org.apache.hadoop.fs.permission.PermissionStatus;
import static org.apache.hadoop.hdfs.DFSConfigKeys.*; import static org.apache.hadoop.hdfs.DFSConfigKeys.*;
import org.apache.hadoop.ha.HAServiceProtocol;
import org.apache.hadoop.ha.HealthCheckFailedException; import org.apache.hadoop.ha.HealthCheckFailedException;
import org.apache.hadoop.ha.ServiceFailedException; import org.apache.hadoop.ha.ServiceFailedException;
import org.apache.hadoop.hdfs.HDFSPolicyProvider; 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(RefreshAuthorizationPolicyProtocol.class, this);
this.server.addProtocol(RefreshUserMappingsProtocol.class, this); this.server.addProtocol(RefreshUserMappingsProtocol.class, this);
this.server.addProtocol(GetUserMappingsProtocol.class, this); this.server.addProtocol(GetUserMappingsProtocol.class, this);
this.server.addProtocol(HAServiceProtocol.class, this);
// set service-level authorization security policy // set service-level authorization security policy
@ -225,6 +227,8 @@ public long getProtocolVersion(String protocol,
return RefreshUserMappingsProtocol.versionID; return RefreshUserMappingsProtocol.versionID;
} else if (protocol.equals(GetUserMappingsProtocol.class.getName())){ } else if (protocol.equals(GetUserMappingsProtocol.class.getName())){
return GetUserMappingsProtocol.versionID; return GetUserMappingsProtocol.versionID;
} else if (protocol.equals(HAServiceProtocol.class.getName())) {
return HAServiceProtocol.versionID;
} else { } else {
throw new IOException("Unknown protocol to name node: " + protocol); throw new IOException("Unknown protocol to name node: " + protocol);
} }