From d5f8b17e3f245709f4b4747db2d4b8480e5d34a8 Mon Sep 17 00:00:00 2001 From: Tomas Eduardo Fernandez Lobbe Date: Wed, 26 Nov 2014 14:15:37 +0000 Subject: [PATCH] SOLR-5864: Remove previous SolrCore as parameter on reload git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1641819 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 8 +++++++- .../src/java/org/apache/solr/core/CoreContainer.java | 3 +-- solr/core/src/java/org/apache/solr/core/SolrCore.java | 9 ++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 6c1ce6c9466..5b993553a1a 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -108,6 +108,9 @@ Upgrading from Solr 4.x * AdminHandlers is deprecated , /admin/* are implicitly defined, /get ,/replacation and handlers are also implicitly registered (refer to SOLR-6792) +* SolrCore.reload(ConfigSet coreConfig, SolrCore prev) was deprecated in 4.10.3 and + removed in 5.0. use SolrCore.reload(ConfigSet coreConfig). See SOLR-5864. + Detailed Change List ---------------------- @@ -426,10 +429,13 @@ Other Changes * SOLR-6751: Exceptions thrown in the analysis chain in DirectUpdateHandler2 should return a BAD_REQUEST status (Alan Woodward) -* SOLR-SOLR-6792 : deprecate AdminHandlers, Clean up solrconfig.xml of +* SOLR-6792 : deprecate AdminHandlers, Clean up solrconfig.xml of unnecessary plugin definitions, implicit registration of /replication, /get and /admin/* handlers (Noble Paul) +* SOLR-5864: Remove previous SolrCore as parameter on reload. + (Tomás Fernández Löbbe) + ================== 4.10.3 ================== Bug Fixes diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java index 4a554049419..9db6b2faea5 100644 --- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java +++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java @@ -22,7 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.io.File; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -602,7 +601,7 @@ public class CoreContainer { solrCores.waitAddPendingCoreOps(name); ConfigSet coreConfig = coreConfigService.getConfig(cd); log.info("Reloading SolrCore '{}' using configuration from {}", cd.getName(), coreConfig.getName()); - SolrCore newCore = core.reload(coreConfig, core); + SolrCore newCore = core.reload(coreConfig); registerCore(name, newCore, false); } catch (Exception e) { diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java index 8819dc262f9..940a50b6c4a 100644 --- a/solr/core/src/java/org/apache/solr/core/SolrCore.java +++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java @@ -423,18 +423,21 @@ public final class SolrCore implements SolrInfoMBean, Closeable { return responseWriters.put(name, responseWriter); } - public SolrCore reload(ConfigSet coreConfig, SolrCore prev) throws IOException, + public SolrCore reload(ConfigSet coreConfig) throws IOException, ParserConfigurationException, SAXException { solrCoreState.increfSolrCoreState(); + SolrCore currentCore; boolean indexDirChange = !getNewIndexDir().equals(getIndexDir()); if (indexDirChange || !coreConfig.getSolrConfig().nrtMode) { // the directory is changing, don't pass on state - prev = null; + currentCore = null; + } else { + currentCore = this; } SolrCore core = new SolrCore(getName(), getDataDir(), coreConfig.getSolrConfig(), - coreConfig.getIndexSchema(), coreDescriptor, updateHandler, this.solrDelPolicy, prev); + coreConfig.getIndexSchema(), coreDescriptor, updateHandler, this.solrDelPolicy, currentCore); core.solrDelPolicy = this.solrDelPolicy;