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 2021/01/17 00:10:02 UTC

[lucene-solr] branch branch_8_8 updated: SOLR-15052: Added V2 support, ref guide entry

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

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


The following commit(s) were added to refs/heads/branch_8_8 by this push:
     new 6648982  SOLR-15052: Added V2 support, ref guide entry
6648982 is described below

commit 6648982b68463044c059731f45b24de0d4dab6a3
Author: noblepaul <no...@gmail.com>
AuthorDate: Sun Jan 17 11:09:31 2021 +1100

    SOLR-15052: Added V2 support, ref guide entry
---
 solr/solr-ref-guide/src/collection-management.adoc       |  3 +++
 .../src/resources/apispec/collections.Commands.json      |  5 +++++
 .../solr/client/solrj/impl/CloudSolrClientTest.java      | 16 +++++++++++++++-
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/solr/solr-ref-guide/src/collection-management.adoc b/solr/solr-ref-guide/src/collection-management.adoc
index a626345..6853565 100644
--- a/solr/solr-ref-guide/src/collection-management.adoc
+++ b/solr/solr-ref-guide/src/collection-management.adoc
@@ -94,6 +94,9 @@ If this parameter is specified, the router will look at the value of the field i
 +
 Please note that <<realtime-get.adoc#realtime-get,RealTime Get>> or retrieval by document ID would also require the parameter `\_route_` (or `shard.keys`) to avoid a distributed search.
 
+`perReplicaState`::
+If `true` the states of individual replicas will be maintained as individual child of the `state.json`. default is `false`
+
 `property._name_=_value_`::
 Set core property _name_ to _value_. See the section <<defining-core-properties.adoc#defining-core-properties,Defining core.properties>> for details on supported properties and values.
 
diff --git a/solr/solrj/src/resources/apispec/collections.Commands.json b/solr/solrj/src/resources/apispec/collections.Commands.json
index 5fc7f76..af8a826 100644
--- a/solr/solrj/src/resources/apispec/collections.Commands.json
+++ b/solr/solrj/src/resources/apispec/collections.Commands.json
@@ -121,6 +121,11 @@
           "type": "boolean",
           "description": "If true then request will complete only when all affected replicas become active.",
           "default": false
+        },
+        "perReplicaState": {
+          "type": "boolean",
+          "description": "Use Per replica states",
+          "default": false
         }
       },
       "required": [
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
index 25582b6..171785c 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
@@ -47,6 +47,7 @@ import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.request.QueryRequest;
 import org.apache.solr.client.solrj.request.UpdateRequest;
+import org.apache.solr.client.solrj.request.V2Request;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.client.solrj.response.RequestStatusState;
 import org.apache.solr.client.solrj.response.SolrPingResponse;
@@ -83,6 +84,8 @@ import org.junit.rules.ExpectedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.solr.client.solrj.SolrRequest.METHOD.POST;
+
 
 /**
  * This test would be faster if we simulated the zk state instead.
@@ -1082,7 +1085,7 @@ public class CloudSolrClientTest extends SolrCloudTestCase {
     CollectionAdminRequest.createCollection("versions_collection", "conf", 2, 1)
         .process(cluster.getSolrClient());
 
-    final String testCollection = "perReplicaState_test";
+    String testCollection = "perReplicaState_test";
     int liveNodes = cluster.getJettySolrRunners().size();
     CollectionAdminRequest.createCollection(testCollection, "conf", 2, 2)
         .setMaxShardsPerNode(liveNodes)
@@ -1096,6 +1099,17 @@ public class CloudSolrClientTest extends SolrCloudTestCase {
     c.forEachReplica((s, replica) -> assertNotNull(replica.getReplicaState()));
     PerReplicaStates prs = PerReplicaStates.fetch(ZkStateReader.getCollectionPath(testCollection), cluster.getZkClient(), null);
     assertEquals(4, prs.states.size());
+    testCollection = "perReplicaState_testv2";
+    new V2Request.Builder("/collections")
+        .withMethod(POST)
+        .withPayload("{create: {name: perReplicaState_testv2, config : conf, numShards : 2, nrtReplicas : 2, perReplicaState : true, maxShardsPerNode : 5}}")
+        .build()
+        .process(cluster.getSolrClient());
+    cluster.waitForActiveCollection(testCollection, 2, 4);
+    c = cluster.getSolrClient().getZkStateReader().getCollection(testCollection);
+    c.forEachReplica((s, replica) -> assertNotNull(replica.getReplicaState()));
+    prs = PerReplicaStates.fetch(ZkStateReader.getCollectionPath(testCollection), cluster.getZkClient(), null);
+    assertEquals(4, prs.states.size());
   }
 
 }