Apache Solr open-source search software
SOLR-16967: ConfigSet: shouldn't require solrconfig.xml (#1900)
David Smiley4c80cc2ef9e5
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 6c084388b4e..c485b9cb033 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -144,6 +144,9 @@ Improvements* SOLR-16959: Make the internal CoresLocator implementation configurable in solr.xml (Vincent Primault via David Smiley)+* SOLR-16967: Some ConfigSet operations formerly required that solrconfig.xml exist but should not have because+ the name of the file is configurable when creating cores / collections. (David Smiley)+Optimizations---------------------diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkConfigSetService.java b/solr/core/src/java/org/apache/solr/cloud/ZkConfigSetService.javaindex 5f83f88c8eb..1718edbf56a 100644--- a/solr/core/src/java/org/apache/solr/cloud/ZkConfigSetService.java+++ b/solr/core/src/java/org/apache/solr/cloud/ZkConfigSetService.java@@ -139,10 +139,7 @@ public class ZkConfigSetService extends ConfigSetService {@Overridepublic boolean checkConfigExists(String configName) throws IOException {try {- Boolean existsSolrConfigXml =- zkClient.exists(CONFIGS_ZKNODE + "/" + configName + "/solrconfig.xml", true);- if (existsSolrConfigXml == null) return false;- return existsSolrConfigXml;+ return zkClient.exists(CONFIGS_ZKNODE + "/" + configName, true);} catch (KeeperException | InterruptedException e) {throw new IOException("Error checking whether config exists", SolrZkClient.checkInterrupted(e));diff --git a/solr/core/src/java/org/apache/solr/core/FileSystemConfigSetService.java b/solr/core/src/java/org/apache/solr/core/FileSystemConfigSetService.javaindex 5ada2f99cfb..7631edc9809 100644--- a/solr/core/src/java/org/apache/solr/core/FileSystemConfigSetService.java+++ b/solr/core/src/java/org/apache/solr/core/FileSystemConfigSetService.java@@ -80,8 +80,7 @@ public class FileSystemConfigSetService extends ConfigSetService {@Overridepublic boolean checkConfigExists(String configName) throws IOException {- Path solrConfigXmlFile = getConfigDir(configName).resolve("solrconfig.xml");- return Files.exists(solrConfigXmlFile);+ return Files.exists(getConfigDir(configName));}@Overridediff --git a/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/TestZkConfigSetService.java b/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/TestZkConfigSetService.javaindex 16454d5dc3e..5375f62cdeb 100644--- a/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/TestZkConfigSetService.java+++ b/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/TestZkConfigSetService.java@@ -100,6 +100,7 @@ public class TestZkConfigSetService extends SolrTestCaseJ4 {List<String> configs = configSetService.listConfigs();assertEquals(1, configs.size());assertEquals("testconfig", configs.get(0));+ assertTrue(configSetService.checkConfigExists("testconfig"));// check downloadingPath downloadPath = createTempDir("download");