This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new ac336ad21d3 SOLR-16967: ConfigSet: shouldn't require solrconfig.xml
(#1900)
ac336ad21d3 is described below
commit ac336ad21d3d29b6542a90cb59e2708f69c677d4
Author: David Smiley <[email protected]>
AuthorDate: Tue Sep 26 22:19:57 2023 -0400
SOLR-16967: ConfigSet: shouldn't require solrconfig.xml (#1900)
ConfigSetService.checkConfigExists() should not require solrconfig.xml to
exist; the parent directory's existence is fine. Users may choose for their
config to be a different name, after all.
(cherry picked from commit 4c80cc2ef9e50915fb7aaa6e9cfe042a27d2c44d)
---
solr/CHANGES.txt | 3 +++
solr/core/src/java/org/apache/solr/cloud/ZkConfigSetService.java | 5 +----
.../src/java/org/apache/solr/core/FileSystemConfigSetService.java | 3 +--
.../test/org/apache/solr/common/cloud/TestZkConfigSetService.java | 1 +
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index e46a015da3c..d5ad8ca890a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -84,6 +84,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.java
index 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 {
@Override
public 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.java
index 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 {
@Override
public boolean checkConfigExists(String configName) throws IOException {
- Path solrConfigXmlFile =
getConfigDir(configName).resolve("solrconfig.xml");
- return Files.exists(solrConfigXmlFile);
+ return Files.exists(getConfigDir(configName));
}
@Override
diff --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.java
index 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 downloading
Path downloadPath = createTempDir("download");