You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ds...@apache.org on 2023/09/27 02:20:03 UTC
[solr] branch main updated: SOLR-16967: ConfigSet: shouldn't require solrconfig.xml (#1900)
This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 4c80cc2ef9e SOLR-16967: ConfigSet: shouldn't require solrconfig.xml (#1900)
4c80cc2ef9e is described below
commit 4c80cc2ef9e50915fb7aaa6e9cfe042a27d2c44d
Author: David Smiley <ds...@salesforce.com>
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.
---
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 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.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");