From 4f6397b4ac60cfe300c8dd00437eb46b6d0aac56 Mon Sep 17 00:00:00 2001 From: Andrew Wang Date: Thu, 20 Mar 2014 17:43:16 +0000 Subject: [PATCH] HDFS-6089. Standby NN while transitioning to active throws a connection refused error when the prior active NN process is suspended. Contributed by Jing Zhao. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1579692 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 4 ++++ .../main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java | 2 ++ .../hadoop/hdfs/server/namenode/ha/EditLogTailer.java | 9 ++++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 11f21b0957..56ba7df649 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -723,6 +723,10 @@ Release 2.4.0 - UNRELEASED HDFS-5981. PBImageXmlWriter generates malformed XML. (Haohui Mai via cnauroth) + HDFS-6089. Standby NN while transitioning to active throws a connection + refused error when the prior active NN process is suspended. + (Jing Zhao via Andrew Wang) + BREAKDOWN OF HDFS-4685 SUBTASKS AND RELATED JIRAS HDFS-5596. Implement RPC stubs. (Haohui Mai via cnauroth) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java index 49b4516d5f..5a14f984ff 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java @@ -522,6 +522,8 @@ public class DFSConfigKeys extends CommonConfigurationKeys { public static final int DFS_HA_LOGROLL_PERIOD_DEFAULT = 2 * 60; // 2m public static final String DFS_HA_TAILEDITS_PERIOD_KEY = "dfs.ha.tail-edits.period"; public static final int DFS_HA_TAILEDITS_PERIOD_DEFAULT = 60; // 1m + public static final String DFS_HA_LOGROLL_RPC_TIMEOUT_KEY = "dfs.ha.log-roll.rpc.timeout"; + public static final int DFS_HA_LOGROLL_RPC_TIMEOUT_DEFAULT = 20000; // 20s public static final String DFS_HA_FENCE_METHODS_KEY = "dfs.ha.fencing.methods"; public static final String DFS_HA_AUTO_FAILOVER_ENABLED_KEY = "dfs.ha.automatic-failover.enabled"; public static final boolean DFS_HA_AUTO_FAILOVER_ENABLED_DEFAULT = false; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/EditLogTailer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/EditLogTailer.java index 332cc61da6..4e8c46d8b2 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/EditLogTailer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/EditLogTailer.java @@ -135,9 +135,12 @@ private InetSocketAddress getActiveNodeAddress() { private NamenodeProtocol getActiveNodeProxy() throws IOException { if (cachedActiveProxy == null) { - NamenodeProtocolPB proxy = - RPC.waitForProxy(NamenodeProtocolPB.class, - RPC.getProtocolVersion(NamenodeProtocolPB.class), activeAddr, conf); + int rpcTimeout = conf.getInt( + DFSConfigKeys.DFS_HA_LOGROLL_RPC_TIMEOUT_KEY, + DFSConfigKeys.DFS_HA_LOGROLL_RPC_TIMEOUT_DEFAULT); + NamenodeProtocolPB proxy = RPC.waitForProxy(NamenodeProtocolPB.class, + RPC.getProtocolVersion(NamenodeProtocolPB.class), activeAddr, conf, + rpcTimeout, Long.MAX_VALUE); cachedActiveProxy = new NamenodeProtocolTranslatorPB(proxy); } assert cachedActiveProxy != null;