Skip to content

Apache Lucene open-source search software

SOLR-14040: shareSchema support for SolrCloud

David Smileyab924fd4ea1b
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 02d730efc1c..dfb1986d269 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -197,14 +197,16 @@ Improvements
* SOLR-14154: Return correct isolation level when retrieving it from the SQL Connection (Nick Vercammen, Kevin Risden)
+Optimizations
+---------------------
+
* SOLR-13890: Add "top-level" DV implementation for {!terms} queries. This approach tends to be more efficient for
queries with very large numbers of terms. The new implementation is used by default for method=docValuesTermsFilter
terms queries that are searching 500 or more terms. Users wishing to ignore this heuristic can choose the
docValuesTermsFilterTopLevel or docValuesTermsFilterPerSegment methods directly. (Jason Gerlowski, Joel Bernstein, David Smiley)
-Optimizations
----------------------
-(No changes)
+* SOLR-14040: The shareSchema solr.xml option now supports SolrCloud. shareSchema is useful when you have many
+ cores per node and large schemas. (David Smiley)
Bug Fixes
---------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/CloudConfigSetService.java b/solr/core/src/java/org/apache/solr/cloud/CloudConfigSetService.java
index 29f665cb160..b229b5a9c87 100644
--- a/solr/core/src/java/org/apache/solr/cloud/CloudConfigSetService.java
+++ b/solr/core/src/java/org/apache/solr/cloud/CloudConfigSetService.java
@@ -18,53 +18,69 @@ package org.apache.solr.cloud;
import java.lang.invoke.MethodHandles;
-import org.apache.solr.cloud.api.collections.CreateCollectionCmd;
import org.apache.solr.common.SolrException;
-import org.apache.solr.common.cloud.ZkStateReader;
-import org.apache.solr.common.cloud.ZooKeeperException;
+import org.apache.solr.common.cloud.ZkConfigManager;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.core.ConfigSetProperties;
import org.apache.solr.core.ConfigSetService;
import org.apache.solr.core.CoreDescriptor;
+import org.apache.solr.core.SolrConfig;
import org.apache.solr.core.SolrResourceLoader;
import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * SolrCloud ConfigSetService impl.
+ */
public class CloudConfigSetService extends ConfigSetService {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private final ZkController zkController;
- public CloudConfigSetService(SolrResourceLoader loader, ZkController zkController) {
- super(loader);
+ public CloudConfigSetService(SolrResourceLoader loader, boolean shareSchema, ZkController zkController) {
+ super(loader, shareSchema);
this.zkController = zkController;
}
@Override
public SolrResourceLoader createCoreResourceLoader(CoreDescriptor cd) {
+ return new ZkSolrResourceLoader(cd.getInstanceDir(), cd.getConfigSet(), parentLoader.getClassLoader(),
+ cd.getSubstitutableProperties(), zkController);
+ }
+
+ @Override
+ protected NamedList loadConfigSetFlags(CoreDescriptor cd, SolrResourceLoader loader) {
try {
- // for back compat with cores that can create collections without the collections API
- if (!zkController.getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + cd.getCollectionName(), true)) {
- CreateCollectionCmd.createCollectionZkNode(zkController.getSolrCloudManager().getDistribStateManager(), cd.getCollectionName(), cd.getCloudDescriptor().getParams());
- }
+ return ConfigSetProperties.readFromResourceLoader(loader, ".");
+ } catch (Exception ex) {
+ log.debug("No configSet flags", ex);
+ return null;
+ }
+ }
+
+ @Override
+ protected Long getCurrentSchemaModificationVersion(String configSet, SolrConfig solrConfig, String schemaFile) {
+ String zkPath = ZkConfigManager.CONFIGS_ZKNODE + "/" + configSet + "/" + schemaFile;
+ Stat stat;
+ try {
+ stat = zkController.getZkClient().exists(zkPath, null, true);
} catch (KeeperException e) {
- SolrException.log(log, null, e);
+ log.warn("Unexpected exception when getting modification time of " + zkPath, e);
+ return null; // debatable; we'll see an error soon if there's a real problem
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
- SolrException.log(log, null, e);
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
}
-
- String configName;
- try {
- configName = zkController.getZkStateReader().readConfigName(cd.getCollectionName());
- } catch (KeeperException ex) {
- throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "Specified config does not exist in ZooKeeper: " + cd.getCollectionName());
+ if (stat == null) { // not found
+ return null;
}
- return new ZkSolrResourceLoader(cd.getInstanceDir(), configName, parentLoader.getClassLoader(),
- cd.getSubstitutableProperties(), zkController);
+ return (long) stat.getVersion();
}
@Override
- public String configName(CoreDescriptor cd) {
- return "collection " + cd.getCloudDescriptor().getCollectionName();
+ public String configSetName(CoreDescriptor cd) {
+ return "configset " + cd.getConfigSet();
}
}
diff --git a/solr/core/src/java/org/apache/solr/cloud/CloudDescriptor.java b/solr/core/src/java/org/apache/solr/cloud/CloudDescriptor.java
index 068191eb5fe..2396038b160 100644
--- a/solr/core/src/java/org/apache/solr/cloud/CloudDescriptor.java
+++ b/solr/core/src/java/org/apache/solr/cloud/CloudDescriptor.java
@@ -20,16 +20,24 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
+import com.google.common.base.Strings;
+import org.apache.solr.common.SolrException;
import org.apache.solr.common.StringUtils;
import org.apache.solr.common.cloud.Replica;
+import org.apache.solr.common.cloud.ZooKeeperException;
import org.apache.solr.core.CoreDescriptor;
import org.apache.solr.util.PropertiesUtil;
+import org.apache.zookeeper.KeeperException;
-import com.google.common.base.Strings;
+import static org.apache.solr.core.CoreDescriptor.CORE_CONFIGSET;
+/**
+ * SolrCloud metadata attached to a {@link CoreDescriptor}.
+ */
public class CloudDescriptor {
- private final CoreDescriptor cd;
+ private final CoreDescriptor cd; // back-reference
+
private String shardId;
private String collectionName;
private String roles = null;
@@ -53,7 +61,7 @@ public class CloudDescriptor {
*/
private final Replica.Type replicaType;
- public CloudDescriptor(String coreName, Properties props, CoreDescriptor cd) {
+ public CloudDescriptor(CoreDescriptor cd, String coreName, Properties props, ZkController zkController) {
this.cd = cd;
this.shardId = props.getProperty(CoreDescriptor.CORE_SHARD, null);
if (Strings.isNullOrEmpty(shardId))
@@ -76,6 +84,19 @@ public class CloudDescriptor {
collectionParams.put(propName.substring(ZkController.COLLECTION_PARAM_PREFIX.length()), props.getProperty(propName));
}
}
+ // The configSet comes from ZK, not from CD's properties like it does in standalone.
+ // But we want to put it on CD because CD has getConfigSet() which is sensible; don't want that to return null.
+ if (zkController != null) { // there's a test where we pass null 'cause it wanted a dummy instance. Yuck?
+ try {
+ //TODO readConfigName() also validates the configSet exists but seems needless. We'll get errors soon enough.
+ String configSetName = zkController.getZkStateReader().readConfigName(collectionName);
+ props.setProperty(CORE_CONFIGSET, configSetName);
+ //noinspection StringEquality
+ assert cd.getConfigSet() == configSetName;
+ } catch (KeeperException ex) {
+ throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "Trouble resolving configSet for collection " + collectionName + ": " + ex.getMessage());
+ }
+ }
}
public boolean requiresTransactionLog() {
diff --git a/solr/core/src/java/org/apache/solr/core/ConfigSet.java b/solr/core/src/java/org/apache/solr/core/ConfigSet.java
index e0c9fe44def..671f81a9052 100644
--- a/solr/core/src/java/org/apache/solr/core/ConfigSet.java
+++ b/solr/core/src/java/org/apache/solr/core/ConfigSet.java
@@ -20,7 +20,9 @@ import org.apache.solr.common.util.NamedList;
import org.apache.solr.schema.IndexSchema;
/**
- * Stores a core's configuration in the form of a SolrConfig and IndexSchema
+ * Stores a core's configuration in the form of a SolrConfig and IndexSchema.
+ * Immutable.
+ * @see ConfigSetService
*/
public class ConfigSet {
diff --git a/solr/core/src/java/org/apache/solr/core/ConfigSetProperties.java b/solr/core/src/java/org/apache/solr/core/ConfigSetProperties.java
index 703fc09722d..dd624424c64 100644
--- a/solr/core/src/java/org/apache/solr/core/ConfigSetProperties.java
+++ b/solr/core/src/java/org/apache/solr/core/ConfigSetProperties.java
@@ -30,7 +30,14 @@ import org.slf4j.LoggerFactory;
import static org.apache.solr.common.util.Utils.fromJSON;
-
+/**
+ * Utility methods for reading configSet properties.
+ * One purpose of this notion is to express immutability.
+ * The contents are not used within the config itself; do not confuse this with config user-defined properties.
+ * The properties are stored as a JSON file within the configSet that we read into a NamedList.
+ * It's optional; there is no file if there are no properties.
+ * Note that this logic is also used to load configSet <em>flags</em>; see {@link ConfigSetService}.
+ */
public class ConfigSetProperties {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -50,7 +57,7 @@ public class ConfigSetProperties {
try {
reader = new InputStreamReader(loader.openResource(name), StandardCharsets.UTF_8);
} catch (SolrResourceNotFoundException ex) {
- log.debug("Did not find ConfigSet properties, assuming default properties: " + ex.getMessage());
+ log.debug("Did not find ConfigSet properties, assuming default properties: {}", ex.getMessage());
return null;
} catch (Exception ex) {
throw new SolrException(ErrorCode.SERVER_ERROR, "Unable to load reader for ConfigSet properties: " + name, ex);
diff --git a/solr/core/src/java/org/apache/solr/core/ConfigSetService.java b/solr/core/src/java/org/apache/solr/core/ConfigSetService.java
index bc0d4a948f1..f165376328b 100644
--- a/solr/core/src/java/org/apache/solr/core/ConfigSetService.java
+++ b/solr/core/src/java/org/apache/solr/core/ConfigSetService.java
@@ -16,17 +16,15 @@
*/
package org.apache.solr.core;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.time.Instant;
-import java.util.Locale;
-import java.util.concurrent.ExecutionException;
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
+import com.github.benmanes.caffeine.cache.Cache;
+import com.github.benmanes.caffeine.cache.Caffeine;
import org.apache.solr.cloud.CloudConfigSetService;
import org.apache.solr.cloud.ZkController;
import org.apache.solr.cloud.ZkSolrResourceLoader;
@@ -44,41 +42,35 @@ import org.slf4j.LoggerFactory;
public abstract class ConfigSetService {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- public static ConfigSetService createConfigSetService(NodeConfig nodeConfig, SolrResourceLoader loader, ZkController zkController) {
- if (zkController != null)
- return new CloudConfigSetService(loader, zkController);
-
- if (nodeConfig.hasSchemaCache())
- return new SchemaCaching(loader, nodeConfig.getConfigSetBaseDirectory());
- return new Default(loader, nodeConfig.getConfigSetBaseDirectory());
+ public static ConfigSetService createConfigSetService(NodeConfig nodeConfig, SolrResourceLoader loader, ZkController zkController) {
+ if (zkController == null) {
+ return new Standalone(loader, nodeConfig.hasSchemaCache(), nodeConfig.getConfigSetBaseDirectory());
+ } else {
+ return new CloudConfigSetService(loader, nodeConfig.hasSchemaCache(), zkController);
+ }
}
protected final SolrResourceLoader parentLoader;
- /**
- * Create a new ConfigSetService
- * @param loader the CoreContainer's resource loader
- */
- public ConfigSetService(SolrResourceLoader loader) {
- this.parentLoader = loader;
- }
+ /** Optional cache of schemas, key'ed by a bunch of concatenated things */
+ private final Cache<String, IndexSchema> schemaCache;
/**
* Load the ConfigSet for a core
* @param dcore the core's CoreDescriptor
* @return a ConfigSet
*/
- public final ConfigSet getConfig(CoreDescriptor dcore) {
+ public final ConfigSet loadConfigSet(CoreDescriptor dcore) {
SolrResourceLoader coreLoader = createCoreResourceLoader(dcore);
try {
// ConfigSet properties are loaded from ConfigSetProperties.DEFAULT_FILENAME file.
+ NamedList properties = loadConfigSetProperties(dcore, coreLoader);
// ConfigSet flags are loaded from the metadata of the ZK node of the configset.
- NamedList properties = createConfigSetProperties(dcore, coreLoader);
- NamedList flags = getConfigSetFlags(dcore, coreLoader);
+ NamedList flags = loadConfigSetFlags(dcore, coreLoader);
boolean trusted =
(coreLoader instanceof ZkSolrResourceLoader
@@ -89,7 +81,7 @@ public abstract class ConfigSetService {
SolrConfig solrConfig = createSolrConfig(dcore, coreLoader, trusted);
IndexSchema schema = createIndexSchema(dcore, solrConfig);
- return new ConfigSet(configName(dcore), solrConfig, schema, properties, trusted);
+ return new ConfigSet(configSetName(dcore), solrConfig, schema, properties, trusted);
} catch (Exception e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"Could not load conf for core " + dcore.getName() +
@@ -98,6 +90,16 @@ public abstract class ConfigSetService {
}
+ /**
+ * Create a new ConfigSetService
+ * @param loader the CoreContainer's resource loader
+ * @param shareSchema should we share the IndexSchema among cores of same config?
+ */
+ public ConfigSetService(SolrResourceLoader loader, boolean shareSchema) {
+ this.parentLoader = loader;
+ this.schemaCache = shareSchema ? Caffeine.newBuilder().weakValues().build() : null;
+ }
+
/**
* Create a SolrConfig object for a core
* @param cd the core's CoreDescriptor
@@ -110,35 +112,62 @@ public abstract class ConfigSetService {
}
/**
- * Create an IndexSchema object for a core
+ * Create an IndexSchema object for a core. It might be a cached lookup.
* @param cd the core's CoreDescriptor
* @param solrConfig the core's SolrConfig
* @return an IndexSchema
*/
protected IndexSchema createIndexSchema(CoreDescriptor cd, SolrConfig solrConfig) {
- return IndexSchemaFactory.buildIndexSchema(cd.getSchemaName(), solrConfig);
+ // This is the schema name from the core descriptor. Sometimes users specify a custom schema file.
+ // Important: indexSchemaFactory.create wants this!
+ String cdSchemaName = cd.getSchemaName();
+ // This is the schema name that we think will actually be used. In the case of a managed schema,
+ // we don't know for sure without examining what files exists in the configSet, and we don't
+ // want to pay the overhead of that at this juncture. If we guess wrong, no schema sharing.
+ // The fix is usually to name your schema managed-schema instead of schema.xml.
+ IndexSchemaFactory indexSchemaFactory = IndexSchemaFactory.newIndexSchemaFactory(solrConfig);
+ String guessSchemaName = indexSchemaFactory.getSchemaResourceName(cdSchemaName);
+
+ String configSet = cd.getConfigSet();
+ if (configSet != null && schemaCache != null) {
+ Long modVersion = getCurrentSchemaModificationVersion(configSet, solrConfig, guessSchemaName);
+ if (modVersion != null) {
+ // note: luceneMatchVersion influences the schema
+ String cacheKey = configSet + "/" + guessSchemaName + "/" + modVersion + "/" + solrConfig.luceneMatchVersion;
+ return schemaCache.get(cacheKey,
+ (key) -> indexSchemaFactory.create(cdSchemaName, solrConfig));
+ } else {
+ log.warn("Unable to get schema modification version, configSet={} schema={}", configSet, guessSchemaName);
+ // see explanation above; "guessSchema" is a guess
+ }
+ }
+
+ return indexSchemaFactory.create(cdSchemaName, solrConfig);
}
/**
- * Return the ConfigSet properties
+ * Returns a modification version for the schema file.
+ * Null may be returned if not known, and if so it defeats schema caching.
+ */
+ protected abstract Long getCurrentSchemaModificationVersion(String configSet, SolrConfig solrConfig, String schemaFile);
+
+ /**
+ * Return the ConfigSet properties or null if none.
+ * @see ConfigSetProperties
* @param cd the core's CoreDescriptor
* @param loader the core's resource loader
* @return the ConfigSet properties
*/
- protected NamedList createConfigSetProperties(CoreDescriptor cd, SolrResourceLoader loader) {
+ protected NamedList loadConfigSetProperties(CoreDescriptor cd, SolrResourceLoader loader) {
return ConfigSetProperties.readFromResourceLoader(loader, cd.getConfigSetPropertiesName());
}
- protected NamedList getConfigSetFlags(CoreDescriptor cd, SolrResourceLoader loader) {
- if (loader instanceof ZkSolrResourceLoader) {
- try {
- return ConfigSetProperties.readFromResourceLoader(loader, ".");
- } catch (Exception ex) {
- return null;
- }
- } else {
- return null;
- }
+ /**
+ * Return the ConfigSet flags or null if none.
+ */
+ // TODO should fold into configSetProps -- SOLR-14059
+ protected NamedList loadConfigSetFlags(CoreDescriptor cd, SolrResourceLoader loader) {
+ return null;
}
/**
@@ -149,31 +178,26 @@ public abstract class ConfigSetService {
protected abstract SolrResourceLoader createCoreResourceLoader(CoreDescriptor cd);
/**
- * Return a name for the ConfigSet for a core
+ * Return a name for the ConfigSet for a core to be used for printing/diagnostic purposes.
* @param cd the core's CoreDescriptor
* @return a name for the core's ConfigSet
*/
- public abstract String configName(CoreDescriptor cd);
+ public abstract String configSetName(CoreDescriptor cd);
/**
- * The default ConfigSetService.
+ * The Solr standalone version of ConfigSetService.
*
* Loads a ConfigSet defined by the core's configSet property,
* looking for a directory named for the configSet property value underneath
* a base directory. If no configSet property is set, loads the ConfigSet
* instead from the core's instance directory.
*/
- public static class Default extends ConfigSetService {
+ public static class Standalone extends ConfigSetService {
private final Path configSetBase;
- /**
- * Create a new ConfigSetService.Default
- * @param loader the CoreContainer's resource loader
- * @param configSetBase the base directory under which to look for config set directories
- */
- public Default(SolrResourceLoader loader, Path configSetBase) {
- super(loader);
+ public Standalone(SolrResourceLoader loader, boolean shareSchema, Path configSetBase) {
+ super(loader, shareSchema);
this.configSetBase = configSetBase;
}
@@ -184,7 +208,7 @@ public abstract class ConfigSetService {
}
@Override
- public String configName(CoreDescriptor cd) {
+ public String configSetName(CoreDescriptor cd) {
return (cd.getConfigSet() == null ? "instancedir " : "configset ") + locateInstanceDir(cd);
}
@@ -199,46 +223,19 @@ public abstract class ConfigSetService {
return configSetDirectory;
}
- }
-
- /**
- * A ConfigSetService that shares schema objects between cores
- */
- public static class SchemaCaching extends Default {
-
- private final Cache<String, IndexSchema> schemaCache = CacheBuilder.newBuilder().build();
-
- public SchemaCaching(SolrResourceLoader loader, Path configSetBase) {
- super(loader, configSetBase);
- }
-
- public static String cacheName(Path schemaFile) throws IOException {
- long lastModified = Files.getLastModifiedTime(schemaFile).toMillis();
- return String.format(Locale.ROOT, "%s:%s",
- schemaFile.toString(), Instant.ofEpochMilli(lastModified).toString());
- }
-
@Override
- public IndexSchema createIndexSchema(final CoreDescriptor cd, final SolrConfig solrConfig) {
- final String resourceNameToBeUsed = IndexSchemaFactory.getResourceNameToBeUsed(cd.getSchemaName(), solrConfig);
- Path schemaFile = Paths.get(solrConfig.getResourceLoader().getConfigDir()).resolve(resourceNameToBeUsed);
- if (Files.exists(schemaFile)) {
- try {
- String cachedName = cacheName(schemaFile);
- return schemaCache.get(cachedName, () -> {
- log.info("Creating new index schema for core {}", cd.getName());
- return IndexSchemaFactory.buildIndexSchema(cd.getSchemaName(), solrConfig);
- });
- } catch (ExecutionException e) {
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
- "Error creating index schema for core " + cd.getName(), e);
- } catch (IOException e) {
- log.warn("Couldn't get last modified time for schema file {}: {}", schemaFile, e.getMessage());
- log.warn("Will not use schema cache");
- }
+ protected Long getCurrentSchemaModificationVersion(String configSet, SolrConfig solrConfig, String schemaFileName) {
+ Path schemaFile = Paths.get(solrConfig.getResourceLoader().getConfigDir()).resolve(schemaFileName);
+ try {
+ return Files.getLastModifiedTime(schemaFile).toMillis();
+ } catch (FileNotFoundException e) {
+ return null; // acceptable
+ } catch (IOException e) {
+ log.warn("Unexpected exception when getting modification time of " + schemaFile, e);
+ return null; // debatable; we'll see an error soon if there's a real problem
}
- return IndexSchemaFactory.buildIndexSchema(cd.getSchemaName(), solrConfig);
}
+
}
}
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 b757edc3840..0039c07d670 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -1158,7 +1158,7 @@ public class CoreContainer {
*/
public SolrCore create(String coreName, Path instancePath, Map<String, String> parameters, boolean newCollection) {
- CoreDescriptor cd = new CoreDescriptor(coreName, instancePath, parameters, getContainerProperties(), isZooKeeperAware());
+ CoreDescriptor cd = new CoreDescriptor(coreName, instancePath, parameters, getContainerProperties(), getZkController());
// TODO: There's a race here, isn't there?
// Since the core descriptor is removed when a core is unloaded, it should never be anywhere when a core is created.
@@ -1272,7 +1272,7 @@ public class CoreContainer {
zkSys.getZkController().preRegister(dcore, publishState);
}
- ConfigSet coreConfig = getConfigSet(dcore);
+ ConfigSet coreConfig = coreConfigService.loadConfigSet(dcore);
dcore.setConfigSetTrusted(coreConfig.isTrusted());
log.info("Creating SolrCore '{}' using configuration from {}, trusted={}", dcore.getName(), coreConfig.getName(), dcore.isConfigSetTrusted());
try {
@@ -1318,16 +1318,12 @@ public class CoreContainer {
if (core != null) {
return core.getDirectoryFactory().isSharedStorage();
} else {
- ConfigSet configSet = getConfigSet(cd);
+ ConfigSet configSet = coreConfigService.loadConfigSet(cd);
return DirectoryFactory.loadDirectoryFactory(configSet.getSolrConfig(), this, null).isSharedStorage();
}
}
}
- private ConfigSet getConfigSet(CoreDescriptor cd) {
- return coreConfigService.getConfig(cd);
- }
-
/**
* Take action when we failed to create a SolrCore. If error is due to corrupt index, try to recover. Various recovery
* strategies can be specified via system properties "-DCoreInitFailedAction={fromleader, none}"
@@ -1530,7 +1526,7 @@ public class CoreContainer {
boolean success = false;
try {
solrCores.waitAddPendingCoreOps(cd.getName());
- ConfigSet coreConfig = coreConfigService.getConfig(cd);
+ ConfigSet coreConfig = coreConfigService.loadConfigSet(cd);
log.info("Reloading SolrCore '{}' using configuration from {}", cd.getName(), coreConfig.getName());
newCore = core.reload(coreConfig);
diff --git a/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java b/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
index ac5923602b1..7deab728189 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
@@ -24,7 +24,6 @@ import java.lang.invoke.MethodHandles;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
@@ -34,13 +33,17 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.solr.cloud.CloudDescriptor;
+import org.apache.solr.cloud.ZkController;
import org.apache.solr.common.SolrException;
import org.apache.solr.util.PropertiesUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * A Solr core descriptor
+ * Metadata about a {@link SolrCore}.
+ * It's mostly loaded from a file on disk at the very beginning of loading a core.
+ *
+ * It's mostly but not completely immutable; we should fix this!
*
* @since solr 1.3
*/
@@ -137,9 +140,9 @@ public class CoreDescriptor {
/** The properties for this core, substitutable by resource loaders */
protected final Properties substitutableProperties = new Properties();
- public CoreDescriptor(String name, Path instanceDir, Properties containerProperties,
- boolean isZooKeeperAware, String... properties) {
- this(name, instanceDir, toMap(properties), containerProperties, isZooKeeperAware);
+ /** TESTS ONLY */
+ public CoreDescriptor(String name, Path instanceDir, CoreContainer coreContainer, String... coreProps) {
+ this(name, instanceDir, toMap(coreProps), coreContainer.getContainerProperties(), coreContainer.getZkController());
}
private static Map<String, String> toMap(String... properties) {
@@ -151,18 +154,6 @@ public class CoreDescriptor {
return props;
}
- /**
- * Create a new CoreDescriptor with a given name and instancedir
- * @param name the CoreDescriptor's name
- * @param instanceDir the CoreDescriptor's instancedir
- * @param containerProperties the enclosing container properties for variable resolution
- * @param isZooKeeperAware whether we are part of SolrCloud or not.
- */
- public CoreDescriptor(String name, Path instanceDir,
- Properties containerProperties, boolean isZooKeeperAware) {
- this(name, instanceDir, Collections.emptyMap(), containerProperties, isZooKeeperAware);
- }
-
/**
* Create a new CoreDescriptor using the properties of an existing one
* @param coreName the new CoreDescriptor's name
@@ -187,12 +178,10 @@ public class CoreDescriptor {
* @param instanceDir a Path resolving to the instanceDir
* @param coreProps a Map of the properties for this core
* @param containerProperties the properties from the enclosing container.
- * @param isZooKeeperAware if true, we ar in SolrCloud mode.
+ * @param zkController the ZkController in SolrCloud mode, otherwise null.
*/
-
-
public CoreDescriptor(String name, Path instanceDir, Map<String, String> coreProps,
- Properties containerProperties, boolean isZooKeeperAware) {
+ Properties containerProperties, ZkController zkController) {
this.instanceDir = instanceDir;
originalCoreProperties.setProperty(CORE_NAME, name);
@@ -221,14 +210,12 @@ public class CoreDescriptor {
buildSubstitutableProperties();
// TODO maybe make this a CloudCoreDescriptor subclass?
- if (isZooKeeperAware) {
- cloudDesc = new CloudDescriptor(name, coreProperties, this);
- }
- else {
+ if (zkController != null) {
+ cloudDesc = new CloudDescriptor(this, name, coreProperties, zkController);
+ } else {
cloudDesc = null;
}
-
- log.debug("Created CoreDescriptor: " + coreProperties);
+ log.debug("Created CoreDescriptor: {}", coreProperties);
}
/**
@@ -315,7 +302,7 @@ public class CoreDescriptor {
return coreProperties.getProperty(CORE_CONFIG);
}
- /**@return the core schema resource name. */
+ /**@return the core schema resource name. Not actually used if schema is managed mode. */
public String getSchemaName() {
return coreProperties.getProperty(CORE_SCHEMA);
}
@@ -324,8 +311,9 @@ public class CoreDescriptor {
public String getName() {
return coreProperties.getProperty(CORE_NAME);
}
-
- public void setProperty(String prop, String val) {
+
+ /** TODO remove mutability */
+ void setProperty(String prop, String val) {
if (substitutableProperties.containsKey(prop)) {
substitutableProperties.setProperty(prop, val);
return;
@@ -379,6 +367,7 @@ public class CoreDescriptor {
}
public String getConfigSet() {
+ //TODO consider falling back on "collection.configName" ( CollectionAdminParams.COLL_CONF )
return coreProperties.getProperty(CORE_CONFIGSET);
}
@@ -390,6 +379,7 @@ public class CoreDescriptor {
return trustedConfigSet;
}
+ /** TODO remove mutability */
public void setConfigSetTrusted(boolean trusted) {
this.trustedConfigSet = trusted;
}
diff --git a/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java b/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java
index 76eb5c42f74..25447bff031 100644
--- a/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java
+++ b/solr/core/src/java/org/apache/solr/core/CorePropertiesLocator.java
@@ -185,7 +185,7 @@ public class CorePropertiesLocator implements CoresLocator {
for (String key : coreProperties.stringPropertyNames()) {
propMap.put(key, coreProperties.getProperty(key));
}
- CoreDescriptor ret = new CoreDescriptor(name, instanceDir, propMap, cc.getContainerProperties(), cc.isZooKeeperAware());
+ CoreDescriptor ret = new CoreDescriptor(name, instanceDir, propMap, cc.getContainerProperties(), cc.getZkController());
ret.loadExtraProperties();
return ret;
}
diff --git a/solr/core/src/java/org/apache/solr/schema/IndexSchemaFactory.java b/solr/core/src/java/org/apache/solr/schema/IndexSchemaFactory.java
index 4234ba1d844..7be2569998b 100644
--- a/solr/core/src/java/org/apache/solr/schema/IndexSchemaFactory.java
+++ b/solr/core/src/java/org/apache/solr/schema/IndexSchemaFactory.java
@@ -16,7 +16,6 @@
*/
package org.apache.solr.schema;
-import java.io.File;
import java.io.InputStream;
import java.lang.invoke.MethodHandles;
@@ -34,8 +33,38 @@ import org.xml.sax.InputSource;
/** Base class for factories for IndexSchema implementations */
public abstract class IndexSchemaFactory implements NamedListInitializedPlugin {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- /** Returns an index schema created from a local resource */
+
+ /** Instantiates the configured schema factory, then calls create on it. */
+ public static IndexSchema buildIndexSchema(String resourceName, SolrConfig config) {
+ return newIndexSchemaFactory(config).create(resourceName, config);
+ }
+
+ /** Instantiates us from {@link SolrConfig}. */
+ public static IndexSchemaFactory newIndexSchemaFactory(SolrConfig config) {
+ PluginInfo info = config.getPluginInfo(IndexSchemaFactory.class.getName());
+ IndexSchemaFactory factory;
+ if (null != info) {
+ factory = config.getResourceLoader().newInstance(info.className, IndexSchemaFactory.class);
+ factory.init(info.initArgs);
+ } else {
+ factory = config.getResourceLoader().newInstance(ManagedIndexSchemaFactory.class.getName(), IndexSchemaFactory.class);
+ }
+ return factory;
+ }
+
+ /**
+ * Returns the resource (file) name that will be used for the schema itself. The answer may be a guess.
+ * Do not pass the result of this to {@link #create(String, SolrConfig)}.
+ * The input is the name coming from the {@link org.apache.solr.core.CoreDescriptor}
+ * which acts as a default or asked-for name.
+ */
+ public String getSchemaResourceName(String cdResourceName) {
+ return cdResourceName;
+ }
+
+ /**
+ * Returns an index schema created from a local resource. The input is usually from the core descriptor.
+ */
public IndexSchema create(String resourceName, SolrConfig config) {
SolrResourceLoader loader = config.getResourceLoader();
InputStream schemaInputStream = null;
@@ -57,44 +86,4 @@ public abstract class IndexSchemaFactory implements NamedListInitializedPlugin {
return schema;
}
- /** Instantiates the configured schema factory, then calls create on it. */
- public static IndexSchema buildIndexSchema(String resourceName, SolrConfig config) {
- PluginInfo info = config.getPluginInfo(IndexSchemaFactory.class.getName());
- IndexSchemaFactory factory;
- if (null != info) {
- factory = config.getResourceLoader().newInstance(info.className, IndexSchemaFactory.class);
- factory.init(info.initArgs);
- } else {
- factory = config.getResourceLoader().newInstance(ManagedIndexSchemaFactory.class.getName(), IndexSchemaFactory.class);
- }
- IndexSchema schema = factory.create(resourceName, config);
- return schema;
- }
-
- /**
- * Returns the resource name that will be used: if the schema is managed, the resource
- * name will be drawn from the schema factory configuration in the given SolrConfig.
- * Otherwise, the given resourceName will be returned.
- *
- * @param resourceName The name to use if the schema is not managed
- * @param config The SolrConfig from which to get the schema factory config
- * @return If the schema is managed, the resource name from the given SolrConfig,
- * otherwise the given resourceName.
- */
- public static String getResourceNameToBeUsed(String resourceName, SolrConfig config) {
- PluginInfo info = config.getPluginInfo(IndexSchemaFactory.class.getName());
- final String nonManagedResourceName = null == resourceName ? IndexSchema.DEFAULT_SCHEMA_FILE : resourceName;
- if (null == info) {
- return nonManagedResourceName;
- }
- String managedSchemaResourceName
- = (String)info.initArgs.get(ManagedIndexSchemaFactory.MANAGED_SCHEMA_RESOURCE_NAME);
- if (null == managedSchemaResourceName) {
- managedSchemaResourceName = ManagedIndexSchemaFactory.DEFAULT_MANAGED_SCHEMA_RESOURCE_NAME;
- }
- if ((new File(config.getResourceLoader().getConfigDir(), managedSchemaResourceName)).exists()) {
- return managedSchemaResourceName;
- }
- return nonManagedResourceName;
- }
}
diff --git a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
index 494e574f96b..4a8a1023a1c 100644
--- a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
+++ b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
@@ -86,6 +86,11 @@ public class ManagedIndexSchemaFactory extends IndexSchemaFactory implements Sol
}
}
+ @Override
+ public String getSchemaResourceName(String cdResourceName) {
+ return managedSchemaResourceName; // actually a guess; reality depends on the actual files in the config set :-(
+ }
+
/**
* First, try to locate the managed schema file named in the managedSchemaResourceName
* param. If the managed schema file exists and is accessible, it is used to instantiate
diff --git a/solr/core/src/test-files/solr/conf/core.properties b/solr/core/src/test-files/solr/conf/core.properties
deleted file mode 100644
index 65df5e6114f..00000000000
--- a/solr/core/src/test-files/solr/conf/core.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-schema=schema-tiny.xml
-config=solrconfig-minimal.xml
-transient=true
-loadOnStartup=false
-
diff --git a/solr/core/src/test/org/apache/solr/cloud/ConfigSetsAPITest.java b/solr/core/src/test/org/apache/solr/cloud/ConfigSetsAPITest.java
index b7491343929..26d77b7bae7 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ConfigSetsAPITest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ConfigSetsAPITest.java
@@ -19,6 +19,10 @@ package org.apache.solr.cloud;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.ConfigSetAdminRequest;
import org.apache.solr.common.SolrException;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.core.SolrCore;
+import org.junit.After;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -26,14 +30,25 @@ public class ConfigSetsAPITest extends SolrCloudTestCase {
@BeforeClass
public static void setupCluster() throws Exception {
- configureCluster(1)
+ System.setProperty("shareSchema", "true"); // see testSharedSchema
+
+ configureCluster(1) // some tests here assume 1 node
.addConfig("conf1", TEST_PATH().resolve("configsets").resolve("cloud-minimal").resolve("conf"))
+ .addConfig("cShare", TEST_PATH().resolve("configsets").resolve("cloud-minimal").resolve("conf"))
.configure();
}
+ @After
+ public void doAfter() throws Exception {
+ cluster.deleteAllCollections();
+ }
+
+ @AfterClass
+ public static void doAfterClass() {
+ System.clearProperty("shareSchema");
+ }
@Test
public void testConfigSetDeleteWhenInUse() throws Exception {
-
CollectionAdminRequest.createCollection("test_configset_delete", "conf1", 1, 1)
.processAndWait(cluster.getSolrClient(), DEFAULT_TIMEOUT);
@@ -43,6 +58,35 @@ public class ConfigSetsAPITest extends SolrCloudTestCase {
expectThrows(SolrException.class, () -> {
deleteConfigRequest.process(cluster.getSolrClient());
});
+ }
+
+ @Test
+ public void testSharedSchema() throws Exception {
+ CollectionAdminRequest.createCollection("col1", "cShare", 1, 1)
+ .processAndWait(cluster.getSolrClient(), DEFAULT_TIMEOUT);
+ CollectionAdminRequest.createCollection("col2", "cShare", 1, 1)
+ .processAndWait(cluster.getSolrClient(), DEFAULT_TIMEOUT);
+ CollectionAdminRequest.createCollection("col3", "conf1", 1, 1)
+ .processAndWait(cluster.getSolrClient(), DEFAULT_TIMEOUT);
+
+ CoreContainer coreContainer = cluster.getJettySolrRunner(0).getCoreContainer();
+
+ try (SolrCore coreCol1 = coreContainer.getCore("col1_shard1_replica_n1");
+ SolrCore coreCol2 = coreContainer.getCore("col2_shard1_replica_n1");
+ SolrCore coreCol3 = coreContainer.getCore("col3_shard1_replica_n1")) {
+ assertSame(coreCol1.getLatestSchema(), coreCol2.getLatestSchema());
+ assertNotSame(coreCol1.getLatestSchema(), coreCol3.getLatestSchema());
+ }
+
+ // change col1's configSet
+ CollectionAdminRequest.modifyCollection("col1",
+ map("collection.configName", "conf1") // from cShare
+ ).processAndWait(cluster.getSolrClient(), DEFAULT_TIMEOUT);
+
+ try (SolrCore coreCol1 = coreContainer.getCore("col1_shard1_replica_n1");
+ SolrCore coreCol2 = coreContainer.getCore("col2_shard1_replica_n1")) {
+ assertNotSame(coreCol1.getLatestSchema(), coreCol2.getLatestSchema());
+ }
}
diff --git a/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java b/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java
index df478bc4a1c..8991b4f67b0 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java
@@ -23,10 +23,16 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.common.cloud.*;
+import org.apache.solr.common.cloud.ClusterProperties;
+import org.apache.solr.common.cloud.DocCollection;
+import org.apache.solr.common.cloud.SolrZkClient;
+import org.apache.solr.common.cloud.ZkConfigManager;
+import org.apache.solr.common.cloud.ZkNodeProps;
+import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.util.Utils;
import org.apache.solr.core.CloudConfig;
@@ -274,10 +280,11 @@ public class ZkControllerTest extends SolrTestCaseJ4 {
try {
server.run();
+ AtomicReference<ZkController> zkControllerRef = new AtomicReference<>();
cc = new MockCoreContainer() {
@Override
public List<CoreDescriptor> getCoreDescriptors() {
- CoreDescriptor descriptor = new CoreDescriptor(collectionName, TEST_PATH(), Collections.emptyMap(), new Properties(), true);
+ CoreDescriptor descriptor = new CoreDescriptor(collectionName, TEST_PATH(), Collections.emptyMap(), new Properties(), zkControllerRef.get());
// non-existent coreNodeName, this will cause zkController.publishAndWaitForDownStates to wait indefinitely
// when using coreNodeName but usage of core name alone will return immediately
descriptor.getCloudDescriptor().setCoreNodeName("core_node0");
@@ -296,6 +303,7 @@ public class ZkControllerTest extends SolrTestCaseJ4 {
return null;
}
});
+ zkControllerRef.set(zkController);
zkController.getZkClient().makePath(ZkStateReader.getCollectionPathRoot(collectionName), new byte[0], CreateMode.PERSISTENT, true);
diff --git a/solr/core/src/test/org/apache/solr/core/CoreSorterTest.java b/solr/core/src/test/org/apache/solr/core/CoreSorterTest.java
index 8ababe45d62..513903f4894 100644
--- a/solr/core/src/test/org/apache/solr/core/CoreSorterTest.java
+++ b/solr/core/src/test/org/apache/solr/core/CoreSorterTest.java
@@ -38,7 +38,8 @@ import org.apache.solr.util.MockCoreContainer;
import static java.util.stream.Collectors.toList;
import static org.apache.solr.core.CoreSorter.getShardName;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class CoreSorterTest extends SolrTestCaseJ4 {
Map<String, Boolean> nodes = new LinkedHashMap<>();
@@ -127,7 +128,7 @@ public class CoreSorterTest extends SolrTestCaseJ4 {
p.setProperty(CoreDescriptor.CORE_SHARD, "shard_" + slice);
p.setProperty(CoreDescriptor.CORE_COLLECTION, "coll_" + slice);
p.setProperty(CoreDescriptor.CORE_NODE_NAME, replicaName);
- cd = new CloudDescriptor(replicaName, p, null);
+ cd = new CloudDescriptor(null, replicaName, p, null);
}
@Override
diff --git a/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java b/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java
index 7936ef1a800..6e835180ca3 100755
--- a/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java
+++ b/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java
@@ -114,7 +114,7 @@ public class DirectoryFactoryTest extends SolrTestCase {
}
private void assertDataHome(String expected, String instanceDir, DirectoryFactory df, CoreContainer cc, String... properties) throws IOException {
- String dataHome = df.getDataHome(new CoreDescriptor("core_name", Paths.get(instanceDir), cc.containerProperties, cc.isZooKeeperAware(), properties));
+ String dataHome = df.getDataHome(new CoreDescriptor("core_name", Paths.get(instanceDir), cc, properties));
assertEquals(Paths.get(expected).toAbsolutePath(), Paths.get(dataHome).toAbsolutePath());
}
diff --git a/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java b/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java
index a3daeb8caad..18a5f34d3ac 100644
--- a/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java
+++ b/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java
@@ -208,8 +208,7 @@ public class TestCodecSupport extends SolrTestCaseJ4 {
CoreContainer coreContainer = h.getCoreContainer();
try {
- CoreDescriptor cd = new CoreDescriptor(newCoreName, testSolrHome.resolve(newCoreName),
- coreContainer.getContainerProperties(), coreContainer.isZooKeeperAware());
+ CoreDescriptor cd = new CoreDescriptor(newCoreName, testSolrHome.resolve(newCoreName), coreContainer);
c = new SolrCore(coreContainer, cd,
new ConfigSet("fakeConfigset", config, schema, null, true));
assertNull(coreContainer.registerCore(cd, c, false, false));
diff --git a/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java b/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java
index 010727fe877..cb4ec021945 100644
--- a/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java
+++ b/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java
@@ -205,7 +205,7 @@ public class TestCoreContainer extends SolrTestCaseJ4 {
final CoreContainer cc = new CoreContainer(SolrXmlConfig.fromString(resourceLoader, CONFIGSETS_SOLR_XML), new Properties(), cl);
Path corePath = resourceLoader.getInstancePath().resolve("badcore");
- CoreDescriptor badcore = new CoreDescriptor("badcore", corePath, cc.getContainerProperties(), cc.isZooKeeperAware(),
+ CoreDescriptor badcore = new CoreDescriptor("badcore", corePath, cc,
"configSet", "nosuchconfigset");
cl.add(badcore);
@@ -455,10 +455,10 @@ public class TestCoreContainer extends SolrTestCaseJ4 {
System.setProperty("configsets", getFile("solr/configsets").getAbsolutePath());
final CoreContainer cc = new CoreContainer(SolrXmlConfig.fromString(resourceLoader, CONFIGSETS_SOLR_XML), new Properties(), cl);
- cl.add(new CoreDescriptor("col_ok", resourceLoader.getInstancePath().resolve("col_ok"),
- cc.getContainerProperties(), cc.isZooKeeperAware(), "configSet", "minimal"));
- cl.add(new CoreDescriptor("col_bad", resourceLoader.getInstancePath().resolve("col_bad"),
- cc.getContainerProperties(), cc.isZooKeeperAware(), "configSet", "bad-mergepolicy"));
+ cl.add(new CoreDescriptor("col_ok", resourceLoader.getInstancePath().resolve("col_ok"), cc,
+ "configSet", "minimal"));
+ cl.add(new CoreDescriptor("col_bad", resourceLoader.getInstancePath().resolve("col_bad"), cc,
+ "configSet", "bad-mergepolicy"));
cc.load();
// check that we have the cores we expect
diff --git a/solr/core/src/test/org/apache/solr/core/TestLazyCores.java b/solr/core/src/test/org/apache/solr/core/TestLazyCores.java
index 302fdc8b742..8b715572d82 100644
--- a/solr/core/src/test/org/apache/solr/core/TestLazyCores.java
+++ b/solr/core/src/test/org/apache/solr/core/TestLazyCores.java
@@ -60,7 +60,7 @@ public class TestLazyCores extends SolrTestCaseJ4 {
}
private static CoreDescriptor makeCoreDescriptor(CoreContainer cc, String coreName, String isTransient, String loadOnStartup) {
- return new CoreDescriptor(coreName, cc.getCoreRootDirectory().resolve(coreName), cc.getContainerProperties(), false,
+ return new CoreDescriptor(coreName, cc.getCoreRootDirectory().resolve(coreName), cc,
CoreDescriptor.CORE_TRANSIENT, isTransient,
CoreDescriptor.CORE_LOADONSTARTUP, loadOnStartup);
}
diff --git a/solr/core/src/test/org/apache/solr/util/MockCoreContainer.java b/solr/core/src/test/org/apache/solr/util/MockCoreContainer.java
index 5e8eab0f300..bdd72a51d0d 100644
--- a/solr/core/src/test/org/apache/solr/util/MockCoreContainer.java
+++ b/solr/core/src/test/org/apache/solr/util/MockCoreContainer.java
@@ -18,6 +18,7 @@ package org.apache.solr.util;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.Collections;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.CoreDescriptor;
@@ -26,7 +27,7 @@ import org.apache.solr.core.CoreDescriptor;
public class MockCoreContainer extends CoreContainer {
public static class MockCoreDescriptor extends CoreDescriptor {
public MockCoreDescriptor() {
- super("mock", Paths.get("path"), null, false);
+ super("mock", Paths.get("path"), Collections.emptyMap(), null, null);
}
}
diff --git a/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java b/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
index 1a23da8b640..5ec863abd00 100644
--- a/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
+++ b/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
@@ -228,8 +228,7 @@ public class TestHarness extends BaseTestHarness {
@Override
public List<CoreDescriptor> discover(CoreContainer cc) {
- return ImmutableList.of(new CoreDescriptor(coreName, cc.getCoreRootDirectory().resolve(coreName),
- cc.getContainerProperties(), cc.isZooKeeperAware(),
+ return ImmutableList.of(new CoreDescriptor(coreName, cc.getCoreRootDirectory().resolve(coreName), cc,
CoreDescriptor.CORE_DATADIR, dataDir,
CoreDescriptor.CORE_CONFIG, solrConfig,
CoreDescriptor.CORE_SCHEMA, schema,