From 928b81a5339a3d91e77b268d825973a0d9efc1ab Mon Sep 17 00:00:00 2001 From: Takanobu Asanuma Date: Tue, 12 May 2020 23:04:03 +0900 Subject: [PATCH] HDFS-15350. Set dfs.client.failover.random.order to true as default. (#2008) --- .../org/apache/hadoop/hdfs/client/HdfsClientConfigKeys.java | 2 +- .../hadoop-hdfs/src/main/resources/hdfs-default.xml | 2 +- .../hdfs/server/namenode/ha/TestObserverReadProxyProvider.java | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/HdfsClientConfigKeys.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/HdfsClientConfigKeys.java index efc2766e9e..ab3f6f2721 100755 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/HdfsClientConfigKeys.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/HdfsClientConfigKeys.java @@ -343,7 +343,7 @@ interface Failover { PREFIX + "connection.retries.on.timeouts"; int CONNECTION_RETRIES_ON_SOCKET_TIMEOUTS_DEFAULT = 0; String RANDOM_ORDER = PREFIX + "random.order"; - boolean RANDOM_ORDER_DEFAULT = false; + boolean RANDOM_ORDER_DEFAULT = true; String RESOLVE_ADDRESS_NEEDED_KEY = PREFIX + "resolve-needed"; boolean RESOLVE_ADDRESS_NEEDED_DEFAULT = false; String RESOLVE_SERVICE_KEY = PREFIX + "resolver.impl"; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml index 0dc279996b..76b4a499c9 100755 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml @@ -4070,7 +4070,7 @@ dfs.client.failover.random.order - false + true Determines if the failover proxies are picked in random order instead of the configured order. Random order may be enabled for better load balancing diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestObserverReadProxyProvider.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestObserverReadProxyProvider.java index e23bb24ef5..630789b9ee 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestObserverReadProxyProvider.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestObserverReadProxyProvider.java @@ -78,6 +78,7 @@ public void setup() throws Exception { // transition observer back and forth conf.setTimeDuration( OBSERVER_PROBE_RETRY_PERIOD_KEY, 0, TimeUnit.MILLISECONDS); + conf.setBoolean(HdfsClientConfigKeys.Failover.RANDOM_ORDER, false); } private void setupProxyProvider(int namenodeCount) throws Exception {