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 2021/06/03 20:51:16 UTC

[solr] branch main updated: SOLR-15311: MODIFYCOLLECTION now supports async (#152)

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

dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 387527a  SOLR-15311: MODIFYCOLLECTION now supports async (#152)
387527a is described below

commit 387527a4747fbe11c67ff2c0480ce183fb18d13e
Author: Nazerke Seidan <se...@gmail.com>
AuthorDate: Thu Jun 3 22:50:23 2021 +0200

    SOLR-15311: MODIFYCOLLECTION now supports async (#152)
    
    Co-authored-by: Nazerke Seidan <ns...@salesforce.com>
    Co-authored-by: David Smiley <ds...@apache.org>
---
 solr/CHANGES.txt                                   |  8 +++++++
 .../solr/cloud/api/collections/CollApiCmds.java    |  2 ++
 .../solr/cloud/OverseerModifyCollectionTest.java   | 25 +++++++++-------------
 solr/solr-ref-guide/src/collection-management.adoc |  1 +
 4 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 3496488..73442cb 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -318,6 +318,14 @@ Bug Fixes
 
 * SOLR-15334: Return error response when failing auth in PKIAuthPlugin (Mike Drob)
 
+==================  8.10.0 ==================
+
+Bug Fixes
+---------------------
+
+* SOLR-15311: Support ASYNC parameter in MODIFYCOLLECTION (Nazerke Seidan, Christine Poerschke, David Smiley)
+* ```
+
 ==================  8.9.0 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/CollApiCmds.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/CollApiCmds.java
index be1fc30..fa02123 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/CollApiCmds.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/CollApiCmds.java
@@ -38,6 +38,7 @@ import org.apache.solr.common.cloud.ZkNodeProps;
 import org.apache.solr.common.cloud.ZkStateReader;
 import org.apache.solr.common.params.CollectionAdminParams;
 import org.apache.solr.common.params.CollectionParams;
+import org.apache.solr.common.params.CommonAdminParams;
 import org.apache.solr.common.params.CoreAdminParams;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.NamedList;
@@ -322,6 +323,7 @@ public class CollApiCmds {
 
             if (!updateKey.equals(ZkStateReader.COLLECTION_PROP)
                 && !updateKey.equals(Overseer.QUEUE_OPERATION)
+                && !updateKey.equals(CommonAdminParams.ASYNC)
                 && updateEntry.getValue() != null // handled below in a separate conditional
                 && !updateEntry.getValue().equals(c.get(updateKey))) {
               return false;
diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerModifyCollectionTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerModifyCollectionTest.java
index ed113cd..e3c4205 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OverseerModifyCollectionTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerModifyCollectionTest.java
@@ -17,19 +17,17 @@
 
 package org.apache.solr.cloud;
 
+import java.util.Collections;
 import java.util.Map;
 
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
-import org.apache.solr.client.solrj.request.GenericSolrRequest;
+import org.apache.solr.client.solrj.response.RequestStatusState;
 import org.apache.solr.common.cloud.ZkStateReader;
-import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.Utils;
 import org.apache.zookeeper.KeeperException;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import static org.apache.solr.client.solrj.SolrRequest.METHOD.POST;
-import static org.apache.solr.common.params.CommonParams.COLLECTIONS_HANDLER_PATH;
 
 public class OverseerModifyCollectionTest extends SolrCloudTestCase {
 
@@ -49,22 +47,19 @@ public class OverseerModifyCollectionTest extends SolrCloudTestCase {
     CollectionAdminRequest.createCollection(collName, "conf1", 1, 2)
         .process(cluster.getSolrClient());
 
-    // TODO create a modifyCollection() method on CollectionAdminRequest
-    ModifiableSolrParams p1 = new ModifiableSolrParams();
-    p1.add("collection", collName);
-    p1.add("action", "MODIFYCOLLECTION");
-    p1.add("collection.configName", "conf2");
-    cluster.getSolrClient().request(new GenericSolrRequest(POST, COLLECTIONS_HANDLER_PATH, p1));
+    // Modify configSet
+    RequestStatusState requestStatusState = CollectionAdminRequest.modifyCollection(collName,
+            Collections.singletonMap("collection.configName", "conf2"))
+            .processAndWait(cluster.getSolrClient(), DEFAULT_TIMEOUT);
+    assertEquals(requestStatusState, RequestStatusState.COMPLETED);
 
     assertEquals("conf2", getConfigNameFromZk(collName));
     
     //Try an invalid config name
-    ModifiableSolrParams p2 = new ModifiableSolrParams();
-    p2.add("collection", collName);
-    p2.add("action", "MODIFYCOLLECTION");
-    p2.add("collection.configName", "notARealConfigName");
     Exception e = expectThrows(Exception.class, () -> {
-      cluster.getSolrClient().request(new GenericSolrRequest(POST, COLLECTIONS_HANDLER_PATH, p2));
+      CollectionAdminRequest.modifyCollection(collName,
+              Collections.singletonMap("collection.configName", "notARealConfigName")
+      ).process(cluster.getSolrClient());
     });
 
     assertTrue(e.getMessage(), e.getMessage().contains("Can not find the specified config set"));
diff --git a/solr/solr-ref-guide/src/collection-management.adoc b/solr/solr-ref-guide/src/collection-management.adoc
index 3d73c72..c071d66 100644
--- a/solr/solr-ref-guide/src/collection-management.adoc
+++ b/solr/solr-ref-guide/src/collection-management.adoc
@@ -275,6 +275,7 @@ The attributes that can be modified are:
 * replicationFactor
 * collection.configName
 * readOnly
+* async
 * other custom properties that use a `property.` prefix
 
 See the <<create,CREATE action>> section above for details on these attributes.