SOLR-2333: The "rename" core admin action does not persist the new name to solr.xml

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1095120 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2011-04-19 15:44:05 +00:00
parent 2b87910440
commit a440c8c018
3 changed files with 22 additions and 2 deletions

View File

@ -276,7 +276,8 @@ Bug Fixes
performance/algorithmic improvements when (facet.sort=count && facet.mincount=1
&& facet.limit=-1) and when (facet.sort=index && facet.mincount>0) (yonik)
* SOLR-2333: The "rename" core admin action does not persist the new name to solr.xml
(Rasmus Hahn, Paul R. Brown via Mark Miller)
Other Changes
----------------------

View File

@ -500,7 +500,12 @@ public class CoreContainer
SolrCore old = null;
synchronized (cores) {
old = cores.put(name, core);
/*
* set both the name of the descriptor and the name of the
* core, since the descriptors name is used for persisting.
*/
core.setName(name);
core.getCoreDescriptor().name = name;
}
if (zkController != null) {

View File

@ -109,6 +109,10 @@ public class TestSolrProperties extends LuceneTestCase {
protected SolrServer getSolrAdmin() {
return new EmbeddedSolrServer(cores, "core0");
}
protected SolrServer getRenamedSolrAdmin() {
return new EmbeddedSolrServer(cores, "renamed_core");
}
protected SolrServer getSolrCore(String name) {
return new EmbeddedSolrServer(cores, name);
@ -196,7 +200,17 @@ public class TestSolrProperties extends LuceneTestCase {
} finally {
fis.close();
}
CoreAdminRequest.renameCore(name, "renamed_core", coreadmin);
mcr = CoreAdminRequest.persist("solr-persist.xml", getRenamedSolrAdmin());
fis = new FileInputStream(new File(solrXml.getParent(), "solr-persist.xml"));
try {
Document document = builder.parse(fis);
assertTrue(exists("/solr/cores/core[@name='renamed_core']", document));
} finally {
fis.close();
}
}
public static boolean exists(String xpathStr, Node node)