Skip to content

Commit

Permalink
Experimental QA core as proxy in memory
Browse files Browse the repository at this point in the history
  • Loading branch information
patsonluk committed Feb 24, 2024
1 parent e51143c commit 7141ef4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions solr/core/src/java/org/apache/solr/core/ConfigSetService.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,19 @@ public boolean isConfigSetTrusted(SolrResourceLoader coreLoader) throws IOExcept
return (flags == null || flags.get("trusted") == null || flags.getBooleanArg("trusted"));
}

public final ConfigSet loadConfigSet(CoreDescriptor dcore) {
return loadConfigSet(dcore, null);
}

/**
* Load the ConfigSet for a core
*
* @param dcore the core's CoreDescriptor
* @return a ConfigSet
*/
public final ConfigSet loadConfigSet(CoreDescriptor dcore) {
public final ConfigSet loadConfigSet(CoreDescriptor dcore, String configSetName) {

SolrResourceLoader coreLoader = createCoreResourceLoader(dcore);
SolrResourceLoader coreLoader = configSetName != null ? createConfigSetResourceLoader(dcore, configSetName) : createCoreResourceLoader(dcore);

try {
// ConfigSet properties are loaded from ConfigSetProperties.DEFAULT_FILENAME file.
Expand Down Expand Up @@ -391,6 +395,9 @@ protected NamedList<Object> loadConfigSetFlags(SolrResourceLoader loader) throws
*/
protected abstract SolrResourceLoader createCoreResourceLoader(CoreDescriptor cd);

protected SolrResourceLoader createConfigSetResourceLoader(CoreDescriptor cd, String configSetName) {
throw new UnsupportedOperationException("Not supported");
}
/**
* Return a name for the ConfigSet for a core to be used for printing/diagnostic purposes.
*
Expand Down
3 changes: 2 additions & 1 deletion solr/core/src/java/org/apache/solr/core/CoreContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,8 @@ public CoresLocator getCoresLocator() {
return coresLocator;
}

protected SolrCore registerCore(
//TODO was protected, should go with new class approach
public SolrCore registerCore(
CoreDescriptor cd, SolrCore core, boolean registerInZk, boolean skipRecovery) {
if (core == null) {
throw new RuntimeException("Can not register a null core.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.apache.solr.common.params.CoreAdminParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.Utils;
import org.apache.solr.core.ConfigSet;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.CoreDescriptor;
import org.apache.solr.core.SolrCore;
Expand Down Expand Up @@ -103,7 +104,12 @@ public static SolrCore getCore(
Paths.get(coreContainer.getSolrHome() + "/" + collectionName),
coreProps, coreContainer.getContainerProperties(), coreContainer.getZkController());

SolrCore syntheticCore = coreContainer.createFromDescriptor(syntheticCoreDescriptor, false, false);

ConfigSet coreConfig = coreContainer.getConfigSetService().loadConfigSet(syntheticCoreDescriptor, confName);
syntheticCoreDescriptor.setConfigSetTrusted(coreConfig.isTrusted());
SolrCore syntheticCore = new SolrCore(coreContainer, syntheticCoreDescriptor, coreConfig);

coreContainer.registerCore(syntheticCoreDescriptor, syntheticCore, false, false);

//after this point the sync core should be available in the container. Double check
if (coreContainer.getCore(syntheticCore.getName()) != null) {
Expand Down

0 comments on commit 7141ef4

Please sign in to comment.