diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 0d3ec9d001ff..84aaedaf07c6 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -22,7 +22,8 @@ Optimizations Bug Fixes --------------------- -(No changes) +* SOLR-15311: Support async parameter in MODIFYCOLLECTION + (Nazerke Seidan, Christine Poerschke, David Smiley) Other Changes --------------------- diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerCollectionMessageHandler.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerCollectionMessageHandler.java index 2ba3b2c071cd..4222b00fb8f6 100644 --- a/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerCollectionMessageHandler.java +++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerCollectionMessageHandler.java @@ -71,6 +71,7 @@ import org.apache.solr.common.cloud.ZkStateReader; import org.apache.solr.common.params.CollectionAdminParams; import org.apache.solr.common.params.CollectionParams.CollectionAction; +import org.apache.solr.common.params.CommonAdminParams; import org.apache.solr.common.params.CoreAdminParams; import org.apache.solr.common.params.CoreAdminParams.CoreAdminAction; import org.apache.solr.common.params.ModifiableSolrParams; @@ -654,6 +655,7 @@ void modifyCollection(ClusterState clusterState, ZkNodeProps message, @SuppressW 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(collection.get(updateKey))) { areChangesVisible = 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 ed113cd4cdd8..d8252711057b 100644 --- a/solr/core/src/test/org/apache/solr/cloud/OverseerModifyCollectionTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/OverseerModifyCollectionTest.java @@ -17,20 +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 { @BeforeClass @@ -49,22 +46,19 @@ public void testModifyColl() throws Exception { 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 1b2b55ee35c4..c0ddbe9e22a2 100644 --- a/solr/solr-ref-guide/src/collection-management.adoc +++ b/solr/solr-ref-guide/src/collection-management.adoc @@ -260,6 +260,7 @@ The attributes that can be modified are: * policy * withCollection * readOnly +* async * other custom properties that use a `property.` prefix See the <> section above for details on these attributes.