diff --git a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java index 24f3a248264..657df50c09b 100644 --- a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java +++ b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java @@ -52,8 +52,6 @@ import org.elasticsearch.repositories.blobstore.BlobStoreRepository; public final class HdfsRepository extends BlobStoreRepository implements FileContextFactory { - public final static String TYPE = "hdfs"; - private final BlobPath basePath; private final ByteSizeValue chunkSize; private final boolean compress; @@ -77,7 +75,7 @@ public final class HdfsRepository extends BlobStoreRepository implements FileCon this.chunkSize = repositorySettings.settings().getAsBytesSize("chunk_size", settings.getAsBytesSize("chunk_size", null)); this.compress = repositorySettings.settings().getAsBoolean("compress", settings.getAsBoolean("compress", false)); } - + @Override protected void doStart() { if (!Strings.hasText(uri)) { @@ -183,13 +181,6 @@ public final class HdfsRepository extends BlobStoreRepository implements FileCon cfg.setClassLoader(this.getClass().getClassLoader()); cfg.reloadConfiguration(); - String confLocation = repositorySettings.settings().get("conf_location", settings.get("conf_location")); - if (Strings.hasText(confLocation)) { - for (String entry : Strings.commaDelimitedListToStringArray(confLocation)) { - addConfigLocation(cfg, entry.trim()); - } - } - Map map = repositorySettings.settings().getByPrefix("conf.").getAsMap(); for (Entry entry : map.entrySet()) { cfg.set(entry.getKey(), entry.getValue()); @@ -214,46 +205,6 @@ public final class HdfsRepository extends BlobStoreRepository implements FileCon } } - @SuppressForbidden(reason = "Where is this reading configuration files from? It should use Environment for ES conf dir") - private void addConfigLocation(Configuration cfg, String confLocation) { - URL cfgURL = null; - // it's an URL - if (!confLocation.contains(":")) { - cfgURL = cfg.getClassLoader().getResource(confLocation); - - // fall back to file - if (cfgURL == null) { - java.nio.file.Path path = PathUtils.get(confLocation); - if (!Files.isReadable(path)) { - throw new IllegalArgumentException( - String.format(Locale.ROOT, - "Cannot find classpath resource or file 'conf_location' [%s] defined for hdfs snapshot/restore", - confLocation)); - } - String pathLocation = path.toUri().toString(); - logger.debug("Adding path [{}] as file [{}]", confLocation, pathLocation); - confLocation = pathLocation; - } - else { - logger.debug("Resolving path [{}] to classpath [{}]", confLocation, cfgURL); - } - } - else { - logger.debug("Adding path [{}] as URL", confLocation); - } - - if (cfgURL == null) { - try { - cfgURL = new URL(confLocation); - } catch (MalformedURLException ex) { - throw new IllegalArgumentException(String.format(Locale.ROOT, - "Invalid 'conf_location' URL [%s] defined for hdfs snapshot/restore", confLocation), ex); - } - } - - cfg.addResource(cfgURL); - } - @Override protected BlobStore blobStore() { return blobStore; diff --git a/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java index b132296ce12..9e833ad6c72 100644 --- a/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java +++ b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java @@ -54,7 +54,6 @@ public class HdfsTests extends ESIntegTestCase { .put("uri", "hdfs:///") .put("conf.fs.AbstractFileSystem.hdfs.impl", TestingFs.class.getName()) .put("path", "foo") - .put("conf", "additional-cfg.xml, conf-2.xml") .put("chunk_size", randomIntBetween(100, 1000) + "k") .put("compress", randomBoolean()) ).get(); @@ -143,7 +142,7 @@ public class HdfsTests extends ESIntegTestCase { // expected } } - + public void testNonHdfsUri() { Client client = client(); try { @@ -191,4 +190,4 @@ public class HdfsTests extends ESIntegTestCase { private long count(Client client, String index) { return client.prepareSearch(index).setSize(0).get().getHits().totalHits(); } -} \ No newline at end of file +} diff --git a/plugins/repository-hdfs/src/test/resources/additional-cfg.xml b/plugins/repository-hdfs/src/test/resources/additional-cfg.xml deleted file mode 100644 index b1b6611e924..00000000000 --- a/plugins/repository-hdfs/src/test/resources/additional-cfg.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - foo - foo - - - paradise - lost - - diff --git a/plugins/repository-hdfs/src/test/resources/conf-2.xml b/plugins/repository-hdfs/src/test/resources/conf-2.xml deleted file mode 100644 index b1b6611e924..00000000000 --- a/plugins/repository-hdfs/src/test/resources/conf-2.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - foo - foo - - - paradise - lost - -