You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ds...@apache.org on 2026/08/13 16:15:30 UTC
(solr) 01/07: SOLR-18334: PRS collection creation returns too early (#4704)
This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/solr.git
commit c497e4860252aa228deb1a533db4f5b8a690c5f9
Author: David Smiley <ds...@apache.org>
AuthorDate: Sun Aug 9 23:08:24 2026 -0400
SOLR-18334: PRS collection creation returns too early (#4704)
Consequence: the caller might try to do something with it immediately after that results in a failure. A test sometimes showed this issue with backup-restore.
(cherry picked from commit 22c1a9fd344ba52c017a90dc7960f171c0f93dac)
---
changelog/unreleased/SOLR-18334-prs-creation-waitForState.yml | 8 ++++++++
.../solr/cloud/api/collections/CreateCollectionCmd.java | 11 +++++++++++
2 files changed, 19 insertions(+)
diff --git a/changelog/unreleased/SOLR-18334-prs-creation-waitForState.yml b/changelog/unreleased/SOLR-18334-prs-creation-waitForState.yml
new file mode 100644
index 00000000000..df7a1d93660
--- /dev/null
+++ b/changelog/unreleased/SOLR-18334-prs-creation-waitForState.yml
@@ -0,0 +1,8 @@
+title: >
+ PRS based collection creation returns too early; can cause restore failure.
+type: fixed
+authors:
+ - name: David Smiley
+links:
+ - name: SOLR-18334
+ url: https://issues.apache.org/jira/browse/SOLR-18334
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/CreateCollectionCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/CreateCollectionCmd.java
index dd6fdf2da63..14291d7b941 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/CreateCollectionCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/CreateCollectionCmd.java
@@ -204,6 +204,17 @@ public class CreateCollectionCmd implements CollApiCmds.CollectionApiCommand {
clusterState = clusterState.copyWith(collectionName, command.collection);
newColl = command.collection;
ccc.submitIntraProcessMessage(new RefreshCollectionMessage(collectionName));
+
+ // ensure the local ZkStateReader sees the collection before returning, so callers get the
+ // same "collection exists" guarantee as the non-PRS path
+ try {
+ zkStateReader.waitForState(collectionName, 30, TimeUnit.SECONDS, Objects::nonNull);
+ } catch (TimeoutException e) {
+ throw new SolrException(
+ SolrException.ErrorCode.SERVER_ERROR,
+ "Could not fully create collection: " + collectionName,
+ e);
+ }
} else {
if (ccc.getDistributedClusterStateUpdater().isDistributedStateUpdate()) {
// The message has been crafted by CollectionsHandler.CollectionOperation.CREATE_OP and