mirror of https://github.com/apache/lucene.git
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:
parent
9d901879b3
commit
1773808025
|
@ -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.
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
@ -897,9 +899,13 @@ public class CoreContainer
|
|||
}
|
||||
w.write(" <cores");
|
||||
writeAttribute(w, "adminPath",adminPath);
|
||||
if(adminHandler != null) writeAttribute(w, "adminHandler",adminHandler);
|
||||
if(shareSchema) writeAttribute(w, "shareSchema","true");
|
||||
if(!defaultCoreName.equals("")) writeAttribute(w, "defaultCoreName",defaultCoreName);
|
||||
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) {
|
||||
|
|
|
@ -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"/>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -191,12 +193,17 @@ public class TestSolrProperties extends LuceneTestCase {
|
|||
|
||||
mcr = CoreAdminRequest.persist("solr-persist.xml", coreadmin);
|
||||
|
||||
// System.out.println(IOUtils.toString(new FileInputStream(new File(solrXml.getParent(), "solr-persist.xml"))));
|
||||
//System.out.println(IOUtils.toString(new FileInputStream(new File(solrXml.getParent(), "solr-persist.xml"))));
|
||||
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
FileInputStream fis = new FileInputStream(new File(solrXml.getParent(), "solr-persist.xml"));
|
||||
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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue