diff --git a/hadoop-common-project/hadoop-common/CHANGES-HDFS-EC-7285.txt b/hadoop-common-project/hadoop-common/CHANGES-HDFS-EC-7285.txt index b850e117b8a..97492702216 100644 --- a/hadoop-common-project/hadoop-common/CHANGES-HDFS-EC-7285.txt +++ b/hadoop-common-project/hadoop-common/CHANGES-HDFS-EC-7285.txt @@ -42,3 +42,5 @@ ( Kai Zheng via vinayakumarb ) HADOOP-11818. Minor improvements for erasurecode classes. (Rakesh R via Kai Zheng) + + HADOOP-11841. Remove unused ecschema-def.xml files. (szetszwo) diff --git a/hadoop-common-project/hadoop-common/src/main/conf/ecschema-def.xml b/hadoop-common-project/hadoop-common/src/main/conf/ecschema-def.xml deleted file mode 100644 index e36d38650e4..00000000000 --- a/hadoop-common-project/hadoop-common/src/main/conf/ecschema-def.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - 10 - 4 - RS - - \ No newline at end of file diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeys.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeys.java index 8a5211a70bb..bd2a24b0220 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeys.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeys.java @@ -143,11 +143,6 @@ public class CommonConfigurationKeys extends CommonConfigurationKeysPublic { /** Supported erasure codec classes */ public static final String IO_ERASURECODE_CODECS_KEY = "io.erasurecode.codecs"; - public static final String IO_ERASURECODE_SCHEMA_FILE_KEY = - "io.erasurecode.schema.file"; - public static final String IO_ERASURECODE_SCHEMA_FILE_DEFAULT = - "ecschema-def.xml"; - /** Use XOR raw coder when possible for the RS codec */ public static final String IO_ERASURECODE_CODEC_RS_USEXOR_KEY = "io.erasurecode.codec.rs.usexor"; diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/SchemaLoader.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/SchemaLoader.java index 75dd03a0652..9b10c781827 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/SchemaLoader.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/SchemaLoader.java @@ -17,20 +17,27 @@ */ package org.apache.hadoop.io.erasurecode; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.CommonConfigurationKeys; -import org.w3c.dom.*; -import org.xml.sax.SAXException; +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.*; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; +import org.xml.sax.SAXException; /** * A EC schema loading utility that loads predefined EC schemas from XML file @@ -42,8 +49,8 @@ public class SchemaLoader { * Load predefined ec schemas from configuration file. This file is * expected to be in the XML format. */ - public List loadSchema(Configuration conf) { - File confFile = getSchemaFile(conf); + public List loadSchema(String schemaFilePath) { + File confFile = getSchemaFile(schemaFilePath); if (confFile == null) { LOG.warn("Not found any predefined EC schema file"); return Collections.emptyList(); @@ -100,10 +107,7 @@ public class SchemaLoader { * Path to the XML file containing predefined ec schemas. If the path is * relative, it is searched for in the classpath. */ - private File getSchemaFile(Configuration conf) { - String schemaFilePath = conf.get( - CommonConfigurationKeys.IO_ERASURECODE_SCHEMA_FILE_KEY, - CommonConfigurationKeys.IO_ERASURECODE_SCHEMA_FILE_DEFAULT); + private File getSchemaFile(String schemaFilePath) { File schemaFile = new File(schemaFilePath); if (! schemaFile.isAbsolute()) { URL url = Thread.currentThread().getContextClassLoader() diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/TestSchemaLoader.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/TestSchemaLoader.java index 7bb0a9a1218..6caeedb3b47 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/TestSchemaLoader.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/TestSchemaLoader.java @@ -17,16 +17,14 @@ */ package org.apache.hadoop.io.erasurecode; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.CommonConfigurationKeys; -import org.junit.Test; +import static org.junit.Assert.assertEquals; import java.io.File; import java.io.FileWriter; import java.io.PrintWriter; import java.util.List; -import static org.junit.Assert.assertEquals; +import org.junit.Test; public class TestSchemaLoader { @@ -54,12 +52,8 @@ public class TestSchemaLoader { out.println(""); out.close(); - Configuration conf = new Configuration(); - conf.set(CommonConfigurationKeys.IO_ERASURECODE_SCHEMA_FILE_KEY, - SCHEMA_FILE); - SchemaLoader schemaLoader = new SchemaLoader(); - List schemas = schemaLoader.loadSchema(conf); + List schemas = schemaLoader.loadSchema(SCHEMA_FILE); assertEquals(2, schemas.size());