You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2017/06/06 04:56:53 UTC
[04/15] lucene-solr:master: SOLR-10278: added a testcase for
replica:0, sysprop.fs:!ssd means all replicas go to sysprop.fs=ssd nodes
SOLR-10278: added a testcase for replica:0, sysprop.fs:!ssd means all replicas go to sysprop.fs=ssd nodes
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/04dbe590
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/04dbe590
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/04dbe590
Branch: refs/heads/master
Commit: 04dbe590711916cf3104e36768bc149f9356fa50
Parents: e5d8ed3
Author: Noble Paul <no...@apache.org>
Authored: Tue May 30 20:28:15 2017 +0930
Committer: Noble Paul <no...@apache.org>
Committed: Tue May 30 20:28:15 2017 +0930
----------------------------------------------------------------------
.../solr/cloud/autoscaling/TestPolicy.java | 31 ++++++++++++++++++++
1 file changed, 31 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/04dbe590/solr/solrj/src/test/org/apache/solr/cloud/autoscaling/TestPolicy.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/cloud/autoscaling/TestPolicy.java b/solr/solrj/src/test/org/apache/solr/cloud/autoscaling/TestPolicy.java
index 7591445..9f74ae9 100644
--- a/solr/solrj/src/test/org/apache/solr/cloud/autoscaling/TestPolicy.java
+++ b/solr/solrj/src/test/org/apache/solr/cloud/autoscaling/TestPolicy.java
@@ -239,6 +239,37 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
+ public void testNegativeConditions() {
+ String autoscaleJson = "{" +
+ " 'cluster-policy':[" +
+ " {'replica':'<4','shard':'#EACH','node':'#ANY'}," +
+ " { 'replica': 0, 'sysprop.fs': '!ssd', 'shard': '#EACH'}," +//negative greedy condition
+ " {'nodeRole':'overseer','replica':'0'}]," +
+ " 'cluster-preferences':[" +
+ " {'minimize':'cores', 'precision':3}," +
+ " {'maximize':'freedisk','precision':100}]}";
+ Map<String, Map> nodeValues = (Map<String, Map>) Utils.fromJSONString("{" +
+ "node1:{cores:12, freedisk: 334, heapUsage:10480, rack: rack4}," +
+ "node2:{cores:4, freedisk: 749, heapUsage:6873, rack: rack3}," +
+ "node3:{cores:7, freedisk: 262, heapUsage:7834, rack: rack2, sysprop.fs : ssd}," +
+ "node4:{cores:8, freedisk: 375, heapUsage:16900, nodeRole:overseer, rack: rack1}" +
+ "}");
+ Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoscaleJson));
+ ClusterDataProvider clusterDataProvider = getClusterDataProvider(nodeValues, clusterState);
+ Policy.Session session = policy.createSession(clusterDataProvider);
+ for (int i = 0; i < 3; i++) {
+ Policy.Suggester suggester = session.getSuggester(ADDREPLICA);
+ SolrRequest op = suggester
+ .hint(Hint.COLL, "newColl")
+ .hint(Hint.SHARD, "shard1")
+ .getOperation();
+ assertNotNull(op);
+ assertEquals("node3", op.getParams().get("node"));
+ session = suggester.getSession();
+ }
+
+ }
+
public void testGreedyConditions() {
String autoscaleJson = "{" +
" 'cluster-policy':[" +