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

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@685244 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2008-08-12 17:54:45 +00:00
parent b25d5b3a33
commit cabf61cde8
7 changed files with 33 additions and 26 deletions

View File

@ -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)

View File

@ -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();
}

View File

@ -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 );
}

View File

@ -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>

View File

@ -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. */

View File

@ -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);
}

View File

@ -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