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 2017/07/05 06:03:46 UTC

[2/2] lucene-solr:feature/autoscaling: Merge remote-tracking branch 'origin/feature/autoscaling' into feature/autoscaling

Merge remote-tracking branch 'origin/feature/autoscaling' into feature/autoscaling


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/1c8589c6
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/1c8589c6
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/1c8589c6

Branch: refs/heads/feature/autoscaling
Commit: 1c8589c6eac5aa215ca09c2a26c6eb848edf096d
Parents: 43feb76 dfb7522
Author: Noble Paul <no...@apache.org>
Authored: Wed Jul 5 15:33:37 2017 +0930
Committer: Noble Paul <no...@apache.org>
Committed: Wed Jul 5 15:33:37 2017 +0930

----------------------------------------------------------------------
 .../autoscaling/AutoScalingHandlerTest.java     | 24 ++++++++++
 .../autoscaling/ComputePlanActionTest.java      | 41 ++++++++++++----
 .../autoscaling/TriggerIntegrationTest.java     | 50 +++++++++-----------
 3 files changed, 78 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1c8589c6/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
----------------------------------------------------------------------
diff --cc solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
index e4f8f52,1cfe5cd..f2fc2d3
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
@@@ -662,23 -659,36 +662,47 @@@ public class AutoScalingHandlerTest ext
      assertNotNull(violations);
      assertEquals(0, violations.size());
  
+     // temporarily increase replica limit in cluster policy so that we can create a collection with 6 replicas
+     setClusterPolicyCommand = "{" +
+         " 'set-cluster-policy': [" +
+         "      {'cores':'<10', 'node':'#ANY'}," +
+         "      {'replica':'<4', 'shard': '#EACH', 'node': '#ANY'}," +
+         "      {'nodeRole':'overseer', 'replica':0}" +
+         "    ]" +
+         "}";
+     req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
+     response = solrClient.request(req);
+     assertEquals(response.get("result").toString(), "success");
+ 
      // lets create a collection which violates the rule replicas < 2
 -    CollectionAdminRequest.Create create = CollectionAdminRequest.Create.createCollection("readApiTestViolations", CONFIGSET_NAME, 1, 6);
 -    create.setMaxShardsPerNode(10);
 -    CollectionAdminResponse adminResponse = create.process(solrClient);
 +    CollectionAdminResponse adminResponse = CollectionAdminRequest.Create
 +        .createCollection("readApiTestViolations", CONFIGSET_NAME, 1, 6)
 +        .setPolicy("policy2")
 +        .setMaxShardsPerNode(10)
 +        .process(solrClient);
      assertTrue(adminResponse.isSuccess());
 +    setPolicyCommand =  "{'set-policy': {" +
 +        "    'policy2':[" +
 +        "      {'replica':'<2', 'shard': '#EACH', 'node': '#ANY'}" +
 +        "    ]" +
 +        "}}";
 +
 +    req = createAutoScalingRequest(SolrRequest.METHOD.POST, setPolicyCommand);
 +    response = solrClient.request(req);
 +    assertEquals(response.get("result").toString(), "success");
  
+     // reset to original cluster policy which allows only 1 replica per shard per node
+     setClusterPolicyCommand = "{" +
+         " 'set-cluster-policy': [" +
+         "      {'cores':'<10', 'node':'#ANY'}," +
+         "      {'replica':'<2', 'shard': '#EACH', 'node': '#ANY'}," +
+         "      {'nodeRole':'overseer', 'replica':0}" +
+         "    ]" +
+         "}";
+     req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
+     response = solrClient.request(req);
+     assertEquals(response.get("result").toString(), "success");
+ 
      // get the diagnostics output again
      req = createAutoScalingRequest(SolrRequest.METHOD.GET, "/diagnostics", null);
      response = solrClient.request(req);