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 48d6dc4610b..3b347fd917e 100644 --- a/solr/core/src/java/org/apache/solr/core/SolrCore.java +++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java @@ -205,7 +205,6 @@ public class SolrCore implements SolrInfoBean, Closeable { private static final Logger slowLog = LoggerFactory.getLogger( MethodHandles.lookup().lookupClass().getName() + ".SlowRequest"); // nowarn - private final boolean isSynthetic; private String name; @@ -791,8 +790,7 @@ public SolrCore reload(ConfigSet coreConfig) throws IOException { updateHandler, solrDelPolicy, currentCore, - true, - isSynthetic); + true); // we open a new IndexWriter to pick up the latest config core.getUpdateHandler().getSolrCoreState().newIndexWriter(core, false); @@ -1054,13 +1052,8 @@ public CoreContainer getCoreContainer() { return coreContainer; } - protected SolrCore(CoreContainer coreContainer, CoreDescriptor cd, ConfigSet configSet) { - this(coreContainer, cd, configSet, false); - } - - protected SolrCore( - CoreContainer coreContainer, CoreDescriptor cd, ConfigSet configSet, boolean isSynthetic) { - this(coreContainer, cd, configSet, null, null, null, null, false, isSynthetic); + SolrCore(CoreContainer coreContainer, CoreDescriptor cd, ConfigSet configSet) { + this(coreContainer, cd, configSet, null, null, null, null, false); } private SolrCore( @@ -1071,8 +1064,7 @@ private SolrCore( UpdateHandler updateHandler, IndexDeletionPolicyWrapper delPolicy, SolrCore prev, - boolean reload, - boolean isSynthetic) { + boolean reload) { // ensure that in unclean shutdown tests we still close this assert ObjectReleaseTracker.track(searcherExecutor); @@ -1182,10 +1174,8 @@ private SolrCore( initSearcher(prev); - this.isSynthetic = isSynthetic; - // Initialize the RestManager - restManager = isSynthetic ? new RestManager() : initRestManager(); + restManager = initRestManager(); // Finally tell anyone who wants to know resourceLoader.inform(resourceLoader); @@ -1212,9 +1202,7 @@ private SolrCore( // searcher! seedVersionBuckets(); - if (!isSynthetic) { - bufferUpdatesIfConstructing(coreDescriptor); - } + bufferUpdatesIfConstructing(coreDescriptor); this.ruleExpiryLock = new ReentrantLock(); this.snapshotDelLock = new ReentrantLock(); @@ -1266,7 +1254,7 @@ public void seedVersionBuckets() { } /** Set UpdateLog to buffer updates if the slice is in construction. */ - private void bufferUpdatesIfConstructing(CoreDescriptor coreDescriptor) { + protected void bufferUpdatesIfConstructing(CoreDescriptor coreDescriptor) { if (coreContainer != null && coreContainer.isZooKeeperAware()) { if (reqHandlers.get("/get") == null) { diff --git a/solr/core/src/java/org/apache/solr/core/SolrCoreProxy.java b/solr/core/src/java/org/apache/solr/core/SyntheticSolrCore.java similarity index 59% rename from solr/core/src/java/org/apache/solr/core/SolrCoreProxy.java rename to solr/core/src/java/org/apache/solr/core/SyntheticSolrCore.java index bff8a1f4b80..70aa6f524ab 100644 --- a/solr/core/src/java/org/apache/solr/core/SolrCoreProxy.java +++ b/solr/core/src/java/org/apache/solr/core/SyntheticSolrCore.java @@ -3,14 +3,17 @@ import java.nio.file.Paths; import java.util.HashMap; import java.util.Map; + +import org.apache.solr.common.SolrException; import org.apache.solr.common.params.CoreAdminParams; +import org.apache.solr.rest.RestManager; -public class SolrCoreProxy extends SolrCore { - public SolrCoreProxy(CoreContainer coreContainer, CoreDescriptor cd, ConfigSet configSet) { - super(coreContainer, cd, configSet, true); +public class SyntheticSolrCore extends SolrCore { + public SyntheticSolrCore(CoreContainer coreContainer, CoreDescriptor cd, ConfigSet configSet) { + super(coreContainer, cd, configSet); } - public static SolrCoreProxy createAndRegisterProxy( + public static SyntheticSolrCore createAndRegisterCore( CoreContainer coreContainer, String syntheticCollectionName, String configSetName) { Map coreProps = new HashMap<>(); coreProps.put(CoreAdminParams.CORE_NODE_NAME, coreContainer.getHostName()); @@ -27,10 +30,20 @@ public static SolrCoreProxy createAndRegisterProxy( ConfigSet coreConfig = coreContainer.getConfigSetService().loadConfigSet(syntheticCoreDescriptor, configSetName); syntheticCoreDescriptor.setConfigSetTrusted(coreConfig.isTrusted()); - SolrCoreProxy syntheticCore = - new SolrCoreProxy(coreContainer, syntheticCoreDescriptor, coreConfig); + SyntheticSolrCore syntheticCore = + new SyntheticSolrCore(coreContainer, syntheticCoreDescriptor, coreConfig); coreContainer.registerCore(syntheticCoreDescriptor, syntheticCore, false, false); return syntheticCore; } + + @Override + protected void bufferUpdatesIfConstructing(CoreDescriptor coreDescriptor) { + //no updates to SyntheticSolrCore + } + + @Override + protected RestManager initRestManager() throws SolrException { + return new RestManager(); //TODO explain why we cannot use the super class init routine + } } diff --git a/solr/core/src/java/org/apache/solr/servlet/CoordinatorHttpSolrCall.java b/solr/core/src/java/org/apache/solr/servlet/CoordinatorHttpSolrCall.java index b0aa18e7e9b..6079b8b009f 100644 --- a/solr/core/src/java/org/apache/solr/servlet/CoordinatorHttpSolrCall.java +++ b/solr/core/src/java/org/apache/solr/servlet/CoordinatorHttpSolrCall.java @@ -33,7 +33,7 @@ import org.apache.solr.core.CoreContainer; import org.apache.solr.core.CoreDescriptor; import org.apache.solr.core.SolrCore; -import org.apache.solr.core.SolrCoreProxy; +import org.apache.solr.core.SyntheticSolrCore; import org.apache.solr.request.DelegatingSolrQueryRequest; import org.apache.solr.request.SolrQueryRequest; import org.slf4j.Logger; @@ -87,8 +87,8 @@ public static SolrCore getCore( String syntheticCollectionName = getSyntheticCollectionName(confName); CoreContainer coreContainer = solrCall.cores; - SolrCoreProxy syntheticCore = - SolrCoreProxy.createAndRegisterProxy( + SyntheticSolrCore syntheticCore = + SyntheticSolrCore.createAndRegisterCore( coreContainer, syntheticCollectionName, coll.getConfigName()); // after this point the sync core should be available in the container. Double check