Apache Solr open-source search software
SOLR-4578: CoreAdminHandler#handleCreateAction gets a SolrCore and does not close it in SolrCloud mode when a core with the same name already exists.
Mark Robert Miller3943f0f8c469
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 9b4d8ca9c2d..505885a27c2 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -89,6 +89,10 @@ Bug Fixes* SOLR-4371: Admin UI - Analysis Screen shows empty result (steffkes)+* SOLR-4578: CoreAdminHandler#handleCreateAction gets a SolrCore and does not+ close it in SolrCloud mode when a core with the same name already exists.+ (Mark Miller)+Other Changes----------------------diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.javaindex 44628e4e298..8618b3b6d16 100644--- a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java+++ b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java@@ -408,8 +408,8 @@ public class CoreAdminHandler extends RequestHandlerBase {//for now, do not allow creating new core with same name when in cloud mode//XXX perhaps it should just be unregistered from cloud before readding it?,//XXX perhaps we should also check that cores are of same type before adding new core to collection?- if (coreContainer.getZkController() != null) {- if (coreContainer.getCore(name) != null) {+ if (coreContainer.isZooKeeperAware()) {+ if (coreContainer.getCoreNames().contains(name)) {log.info("Re-creating a core with existing name is not allowed in cloud mode");throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,"Core with name '" + name + "' already exists.");