From 3b9584d12b06a6b66abd737e768d9d684ff92c78 Mon Sep 17 00:00:00 2001 From: Vivek Ratnavel Subramanian Date: Sun, 8 Sep 2019 20:44:07 -0700 Subject: [PATCH] HDDS-2087. Remove the hard coded config key in ChunkManager (#1409) --- .../main/java/org/apache/hadoop/hdds/HddsConfigKeys.java | 4 ++++ hadoop-hdds/common/src/main/resources/ozone-default.xml | 2 +- .../container/keyvalue/impl/ChunkManagerFactory.java | 8 +++++--- .../apache/hadoop/ozone/TestOzoneConfigurationFields.java | 1 - 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsConfigKeys.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsConfigKeys.java index c541f9b82897a..548948e5b78ef 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsConfigKeys.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsConfigKeys.java @@ -241,6 +241,10 @@ private HddsConfigKeys() { "hdds.container.chunk.persistdata"; public static final boolean HDDS_CONTAINER_PERSISTDATA_DEFAULT = true; + public static final String HDDS_CONTAINER_SCRUB_ENABLED = + "hdds.container.scrub.enabled"; + public static final boolean HDDS_CONTAINER_SCRUB_ENABLED_DEFAULT = false; + public static final String HDDS_DATANODE_HTTP_ENABLED_KEY = "hdds.datanode.http.enabled"; public static final String HDDS_DATANODE_HTTP_BIND_HOST_KEY = diff --git a/hadoop-hdds/common/src/main/resources/ozone-default.xml b/hadoop-hdds/common/src/main/resources/ozone-default.xml index 22f1a3c727983..52e83698f43b4 100644 --- a/hadoop-hdds/common/src/main/resources/ozone-default.xml +++ b/hadoop-hdds/common/src/main/resources/ozone-default.xml @@ -1367,7 +1367,7 @@ - hdds.containerscrub.enabled + hdds.container.scrub.enabled false DATANODE diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/ChunkManagerFactory.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/ChunkManagerFactory.java index 673e289683012..85495783cc833 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/ChunkManagerFactory.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/ChunkManagerFactory.java @@ -26,6 +26,8 @@ import static org.apache.hadoop.hdds.HddsConfigKeys.HDDS_CONTAINER_PERSISTDATA; import static org.apache.hadoop.hdds.HddsConfigKeys.HDDS_CONTAINER_PERSISTDATA_DEFAULT; +import static org.apache.hadoop.hdds.HddsConfigKeys.HDDS_CONTAINER_SCRUB_ENABLED; +import static org.apache.hadoop.hdds.HddsConfigKeys.HDDS_CONTAINER_SCRUB_ENABLED_DEFAULT; /** * Select an appropriate ChunkManager implementation as per config setting. @@ -64,12 +66,12 @@ private static ChunkManager createChunkManager(Configuration config, if (!persist) { boolean scrubber = config.getBoolean( - "hdds.containerscrub.enabled", - false); + HDDS_CONTAINER_SCRUB_ENABLED, + HDDS_CONTAINER_SCRUB_ENABLED_DEFAULT); if (scrubber) { // Data Scrubber needs to be disabled for non-persistent chunks. LOG.warn("Failed to set " + HDDS_CONTAINER_PERSISTDATA + " to false." - + " Please set hdds.containerscrub.enabled" + + " Please set " + HDDS_CONTAINER_SCRUB_ENABLED + " also to false to enable non-persistent containers."); persist = true; } diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestOzoneConfigurationFields.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestOzoneConfigurationFields.java index cbd6a0bd26869..fa0e73d93545f 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestOzoneConfigurationFields.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestOzoneConfigurationFields.java @@ -44,7 +44,6 @@ public void initializeMemberVariables() { errorIfMissingXmlProps = true; xmlPropsToSkipCompare.add("hadoop.tags.custom"); xmlPropsToSkipCompare.add("ozone.om.nodes.EXAMPLEOMSERVICEID"); - xmlPropsToSkipCompare.add("hdds.containerscrub.enabled"); addPropertiesNotInXml(); }