SOLR-2324: SolrCloud solr.xml parameters are not persisted by CoreContainer.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1095455 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2011-04-20 16:38:51 +00:00
parent 9d901879b3
commit 1773808025
4 changed files with 24 additions and 9 deletions

View File

@ -105,8 +105,10 @@ New Features
levenshtein automata. (rmuir)
* SOLR-1873: SolrCloud - added shared/central config and core/shard managment via zookeeper,
built-in load balancing, and infrastructure for future SolrCloud work.
(yonik, Mark Miller)
built-in load balancing, and infrastructure for future SolrCloud work. (yonik, Mark Miller)
Additional Work:
SOLR-2324: SolrCloud solr.xml parameters are not persisted by CoreContainer.
(Massimo Schiavon, Mark Miller)
* SOLR-1729: Evaluation of NOW for date math is done only once per request for
consistency, and is also propagated to shards in distributed search.

View File

@ -79,6 +79,7 @@ public class CoreContainer
protected Map<String ,IndexSchema> indexSchemaCache;
protected String adminHandler;
protected boolean shareSchema;
protected Integer zkClientTimeout;
protected String solrHome;
protected String defaultCoreName = "";
private ZkController zkController;
@ -313,7 +314,7 @@ public class CoreContainer
zkHost = cfg.get("solr/@zkHost" , null);
adminPath = cfg.get("solr/cores/@adminPath", null);
shareSchema = cfg.getBool("solr/cores/@shareSchema", false);
int zkClientTimeout = cfg.getInt("solr/cores/@zkClientTimeout", 10000);
zkClientTimeout = cfg.getInt("solr/cores/@zkClientTimeout", 10000);
hostPort = System.getProperty("hostPort");
if (hostPort == null) {
@ -889,6 +890,7 @@ public class CoreContainer
if (this.libDir != null) {
writeAttribute(w,"sharedLib",libDir);
}
if(zkHost != null) writeAttribute(w, "zkHost", zkHost);
writeAttribute(w,"persistent",isPersistent());
w.write(">\n");
@ -900,6 +902,10 @@ public class CoreContainer
if(adminHandler != null) writeAttribute(w, "adminHandler", adminHandler);
if(shareSchema) writeAttribute(w, "shareSchema", "true");
if(!defaultCoreName.equals("")) writeAttribute(w, "defaultCoreName", defaultCoreName);
if(host != null) writeAttribute(w, "host", host);
if(hostPort != null) writeAttribute(w, "hostPort", hostPort);
if(zkClientTimeout != null) writeAttribute(w, "zkClientTimeout", zkClientTimeout);
if(hostContext != null) writeAttribute(w, "hostContext", hostContext);
w.write(">\n");
synchronized(cores) {

View File

@ -30,7 +30,7 @@
adminPath: RequestHandler path to manage cores.
If 'null' (or absent), cores will not be manageable via REST
-->
<cores adminPath="/admin/cores" defaultCoreName="core0">
<cores adminPath="/admin/cores" defaultCoreName="core0" host="127.0.0.1" hostPort="${hostPort:8983}" hostContext="solr" zkClientTimeout="8000">
<core name="core0" instanceDir="./">
<property name="version" value="3.5"/>
<property name="l10n" value="EN"/>

View File

@ -70,11 +70,13 @@ public class TestSolrProperties extends LuceneTestCase {
@Before
public void setUp() throws Exception {
super.setUp();
System.setProperty("solr.solr.home", getSolrHome());
File home = SolrTestCaseJ4.getFile(getSolrHome());
System.setProperty("solr.solr.home", home.getAbsolutePath());
log.info("pwd: " + (new File(".")).getAbsolutePath());
solrXml = new File(home, "solr.xml");
solrXml = new File(home, getSolrXml());
cores = new CoreContainer(home.getAbsolutePath(), solrXml);
}
@ -197,6 +199,11 @@ public class TestSolrProperties extends LuceneTestCase {
try {
Document document = builder.parse(fis);
assertTrue(exists("/solr/cores[@defaultCoreName='core0']", document));
assertTrue(exists("/solr/cores[@host='127.0.0.1']", document));
assertTrue(exists("/solr/cores[@hostPort='8983']", document));
assertTrue(exists("/solr/cores[@zkClientTimeout='8000']", document));
assertTrue(exists("/solr/cores[@hostContext='solr']", document));
} finally {
fis.close();
}