Apache Solr open-source search software
Merge remote-tracking branch 'origin/feature/autoscaling' into feature/autoscaling
Noble Paul1c8589c6eac5
diff --cc solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.javaindex e4f8f5265eb,1cfe5cddfa2..f2fc2d333e9--- 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 extassertNotNull(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 againreq = createAutoScalingRequest(SolrRequest.METHOD.GET, "/diagnostics", null);response = solrClient.request(req);