Skip to content

Apache Lucene open-source search software

SOLR-9554: fix NullPointerException when cores move schema.xml to managed-schema concurrently. No new test added yet.

Mikhail Khludnev64b0c91df16b
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 371865bb81e..45a8c8bdcd5 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -138,6 +138,9 @@ Bug Fixes
* SOLR-9504: A replica with an empty index becomes the leader even when other more qualified replicas
are in line. (shalin)
+* SOLR-9554: Fix NullPointerException when cores are loaded in parallel and switch schema.xml to managed-scheme.
+ (Alan Woodward, Mikhail Khludnev)
+
Optimizations
----------------------
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 6140a0f9f08..66d947ea09b 100644
--- a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
+++ b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
@@ -152,6 +152,7 @@ public class ManagedIndexSchemaFactory extends IndexSchemaFactory implements Sol
byte[] data = zkClient.getData(managedSchemaPath, null, stat, true);
schemaZkVersion = stat.getVersion();
schemaInputStream = new ByteArrayInputStream(data);
+ loadedResource = managedSchemaPath;
warnIfNonManagedSchemaExists();
} catch (Exception e1) {
if (e1 instanceof InterruptedException) {