You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2022/06/21 13:39:20 UTC

[lucene-solr] branch jira/solr15138-3 updated: optimize create replica

This is an automated email from the ASF dual-hosted git repository.

noble pushed a commit to branch jira/solr15138-3
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/jira/solr15138-3 by this push:
     new 588d38dcf23 optimize create replica
588d38dcf23 is described below

commit 588d38dcf2322b8de9c8562eb6f0ae64ff714bd2
Author: Noble Paul <no...@gmail.com>
AuthorDate: Tue Jun 21 23:39:07 2022 +1000

    optimize create replica
---
 .../solr/cloud/api/collections/CreateCollectionCmd.java      | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

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 8ca9e78294f..b39b0ca00e2 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
@@ -289,10 +289,6 @@ public class CreateCollectionCmd implements OverseerCollectionMessageHandler.Cmd
             // to the overseer queue.
             // TODO: Consider doing this for all collections, not just the PRS collections.
             ZkWriteCommand command = new SliceMutator(ocmh.cloudManager).addReplica(clusterState, props);
-            byte[] data = Utils.toJSON(Collections.singletonMap(collectionName, command.collection));
-            T.start("setData(collectionPath)");
-            ocmh.zkStateReader.getZkClient().setData(collectionPath, data, true);
-            T.end("setData(collectionPath)");
             clusterState = clusterState.copyWith(collectionName, command.collection);
             newColl = command.collection;
           } else {
@@ -333,7 +329,13 @@ public class CreateCollectionCmd implements OverseerCollectionMessageHandler.Cmd
           coresToCreate.put(coreName, sreq);
         }
       }
-      if(isPRS) {
+      
+      if (isPRS) {
+        byte[] data = Utils.toJSON(Collections.singletonMap(collectionName, clusterState.getCollection(collectionName)));
+        T.start("setData(collectionPath)");
+        ocmh.zkStateReader.getZkClient().setData(collectionPath, data, true);
+        T.end("setData(collectionPath)");
+
         T.start("RefreshCollectionMessage.1");
         ocmh.overseer.submit(new RefreshCollectionMessage(collectionName));
         T.end("RefreshCollectionMessage.1");