Skip to content

Apache Lucene open-source search software

SOLR-8203: reject updates if core container is shutting down

Yonik Seeley368d19a2b9f0
diff --git a/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java b/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
index 3228926d676..ef8b189a90a 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
@@ -1443,6 +1443,14 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
}
private void zkCheck() {
+
+ // Streaming updates can delay shutdown and cause big update reorderings (new streams can't be
+ // initiated, but existing streams carry on). This is why we check if the CC is shutdown.
+ // See SOLR-8203 and loop HdfsChaosMonkeyNothingIsSafeTest (and check for inconsistent shards) to test.
+ if (req.getCore().getCoreDescriptor().getCoreContainer().isShutDown()) {
+ throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE, "CoreContainer is shutting down.");
+ }
+
if ((updateCommand.getFlags() & (UpdateCommand.REPLAY | UpdateCommand.PEER_SYNC)) != 0) {
// for log reply or peer sync, we don't need to be connected to ZK
return;