From 478c4e8d6a64fbc5520717e630e3d60bac380aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B3=E8=83=9C=E5=88=A9?= <48829688+shenshengli@users.noreply.github.com> Date: Tue, 12 Jan 2021 09:06:13 -0500 Subject: [PATCH] HBASE-25449 'dfs.client.read.shortcircuit' should not be set in hbase-default.xml Revert of the revert -- re-applying HBASE-25449 with a change of renaming the test hdfs XML configuration file as it was adversely affecting tests using MiniDFS This reverts commit c218e576fe54df208e277365f1ac24f993f2a4b1. Co-authored-by: Josh Elser Signed-off-by: Peter Somogyi Signed-off-by: Michael Stack Signed-off-by: Duo Zhang --- .../src/main/resources/hbase-default.xml | 4 +- .../hadoop/hbase/TestHBaseConfiguration.java | 17 ++++++++ .../src/test/resources/hdfs-scr-disabled.xml | 42 +++++++++++++++++++ .../src/test/resources/hdfs-scr-enabled.xml | 42 +++++++++++++++++++ 4 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 hbase-common/src/test/resources/hdfs-scr-disabled.xml create mode 100644 hbase-common/src/test/resources/hdfs-scr-enabled.xml diff --git a/hbase-common/src/main/resources/hbase-default.xml b/hbase-common/src/main/resources/hbase-default.xml index db1e3dfecf8..0908ca60ff8 100644 --- a/hbase-common/src/main/resources/hbase-default.xml +++ b/hbase-common/src/main/resources/hbase-default.xml @@ -1440,7 +1440,7 @@ possible configurations would overwhelm and obscure the important. dfs.client.read.shortcircuit - false + If set to true, this configuration parameter enables short-circuit local reads. @@ -1448,7 +1448,7 @@ possible configurations would overwhelm and obscure the important. dfs.domain.socket.path - none + This is a path to a UNIX domain socket that will be used for communication between the DataNode and local HDFS clients, if diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseConfiguration.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseConfiguration.java index 6a0b4283ed0..ffa94ba2d59 100644 --- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseConfiguration.java +++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseConfiguration.java @@ -116,6 +116,23 @@ public class TestHBaseConfiguration { Assert.assertTrue(User.isHBaseSecurityEnabled(conf)); } + @Test + public void testGetConfigOfShortcircuitRead() throws Exception { + Configuration conf = HBaseConfiguration.create(); + Configuration.addDefaultResource("hdfs-scr-disabled.xml"); + assertEquals("hdfs-scr-disabled.xml", + conf.getPropertySources("dfs.client.read.shortcircuit")[0]); + assertEquals("false", conf.get("dfs.client.read.shortcircuit")); + assertNull(conf.get("dfs.domain.socket.path")); + Configuration.addDefaultResource("hdfs-scr-enabled.xml"); + assertEquals("hdfs-scr-enabled.xml", + conf.getPropertySources("dfs.client.read.shortcircuit")[0]); + assertEquals("hdfs-scr-enabled.xml", + conf.getPropertySources("dfs.domain.socket.path")[0]); + assertEquals("true", conf.get("dfs.client.read.shortcircuit")); + assertEquals("/var/lib/hadoop-hdfs/dn_socket", conf.get("dfs.domain.socket.path")); + } + private static class ReflectiveCredentialProviderClient { public static final String HADOOP_CRED_PROVIDER_FACTORY_CLASS_NAME = "org.apache.hadoop.security.alias.JavaKeyStoreProvider$Factory"; diff --git a/hbase-common/src/test/resources/hdfs-scr-disabled.xml b/hbase-common/src/test/resources/hdfs-scr-disabled.xml new file mode 100644 index 00000000000..fdb3c36edc8 --- /dev/null +++ b/hbase-common/src/test/resources/hdfs-scr-disabled.xml @@ -0,0 +1,42 @@ + + + + + + + dfs.client.read.shortcircuit + false + + If set to true, this configuration parameter enables short-circuit local + reads. + + + + dfs.domain.socket.path + + + Optional. This is a path to a UNIX domain socket that will be used for + communication between the DataNode and local HDFS clients. + If the string "_PORT" is present in this path, it will be replaced by the + TCP port of the DataNode. + + + diff --git a/hbase-common/src/test/resources/hdfs-scr-enabled.xml b/hbase-common/src/test/resources/hdfs-scr-enabled.xml new file mode 100644 index 00000000000..8594494782c --- /dev/null +++ b/hbase-common/src/test/resources/hdfs-scr-enabled.xml @@ -0,0 +1,42 @@ + + + + + + + dfs.client.read.shortcircuit + true + + If set to true, this configuration parameter enables short-circuit local + reads. + + + + dfs.domain.socket.path + /var/lib/hadoop-hdfs/dn_socket + + Optional. This is a path to a UNIX domain socket that will be used for + communication between the DataNode and local HDFS clients. + If the string "_PORT" is present in this path, it will be replaced by the + TCP port of the DataNode. + + +