SOLR-14750: TestBulkSchemaConcurrent fails often(#1760)

This commit is contained in:
Noble Paul 2020-08-19 10:52:12 +10:00 committed by GitHub
parent 16ab243759
commit 8caf57d50b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 16 deletions

View File

@ -81,8 +81,8 @@ public abstract class ConfigSetService {
) ? false: true; ) ? false: true;
SolrConfig solrConfig = createSolrConfig(dcore, coreLoader, trusted); SolrConfig solrConfig = createSolrConfig(dcore, coreLoader, trusted);
ConfigSet.SchemaSupplier schema = force -> createIndexSchema(dcore, solrConfig, force); IndexSchema indexSchema = createIndexSchema(dcore, solrConfig, false);
return new ConfigSet(configSetName(dcore), solrConfig, schema, properties, trusted); return new ConfigSet(configSetName(dcore), solrConfig, force -> indexSchema, properties, trusted);
} catch (Exception e) { } catch (Exception e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"Could not load conf for core " + dcore.getName() + "Could not load conf for core " + dcore.getName() +
@ -135,7 +135,6 @@ public abstract class ConfigSetService {
if (modVersion != null) { if (modVersion != null) {
// note: luceneMatchVersion influences the schema // note: luceneMatchVersion influences the schema
String cacheKey = configSet + "/" + guessSchemaName + "/" + modVersion + "/" + solrConfig.luceneMatchVersion; String cacheKey = configSet + "/" + guessSchemaName + "/" + modVersion + "/" + solrConfig.luceneMatchVersion;
if(forceFetch) schemaCache.invalidate(cacheKey);
return schemaCache.get(cacheKey, return schemaCache.get(cacheKey,
(key) -> indexSchemaFactory.create(cdSchemaName, solrConfig)); (key) -> indexSchemaFactory.create(cdSchemaName, solrConfig));
} else { } else {

View File

@ -944,10 +944,9 @@ public final class SolrCore implements SolrInfoBean, Closeable {
this.solrConfig = configSet.getSolrConfig(); this.solrConfig = configSet.getSolrConfig();
this.resourceLoader = configSet.getSolrConfig().getResourceLoader(); this.resourceLoader = configSet.getSolrConfig().getResourceLoader();
this.resourceLoader.core = this;
schemaPluginsLoader = new PackageListeningClassLoader(coreContainer, resourceLoader, schemaPluginsLoader = new PackageListeningClassLoader(coreContainer, resourceLoader,
solrConfig::maxPackageVersion, solrConfig::maxPackageVersion,
() -> setLatestSchema(configSet.getIndexSchema(true))); () -> setLatestSchema(configSet.getIndexSchema()));
this.packageListeners.addListener(schemaPluginsLoader); this.packageListeners.addListener(schemaPluginsLoader);
IndexSchema schema = configSet.getIndexSchema(); IndexSchema schema = configSet.getIndexSchema();

View File

@ -76,11 +76,7 @@ public class SolrResourceLoader implements ResourceLoader, Closeable, SolrClassL
protected URLClassLoader classLoader; protected URLClassLoader classLoader;
private final Path instanceDir; private final Path instanceDir;
/**
* this is set by the {@link SolrCore}
* This could be null if the core is not yet initialized
*/
SolrCore core;
private final List<SolrCoreAware> waitingForCore = Collections.synchronizedList(new ArrayList<SolrCoreAware>()); private final List<SolrCoreAware> waitingForCore = Collections.synchronizedList(new ArrayList<SolrCoreAware>());
private final List<SolrInfoBean> infoMBeans = Collections.synchronizedList(new ArrayList<SolrInfoBean>()); private final List<SolrInfoBean> infoMBeans = Collections.synchronizedList(new ArrayList<SolrInfoBean>());
@ -204,11 +200,6 @@ public class SolrResourceLoader implements ResourceLoader, Closeable, SolrClassL
TokenizerFactory.reloadTokenizers(this.classLoader); TokenizerFactory.reloadTokenizers(this.classLoader);
} }
public SolrCore getCore(){
return core;
}
private static URLClassLoader addURLsToClassLoader(final URLClassLoader oldLoader, List<URL> urls) { private static URLClassLoader addURLsToClassLoader(final URLClassLoader oldLoader, List<URL> urls) {
if (urls.size() == 0) { if (urls.size() == 0) {
return oldLoader; return oldLoader;

View File

@ -190,7 +190,7 @@ public class IndexSchema {
protected IndexSchema(Version luceneVersion, SolrResourceLoader loader, Properties substitutableProperties) { protected IndexSchema(Version luceneVersion, SolrResourceLoader loader, Properties substitutableProperties) {
this.luceneVersion = Objects.requireNonNull(luceneVersion); this.luceneVersion = Objects.requireNonNull(luceneVersion);
this.loader = loader; this.loader = loader;
this.solrClassLoader = loader.getCore() == null? loader: loader.getCore().getSchemaPluginsLoader(); this.solrClassLoader = loader;//loader.getCore() == null? loader: loader.getCore().getSchemaPluginsLoader();
this.substitutableProperties = substitutableProperties; this.substitutableProperties = substitutableProperties;
} }

View File

@ -63,6 +63,7 @@ import org.apache.solr.util.plugin.SolrCoreAware;
import org.apache.zookeeper.data.Stat; import org.apache.zookeeper.data.Stat;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import static org.apache.solr.common.cloud.ZkStateReader.SOLR_PKGS_PATH; import static org.apache.solr.common.cloud.ZkStateReader.SOLR_PKGS_PATH;
@ -639,6 +640,7 @@ public class TestPackages extends SolrCloudTestCase {
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@Ignore("SOLR-14750")
public void testSchemaPlugins() throws Exception { public void testSchemaPlugins() throws Exception {
String COLLECTION_NAME = "testSchemaLoadingColl"; String COLLECTION_NAME = "testSchemaLoadingColl";
System.setProperty("managed.schema.mutable", "true"); System.setProperty("managed.schema.mutable", "true");