From f10335b08d51ec3edff16ab2e2fbea3dccb5e8bb Mon Sep 17 00:00:00 2001 From: Tsuyoshi Ozawa Date: Wed, 18 Feb 2015 17:32:50 +0900 Subject: [PATCH] HADOOP-11599. Client#getTimeout should use IPC_CLIENT_PING_DEFAULT when IPC_CLIENT_PING_KEY is not configured. Contributed by zhihai xu. (cherry picked from commit 3f56a4cb0c57583e285e85a4d0c1584c4de9f1f1) --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/ipc/Client.java | 3 ++- .../src/test/java/org/apache/hadoop/ipc/TestIPC.java | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 8e45ba6eff5..6f03cc7b4d1 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -553,6 +553,9 @@ Release 2.7.0 - UNRELEASED HADOOP-11295. RPC Server Reader thread can't shutdown if RPCCallQueue is full. (Ming Ma via kihwal) + HADOOP-11599. Client#getTimeout should use IPC_CLIENT_PING_DEFAULT when + IPC_CLIENT_PING_KEY is not configured. (zhihai xu via ozawa) + Release 2.6.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java index d7ff390d448..8207081697e 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java @@ -236,7 +236,8 @@ public class Client { * @return the timeout period in milliseconds. -1 if no timeout value is set */ final public static int getTimeout(Configuration conf) { - if (!conf.getBoolean(CommonConfigurationKeys.IPC_CLIENT_PING_KEY, true)) { + if (!conf.getBoolean(CommonConfigurationKeys.IPC_CLIENT_PING_KEY, + CommonConfigurationKeys.IPC_CLIENT_PING_DEFAULT)) { return getPingInterval(conf); } return -1; diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java index 04a74120c86..eb19f48e632 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java @@ -1235,6 +1235,12 @@ public class TestIPC { } } + @Test + public void testClientGetTimeout() throws IOException { + Configuration config = new Configuration(); + assertEquals(Client.getTimeout(config), -1); + } + private void assertRetriesOnSocketTimeouts(Configuration conf, int maxTimeoutRetries) throws IOException { SocketFactory mockFactory = Mockito.mock(SocketFactory.class);