diff --git a/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml b/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml index 3c14cda56844f..9859b8b94a4f8 100644 --- a/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml +++ b/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml @@ -891,13 +891,6 @@ - - io.bytes.per.checksum - 512 - The number of bytes per checksum. Must not be larger than - io.file.buffer.size. - - io.skip.checksum.errors false @@ -1097,13 +1090,6 @@ determine the host, port, etc. for a filesystem. - - fs.default.name - file:/// - Deprecated. Use (fs.defaultFS) property - instead - - fs.trash.interval 0 diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfigurationDeprecation.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfigurationDeprecation.java index 2db0d52bd97d9..5850a76a4c820 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfigurationDeprecation.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfigurationDeprecation.java @@ -18,6 +18,7 @@ package org.apache.hadoop.conf; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -26,7 +27,9 @@ import java.io.File; import java.io.FileWriter; import java.io.IOException; +import java.io.InputStream; import java.io.ByteArrayOutputStream; +import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -36,6 +39,8 @@ import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; import org.apache.hadoop.fs.CommonConfigurationKeys; @@ -49,6 +54,8 @@ import org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder; import org.apache.hadoop.thirdparty.com.google.common.util.concurrent.Uninterruptibles; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; public class TestConfigurationDeprecation { private Configuration conf; @@ -465,4 +472,30 @@ public void testGetPropertyBeforeDeprecetionsAreSet() throws Exception { "Property should be accessible through new key"); } + @Test + public void testNoDeprecationsByDefault() throws Exception { + // Force initialization to make sure deprecations are recorded for later calls to isDeprecated. + new Configuration(); + + // This test directly parses the default XML configuration file to check for deprecated + // properties, bypassing normalization logic in the Configuration class that might hide them. + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + List deprecatedProps = new ArrayList<>(); + + try (InputStream is = getClass().getResourceAsStream("/core-default.xml")) { + Document doc = db.parse(is); + NodeList props = doc.getElementsByTagName("name"); + for (int i = 0; i < props.getLength(); ++i) { + String prop = props.item(i).getTextContent(); + if (Configuration.isDeprecated(prop)) { + deprecatedProps.add(prop); + } + } + } + + assertThat(deprecatedProps) + .as("By default, deprecated properties should be empty: %s", deprecatedProps) + .isEmpty(); + } }