diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index eb3544e8df3..4ed9869a482 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -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 ---------------------- diff --git a/solr/src/java/org/apache/solr/core/CoreContainer.java b/solr/src/java/org/apache/solr/core/CoreContainer.java index ad403d04b53..2b0150a0403 100644 --- a/solr/src/java/org/apache/solr/core/CoreContainer.java +++ b/solr/src/java/org/apache/solr/core/CoreContainer.java @@ -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) { diff --git a/solr/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java b/solr/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java index 937f8778481..fc2f578b6b6 100644 --- a/solr/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java +++ b/solr/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java @@ -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)