Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-689 - rename multicore.xml to solr.xml slong with some syntax changes to improve the terminology and leave ourselves open to additional options in that file

Chris M. Hostettercabf61cde8d8
diff --git a/CHANGES.txt b/CHANGES.txt
index be3cf3e7096..fcdbcdf7b41 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -217,7 +217,7 @@ New Features
informed about the SolrCore/ResourceLoader. (Henri Biestro, ryan)
33. SOLR-350: Support multiple SolrCores running in the same solr instance. If a
- multicore.xml file exists in solr.home, this file is used to instanciate
+ solr.xml file exists in solr.home, this file is used to instanciate
multiple cores and enables runtime core manipulation. For more informaion see:
http://wiki.apache.org/solr/MultiCore (Henri Biestro, ryan)
@@ -355,6 +355,9 @@ Changes in runtime behavior
performance and makes overwrites atomic, eliminating the possibility of
a crash causing duplicates. (yonik)
+ 2. SOLR-689: solr.xml has replaced multicore.xml, and uses a slightly
+ differnet syntax. (hossman)
+
Optimizations
1. SOLR-276: improve JSON writer speed. (yonik)
diff --git a/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java b/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
index 65bcba9e600..004b8e1551a 100644
--- a/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
+++ b/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
@@ -42,9 +42,6 @@ public abstract class MultiCoreExampleTestBase extends SolrExampleTestBase
@Override public String getSolrConfigFile() { return getSolrHome()+"core0/conf/solrconfig.xml"; }
@Override public void setUp() throws Exception {
-// File src = new File(getSolrHome(), "multicore-base.xml");
-// File dest = new File(getSolrHome(), "multicore.xml");
-// org.apache.solr.core.MultiCore.fileCopy(src, dest);
super.setUp();
}
diff --git a/client/java/solrj/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java b/client/java/solrj/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java
index 097fc59df3b..57316bc55df 100644
--- a/client/java/solrj/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java
+++ b/client/java/solrj/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java
@@ -35,7 +35,7 @@ public class MultiCoreEmbeddedTest extends MultiCoreExampleTestBase {
super.setUp();
File home = new File( getSolrHome() );
- File f = new File( home, "multicore.xml" );
+ File f = new File( home, "solr.xml" );
multicore.load( getSolrHome(), f );
}
diff --git a/example/multicore/multicore.xml b/example/multicore/solr.xml
similarity index 85%
rename from example/multicore/multicore.xml
rename to example/multicore/solr.xml
index 0776e7b8f97..fed101ebcb4 100644
--- a/example/multicore/multicore.xml
+++ b/example/multicore/solr.xml
@@ -19,13 +19,17 @@
<!--
All (relative) paths are relative to the installation path
- adminPath: RequestHandler path to manage multicores.
- If 'null', cores will not be managable via REST
-
persistent: Save changes made via the API to this file
sharedLib: path to a lib directory that will be shared across all cores
-->
-<multicore adminPath="/admin/multicore" persistent="true" >
- <core name="core0" instanceDir="core0" />
- <core name="core1" instanceDir="core1" />
-</multicore>
+<solr persistent="true">
+
+ <!--
+ adminPath: RequestHandler path to manage multicores.
+ If 'null', cores will not be managable via REST
+ -->
+ <cores adminPath="/admin/multicore">
+ <core name="core0" instanceDir="core0" />
+ <core name="core1" instanceDir="core1" />
+ </cores>
+</solr>
diff --git a/src/java/org/apache/solr/core/MultiCore.java b/src/java/org/apache/solr/core/MultiCore.java
index e3f4407f723..9e250b75b98 100644
--- a/src/java/org/apache/solr/core/MultiCore.java
+++ b/src/java/org/apache/solr/core/MultiCore.java
@@ -99,9 +99,10 @@ public class MultiCore
try {
Config cfg = new Config(loader, null, cfgis, null);
- persistent = cfg.getBool( "multicore/@persistent", false );
- adminPath = cfg.get( "multicore/@adminPath", null );
- libDir = cfg.get( "multicore/@sharedLib", null);
+ persistent = cfg.getBool( "solr/@persistent", false );
+ libDir = cfg.get( "solr/@sharedLib", null);
+
+ adminPath = cfg.get( "solr/cores/@adminPath", null );
if (libDir != null) {
// relative dir to conf
@@ -115,7 +116,7 @@ public class MultiCore
multiCoreHandler = this.createMultiCoreHandler();
}
- NodeList nodes = (NodeList)cfg.evaluate("multicore/core", XPathConstants.NODESET);
+ NodeList nodes = (NodeList)cfg.evaluate("solr/cores/core", XPathConstants.NODESET);
synchronized (cores) {
for (int i=0; i<nodes.getLength(); i++) {
Node node = nodes.item(i);
@@ -415,7 +416,7 @@ public class MultiCore
File tmpFile = null;
try {
// write in temp first
- tmpFile = File.createTempFile("multicore", ".xml", configFile.getParentFile());
+ tmpFile = File.createTempFile("solr", ".xml", configFile.getParentFile());
java.io.FileOutputStream out = new java.io.FileOutputStream(tmpFile);
synchronized(cores) {
Writer writer = new BufferedWriter(new OutputStreamWriter(out, "UTF-8"));
@@ -447,10 +448,7 @@ public class MultiCore
/** Write the multicore configuration through a writer.*/
void persist(Writer writer) throws IOException {
writer.write("<?xml version='1.0' encoding='UTF-8'?>");
- writer.write("\n");
- writer.write("<multicore adminPath='");
- XML.escapeAttributeValue(adminPath, writer);
- writer.write('\'');
+ writer.write("<solr");
if (this.libDir != null) {
writer.write(" sharedLib='");
XML.escapeAttributeValue(libDir, writer);
@@ -464,13 +462,18 @@ public class MultiCore
writer.write("false'");
}
writer.write(">\n");
+ writer.write("<cores adminPath='");
+ XML.escapeAttributeValue(adminPath, writer);
+ writer.write('\'');
+ writer.write(">\n");
synchronized(cores) {
for (Map.Entry<String, CoreDescriptor> entry : cores.entrySet()) {
persist(writer, entry.getValue());
}
}
- writer.write("</multicore>\n");
+ writer.write("</cores>\n");
+ writer.write("</solr>\n");
}
/** Writes the multicore configuration node for a given core. */
diff --git a/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java b/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
index cb5aa968324..1cf8156a524 100644
--- a/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
+++ b/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
@@ -109,7 +109,7 @@ public class SolrDispatchFilter implements Filter
out.println( "If you want solr to continue after configuration errors, change: \n");
out.println( " <abortOnConfigurationError>false</abortOnConfigurationError>\n" );
if (multicore != null && multicore.isEnabled()) {
- out.println( "in multicore.xml\n" );
+ out.println( "in solr.xml\n" );
} else {
out.println( "in solrconfig.xml\n" );
}
@@ -141,8 +141,8 @@ public class SolrDispatchFilter implements Filter
protected MultiCore initMultiCore(FilterConfig config) throws Exception {
MultiCore mcore = new MultiCore();
String instanceDir = SolrResourceLoader.locateInstanceDir();
- File fconf = new File(instanceDir, "multicore.xml");
- log.info("looking for multicore.xml: " + fconf.getAbsolutePath());
+ File fconf = new File(instanceDir, "solr.xml");
+ log.info("looking for solr.xml: " + fconf.getAbsolutePath());
if (fconf.exists()) {
mcore.load(instanceDir, fconf);
}
diff --git a/src/webapp/src/org/apache/solr/servlet/SolrServlet.java b/src/webapp/src/org/apache/solr/servlet/SolrServlet.java
index 8b56a5cb8de..d32d8f20749 100644
--- a/src/webapp/src/org/apache/solr/servlet/SolrServlet.java
+++ b/src/webapp/src/org/apache/solr/servlet/SolrServlet.java
@@ -53,7 +53,7 @@ public class SolrServlet extends HttpServlet {
// Check if the "multicore.xml" file exists -- if so, this is an invalid servlet
// (even if there is only one core...)
String instanceDir = SolrResourceLoader.locateInstanceDir();
- File fconf = new File(instanceDir, "multicore.xml");
+ File fconf = new File(instanceDir, "solr.xml");
hasMulticore = fconf.exists();
// we deliberately do not initialize a SolrCore because of SOLR-597