From b1a59b164412fbd9f641a7e992a7d1a3fd0f1a10 Mon Sep 17 00:00:00 2001 From: Virajith Jalaparti Date: Tue, 7 Aug 2018 10:15:28 -0700 Subject: [PATCH] HDFS-13796. Allow verbosity of InMemoryLevelDBAliasMapServer to be configurable. --- .../main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java | 2 ++ .../server/aliasmap/InMemoryLevelDBAliasMapServer.java | 8 +++++++- .../hadoop-hdfs/src/main/resources/hdfs-default.xml | 9 +++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) 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 5a1266cb17..4f21ee1b1b 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 @@ -96,6 +96,8 @@ public class DFSConfigKeys extends CommonConfigurationKeys { public static final int DFS_PROVIDED_ALIASMAP_INMEMORY_BATCH_SIZE_DEFAULT = 500; public static final String DFS_PROVIDED_ALIASMAP_INMEMORY_ENABLED = "dfs.provided.aliasmap.inmemory.enabled"; public static final boolean DFS_PROVIDED_ALIASMAP_INMEMORY_ENABLED_DEFAULT = false; + public static final String DFS_PROVIDED_ALIASMAP_INMEMORY_SERVER_LOG = "dfs.provided.aliasmap.inmemory.server.log"; + public static final boolean DFS_PROVIDED_ALIASMAP_INMEMORY_SERVER_LOG_DEFAULT = false; public static final String DFS_DATANODE_BALANCE_BANDWIDTHPERSEC_KEY = HdfsClientConfigKeys.DeprecatedKeys.DFS_DATANODE_BALANCE_BANDWIDTHPERSEC_KEY; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/aliasmap/InMemoryLevelDBAliasMapServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/aliasmap/InMemoryLevelDBAliasMapServer.java index 1d06f13285..f201bfd784 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/aliasmap/InMemoryLevelDBAliasMapServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/aliasmap/InMemoryLevelDBAliasMapServer.java @@ -39,6 +39,8 @@ import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_PROVIDED_ALIASMAP_INMEMORY_RPC_ADDRESS; import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_PROVIDED_ALIASMAP_INMEMORY_RPC_ADDRESS_DEFAULT; import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_PROVIDED_ALIASMAP_INMEMORY_RPC_BIND_HOST; +import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_PROVIDED_ALIASMAP_INMEMORY_SERVER_LOG; +import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_PROVIDED_ALIASMAP_INMEMORY_SERVER_LOG_DEFAULT; import static org.apache.hadoop.hdfs.DFSUtil.getBindAddress; import static org.apache.hadoop.hdfs.protocol.proto.AliasMapProtocolProtos.*; import static org.apache.hadoop.hdfs.server.aliasmap.InMemoryAliasMap.CheckedFunction2; @@ -87,13 +89,17 @@ public void start() throws IOException { DFS_PROVIDED_ALIASMAP_INMEMORY_RPC_ADDRESS_DEFAULT, DFS_PROVIDED_ALIASMAP_INMEMORY_RPC_BIND_HOST); + boolean setVerbose = conf.getBoolean( + DFS_PROVIDED_ALIASMAP_INMEMORY_SERVER_LOG, + DFS_PROVIDED_ALIASMAP_INMEMORY_SERVER_LOG_DEFAULT); + aliasMapServer = new RPC.Builder(conf) .setProtocol(AliasMapProtocolPB.class) .setInstance(aliasMapProtocolService) .setBindAddress(rpcAddress.getHostName()) .setPort(rpcAddress.getPort()) .setNumHandlers(1) - .setVerbose(true) + .setVerbose(setVerbose) .build(); LOG.info("Starting InMemoryLevelDBAliasMapServer on {}", rpcAddress); 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 9e73197d9f..dea79f5ea7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml @@ -4867,6 +4867,15 @@ + + dfs.provided.aliasmap.inmemory.server.log + false + + Ensures that InMemoryAliasMap server logs every call to it. + Set to false by default. + + + dfs.provided.aliasmap.text.delimiter ,