SOLR-14151: Fixing TestBulkSchemaConcurrent failures

This commit is contained in:
noblepaul 2020-09-14 15:42:11 +10:00
parent 647bd5c59f
commit cc31e23341
1 changed files with 8 additions and 5 deletions

View File

@ -30,6 +30,7 @@ public class ConfigSet {
private final String name; private final String name;
private final SolrConfig solrconfig; private final SolrConfig solrconfig;
private IndexSchema schema;
private final SchemaSupplier schemaSupplier; private final SchemaSupplier schemaSupplier;
@ -40,10 +41,11 @@ public class ConfigSet {
@SuppressWarnings({"rawtypes"}) @SuppressWarnings({"rawtypes"})
public ConfigSet(String name, SolrConfig solrConfig, SchemaSupplier indexSchemaSupplier, public ConfigSet(String name, SolrConfig solrConfig, SchemaSupplier indexSchemaSupplier,
NamedList properties, boolean trusted) { NamedList properties, boolean trusted) {
this.name = name; this.name = name;
this.solrconfig = solrConfig; this.solrconfig = solrConfig;
this.schemaSupplier = indexSchemaSupplier; this.schemaSupplier = indexSchemaSupplier;
schema = schemaSupplier.get(true);
this.properties = properties; this.properties = properties;
this.trusted = trusted; this.trusted = trusted;
} }
@ -61,17 +63,18 @@ public class ConfigSet {
* @param forceFetch get a fresh value and not cached value * @param forceFetch get a fresh value and not cached value
*/ */
public IndexSchema getIndexSchema(boolean forceFetch) { public IndexSchema getIndexSchema(boolean forceFetch) {
return schemaSupplier.get(forceFetch); if(forceFetch) schema = schemaSupplier.get(true);
return schema;
} }
public IndexSchema getIndexSchema() { public IndexSchema getIndexSchema() {
return schemaSupplier.get(false); return schema;
} }
@SuppressWarnings({"rawtypes"}) @SuppressWarnings({"rawtypes"})
public NamedList getProperties() { public NamedList getProperties() {
return properties; return properties;
} }
public boolean isTrusted() { public boolean isTrusted() {
return trusted; return trusted;
} }
@ -82,7 +85,7 @@ public class ConfigSet {
* So, we may not be able to update the core if we the schema classes are updated * So, we may not be able to update the core if we the schema classes are updated
* */ * */
interface SchemaSupplier { interface SchemaSupplier {
IndexSchema get(boolean forceFetch); IndexSchema get(boolean forceFetch);
} }
} }