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 2018/09/21 02:57:28 UTC
lucene-solr:branch_7x: SOLR-12792: extract test data into separate
files in autoscaling tests
Repository: lucene-solr
Updated Branches:
refs/heads/branch_7x 0c7543387 -> 9e359c14b
SOLR-12792: extract test data into separate files in autoscaling tests
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/9e359c14
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/9e359c14
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/9e359c14
Branch: refs/heads/branch_7x
Commit: 9e359c14b6d841e363fcef22f323ae8c986009ce
Parents: 0c75433
Author: Noble Paul <no...@apache.org>
Authored: Fri Sep 21 12:55:41 2018 +1000
Committer: Noble Paul <no...@apache.org>
Committed: Fri Sep 21 12:57:08 2018 +1000
----------------------------------------------------------------------
.../java/org/apache/solr/common/util/Utils.java | 4 +-
.../testScheduledTriggerFailure.json | 52 ++
.../solrj/solr/autoscaling/testSortError.json | 225 ++++++++
.../autoscaling/testSysPropSuggestions.json | 119 ++++
.../autoscaling/testUtilizeNodeFailure.json | 69 +++
.../autoscaling/testUtilizeNodeFailure2.json | 66 +++
.../solrj/cloud/autoscaling/TestPolicy.java | 541 +------------------
.../solrj/cloud/autoscaling/TestPolicy2.java | 166 +-----
8 files changed, 548 insertions(+), 694 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e359c14/solr/solrj/src/java/org/apache/solr/common/util/Utils.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/Utils.java b/solr/solrj/src/java/org/apache/solr/common/util/Utils.java
index b389632..9e72607 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/Utils.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/Utils.java
@@ -232,7 +232,7 @@ public class Utils {
public static Object fromJSON(InputStream is){
try {
- return new ObjectBuilder(getJSONParser((new InputStreamReader(is, StandardCharsets.UTF_8)))).getObject();
+ return new ObjectBuilder(getJSONParser((new InputStreamReader(is, StandardCharsets.UTF_8)))).getVal();
} catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Parse error", e);
}
@@ -260,7 +260,7 @@ public class Utils {
public static Object fromJSONString(String json) {
try {
- return new ObjectBuilder(getJSONParser(new StringReader(json))).getObject();
+ return new ObjectBuilder(getJSONParser(new StringReader(json))).getVal();
} catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Parse error", e);
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e359c14/solr/solrj/src/test-files/solrj/solr/autoscaling/testScheduledTriggerFailure.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testScheduledTriggerFailure.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testScheduledTriggerFailure.json
new file mode 100644
index 0000000..9347494
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testScheduledTriggerFailure.json
@@ -0,0 +1,52 @@
+{
+ "liveNodes":["127.0.0.1:49221_solr",
+ "127.0.0.1:49210_solr"],
+ "suggester":{
+ "action":"MOVEREPLICA",
+ "hints":{}},
+ "replicaInfo":{
+ "127.0.0.1:49210_solr":{"testScheduledTrigger":{"shard1":[{"core_node3":{
+ "base_url":"http://127.0.0.1:49210/solr",
+ "node_name":"127.0.0.1:49210_solr",
+ "core":"testScheduledTrigger_shard1_replica_n1",
+ "state":"active",
+ "type":"NRT",
+ "INDEX.sizeInBytes":6.426125764846802E-8,
+ "shard":"shard1",
+ "collection":"testScheduledTrigger"}},
+ {"core_node6":{
+ "base_url":"http://127.0.0.1:49210/solr",
+ "node_name":"127.0.0.1:49210_solr",
+ "core":"testScheduledTrigger_shard1_replica_n4",
+ "state":"active",
+ "type":"NRT",
+ "INDEX.sizeInBytes":6.426125764846802E-8,
+ "shard":"shard1",
+ "collection":"testScheduledTrigger"}}]}},
+ "127.0.0.1:49221_solr":{"testScheduledTrigger":{"shard1":[{"core_node5":{
+ "core":"testScheduledTrigger_shard1_replica_n2",
+ "leader":"true",
+ "INDEX.sizeInBytes":6.426125764846802E-8,
+ "base_url":"http://127.0.0.1:49221/solr",
+ "node_name":"127.0.0.1:49221_solr",
+ "state":"active",
+ "type":"NRT",
+ "shard":"shard1",
+ "collection":"testScheduledTrigger"}}]}}},
+ "nodeValues":{
+ "127.0.0.1:49210_solr":{
+ "node":"127.0.0.1:49210_solr",
+ "cores":2,
+ "freedisk":197.39717864990234},
+ "127.0.0.1:49221_solr":{
+ "node":"127.0.0.1:49221_solr",
+ "cores":1,
+ "freedisk":197.39717864990234}},
+ "autoscalingJson":{
+ "cluster-preferences":[{
+ "minimize":"cores",
+ "precision":1},
+ {"maximize":"freedisk"}],
+ "cluster-policy":[{
+ "cores":"<3",
+ "node":"#EACH"}]}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e359c14/solr/solrj/src/test-files/solrj/solr/autoscaling/testSortError.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testSortError.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testSortError.json
new file mode 100644
index 0000000..434e627
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testSortError.json
@@ -0,0 +1,225 @@
+[{"node":"solr-01:8983_solr",
+ "replicas":{},
+ "isLive":true,
+ "attributes":[{"cores":2},
+ {"freedisk":1734.5261459350586},
+ {"sysLoadAvg":35.0},
+ {"node":"solr-01:8983_solr"}]},
+ {
+ "node":"solr-07:8983_solr",
+ "replicas":{},
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1721.5669250488281},
+ {"sysLoadAvg":10.0},
+ {"node":"solr-07:8983_solr"}]},
+ {
+ "node":"solr-08:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1764.9518203735352},
+ {"sysLoadAvg":330.0},
+ {"node":"solr-08:8983_solr"}]},
+ {
+ "node":"solr-25:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1779.7792778015137},
+ {"sysLoadAvg":304.0},
+ {"node":"solr-25:8983_solr"}]},
+ {
+ "node":"solr-15:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1697.5930519104004},
+ {"sysLoadAvg":277.0},
+ {"node":"solr-15:8983_solr"}]},
+ {
+ "node":"solr-13:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":2},
+ {"freedisk":1755.1909484863281},
+ {"sysLoadAvg":265.0},
+ {"node":"solr-13:8983_solr"}]},
+ {
+ "node":"solr-14:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1757.6035423278809},
+ {"sysLoadAvg":61.0},
+ {"node":"solr-14:8983_solr"}]},
+ {
+ "node":"solr-16:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1746.081386566162},
+ {"sysLoadAvg":260.0},
+ {"node":"solr-16:8983_solr"}]},
+ {
+ "node":"solr-04:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":2},
+ {"freedisk":1708.7230529785156},
+ {"sysLoadAvg":216.0},
+ {"node":"solr-04:8983_solr"}]},
+ {
+ "node":"solr-06:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1688.3182678222656},
+ {"sysLoadAvg":385.0},
+ {"node":"solr-06:8983_solr"}]},
+ {
+ "node":"solr-02:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":6},
+ {"freedisk":1778.226963043213},
+ {"sysLoadAvg":369.0},
+ {"node":"solr-02:8983_solr"}]},
+ {
+ "node":"solr-05:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1741.9401931762695},
+ {"sysLoadAvg":354.0},
+ {"node":"solr-05:8983_solr"}]},
+ {
+ "node":"solr-23:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1718.854579925537},
+ {"sysLoadAvg":329.0},
+ {"node":"solr-23:8983_solr"}]},
+ {
+ "node":"solr-24:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1733.6669311523438},
+ {"sysLoadAvg":327.0},
+ {"node":"solr-24:8983_solr"}]},
+ {
+ "node":"solr-09:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1714.6191711425781},
+ {"sysLoadAvg":278.0},
+ {"node":"solr-09:8983_solr"}]},
+ {
+ "node":"solr-10:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1755.3038482666016},
+ {"sysLoadAvg":266.0},
+ {"node":"solr-10:8983_solr"}]},
+ {
+ "node":"solr-28:8983_solr",
+ "isLive":false,
+ "attributes":[{"cores":3},
+ {"freedisk":1691.3830909729004},
+ {"sysLoadAvg":261.0},
+ {"node":"solr-28:8983_solr"}]},
+ {
+ "node":"solr-29:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":2},
+ {"freedisk":1706.797966003418},
+ {"sysLoadAvg":252.99999999999997},
+ {"node":"solr-29:8983_solr"}]},
+ {
+ "node":"solr-32:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1762.432300567627},
+ {"sysLoadAvg":221.0},
+ {"node":"solr-32:8983_solr"}]},
+ {
+ "node":"solr-21:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1760.9801979064941},
+ {"sysLoadAvg":213.0},
+ {"node":"solr-21:8983_solr"}]},
+ {
+ "node":"solr-22:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1780.5297241210938},
+ {"sysLoadAvg":209.0},
+ {"node":"solr-22:8983_solr"}]},
+ {
+ "node":"solr-31:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1700.1481628417969},
+ {"sysLoadAvg":211.0},
+ {"node":"solr-31:8983_solr"}]},
+ {
+ "node":"solr-33:8983_solr",
+ "isLive":false,
+ "attributes":[{"cores":3},
+ {"freedisk":1748.1132926940918},
+ {"sysLoadAvg":199.0},
+ {"node":"solr-33:8983_solr"}]},
+ {
+ "node":"solr-36:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1776.197639465332},
+ {"sysLoadAvg":193.0},
+ {"node":"solr-36:8983_solr"}]},
+ {
+ "node":"solr-35:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1746.7729606628418},
+ {"sysLoadAvg":191.0},
+ {"node":"solr-35:8983_solr"}]},
+ {
+ "node":"solr-12:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1713.287540435791},
+ {"sysLoadAvg":175.0},
+ {"node":"solr-12:8983_solr"}]},
+ {
+ "node":"solr-11:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1736.784511566162},
+ {"sysLoadAvg":169.0},
+ {"node":"solr-11:8983_solr"}]},
+ {
+ "node":"solr-35:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1766.9416885375977},
+ {"sysLoadAvg":155.0},
+ {"node":"solr-35:8983_solr"}]},
+ {
+ "node":"solr-17:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":3},
+ {"freedisk":1764.3425407409668},
+ {"sysLoadAvg":139.0},
+ {"node":"solr-17:8983_solr"}]},
+ {
+ "node":"solr-18:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":2},
+ {"freedisk":1757.0613975524902},
+ {"sysLoadAvg":132.0},
+ {"node":"solr-18:8983_solr"}]},
+ {
+ "node":"solr-20:8983_solr",
+ "isLive":false,
+ "attributes":[{"cores":3},
+ {"freedisk":1747.4205322265625},
+ {"sysLoadAvg":126.0},
+ {"node":"solr-20:8983_solr"}]},
+ {
+ "node":"solr-27:8983_solr",
+ "isLive":true,
+ "attributes":[{"cores":4},
+ {"freedisk":1721.0442085266113},
+ {"sysLoadAvg":118.0},
+ {"node":"solr-27:8983_solr"}]}]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e359c14/solr/solrj/src/test-files/solrj/solr/autoscaling/testSysPropSuggestions.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testSysPropSuggestions.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testSysPropSuggestions.json
new file mode 100644
index 0000000..aabcb62
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testSysPropSuggestions.json
@@ -0,0 +1,119 @@
+{"diagnostics":{
+ "sortedNodes":[{
+ "node":"127.0.0.1:63191_solr",
+ "isLive":true,
+ "cores":3.0,
+ "sysprop.zone":"east",
+ "freedisk":1727.1459312438965,
+ "heapUsage":24.97510064011647,
+ "sysLoadAvg":272.75390625,
+ "totaldisk":1037.938980102539,
+ "replicas":{"zonesTest":{"shard1":[{"core_node5":{
+ "core":"zonesTest_shard1_replica_n2",
+ "leader":"true",
+ "base_url":"https://127.0.0.1:63191/solr",
+ "node_name":"127.0.0.1:63191_solr",
+ "state":"active",
+ "type":"NRT",
+ "force_set_state":"false",
+ "INDEX.sizeInGB":6.426125764846802E-8,
+ "shard":"shard1",
+ "collection":"zonesTest"}},
+ {"core_node7":{
+ "core":"zonesTest_shard1_replica_n4",
+ "base_url":"https://127.0.0.1:63191/solr",
+ "node_name":"127.0.0.1:63191_solr",
+ "state":"active",
+ "type":"NRT",
+ "force_set_state":"false",
+ "INDEX.sizeInGB":6.426125764846802E-8,
+ "shard":"shard1",
+ "collection":"zonesTest"}},
+ {"core_node12":{
+ "core":"zonesTest_shard1_replica_n10",
+ "base_url":"https://127.0.0.1:63191/solr",
+ "node_name":"127.0.0.1:63191_solr",
+ "state":"active",
+ "type":"NRT",
+ "force_set_state":"false",
+ "INDEX.sizeInGB":6.426125764846802E-8,
+ "shard":"shard1",
+ "collection":"zonesTest"}}]}}},
+ {
+ "node":"127.0.0.1:63192_solr",
+ "isLive":true,
+ "cores":3.0,
+ "sysprop.zone":"east",
+ "freedisk":1727.1459312438965,
+ "heapUsage":24.98878807983566,
+ "sysLoadAvg":272.75390625,
+ "totaldisk":1037.938980102539,
+ "replicas":{"zonesTest":{"shard2":[{"core_node3":{
+ "core":"zonesTest_shard1_replica_n1",
+ "base_url":"https://127.0.0.1:63192/solr",
+ "node_name":"127.0.0.1:63192_solr",
+ "state":"active",
+ "type":"NRT",
+ "force_set_state":"false",
+ "INDEX.sizeInGB":6.426125764846802E-8,
+ "shard":"shard2",
+ "collection":"zonesTest"}},
+ {"core_node9":{
+ "core":"zonesTest_shard1_replica_n6",
+ "base_url":"https://127.0.0.1:63192/solr",
+ "node_name":"127.0.0.1:63192_solr",
+ "state":"active",
+ "type":"NRT",
+ "force_set_state":"false",
+ "INDEX.sizeInGB":6.426125764846802E-8,
+ "shard":"shard2",
+ "collection":"zonesTest"}},
+ {"core_node11":{
+ "core":"zonesTest_shard1_replica_n8",
+ "base_url":"https://127.0.0.1:63192/solr",
+ "node_name":"127.0.0.1:63192_solr",
+ "state":"active",
+ "type":"NRT",
+ "force_set_state":"false",
+ "INDEX.sizeInGB":6.426125764846802E-8,
+ "shard":"shard2",
+ "collection":"zonesTest"}}]}}},
+ {
+ "node":"127.0.0.1:63219_solr",
+ "isLive":true,
+ "cores":0.0,
+ "sysprop.zone":"west",
+ "freedisk":1768.6174201965332,
+ "heapUsage":24.98878807983566,
+ "sysLoadAvg":272.75390625,
+ "totaldisk":1037.938980102539,
+ "replicas":{}},
+ {
+ "node":"127.0.0.1:63229_solr",
+ "isLive":true,
+ "cores":0.0,
+ "sysprop.zone":"west",
+ "freedisk":1768.6174201965332,
+ "heapUsage":24.98878807983566,
+ "sysLoadAvg":272.75390625,
+ "totaldisk":1037.938980102539,
+ "replicas":{}}],
+ "liveNodes":["127.0.0.1:63191_solr",
+ "127.0.0.1:63192_solr",
+ "127.0.0.1:63219_solr",
+ "127.0.0.1:63229_solr"],
+ "config":{
+ "cluster-preferences":[{
+ "minimize":"cores",
+ "precision":1},
+ {
+ "maximize":"freedisk",
+ "precision":100},
+ {
+ "minimize":"sysLoadAvg",
+ "precision":10}],
+ "cluster-policy":[{
+ "replica":"<3",
+ "shard":"#EACH",
+ "sysprop.zone":["east",
+ "west"]}]}}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e359c14/solr/solrj/src/test-files/solrj/solr/autoscaling/testUtilizeNodeFailure.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testUtilizeNodeFailure.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testUtilizeNodeFailure.json
new file mode 100644
index 0000000..350957c
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testUtilizeNodeFailure.json
@@ -0,0 +1,69 @@
+{
+ "liveNodes":["127.0.0.1:50417_solr",
+ "127.0.0.1:50418_solr",
+ "127.0.0.1:50419_solr",
+ "127.0.0.1:50420_solr",
+ "127.0.0.1:50443_solr"],
+ "suggester":{
+ "action":"MOVEREPLICA",
+ "hints":{"TARGET_NODE":["127.0.0.1:50443_solr"]}},
+ "replicaInfo":{
+ "127.0.0.1:50418_solr":{"utilizenodecoll":{"shard2":[{"core_node7":{
+ "core":"utilizenodecoll_shard2_replica_n4",
+ "leader":"true",
+ "INDEX.sizeInBytes":6.426125764846802E-8,
+ "base_url":"http://127.0.0.1:50418/solr",
+ "node_name":"127.0.0.1:50418_solr",
+ "state":"active",
+ "type":"NRT",
+ "shard":"shard2",
+ "collection":"utilizenodecoll"}}]}},
+ "127.0.0.1:50417_solr":{"utilizenodecoll":{"shard2":[{"core_node8":{
+ "base_url":"http://127.0.0.1:50417/solr",
+ "node_name":"127.0.0.1:50417_solr",
+ "core":"utilizenodecoll_shard2_replica_n6",
+ "state":"active",
+ "type":"NRT",
+ "INDEX.sizeInBytes":6.426125764846802E-8,
+ "shard":"shard2",
+ "collection":"utilizenodecoll"}}]}},
+ "127.0.0.1:50419_solr":{"utilizenodecoll":{"shard1":[{"core_node5":{
+ "base_url":"http://127.0.0.1:50419/solr",
+ "node_name":"127.0.0.1:50419_solr",
+ "core":"utilizenodecoll_shard1_replica_n2",
+ "state":"active",
+ "type":"NRT",
+ "INDEX.sizeInBytes":6.426125764846802E-8,
+ "shard":"shard1",
+ "collection":"utilizenodecoll"}}]}},
+ "127.0.0.1:50420_solr":{"utilizenodecoll":{"shard1":[{"core_node3":{
+ "core":"utilizenodecoll_shard1_replica_n1",
+ "leader":"true",
+ "INDEX.sizeInBytes":6.426125764846802E-8,
+ "base_url":"http://127.0.0.1:50420/solr",
+ "node_name":"127.0.0.1:50420_solr",
+ "state":"active",
+ "type":"NRT",
+ "shard":"shard1",
+ "collection":"utilizenodecoll"}}]}},
+ "127.0.0.1:50443_solr":{}},
+ "nodeValues":{
+ "127.0.0.1:50418_solr":{
+ "cores":1,
+ "freedisk":187.70782089233398},
+ "127.0.0.1:50417_solr":{
+ "cores":1,
+ "freedisk":187.70782089233398},
+ "127.0.0.1:50419_solr":{
+ "cores":1,
+ "freedisk":187.70782089233398},
+ "127.0.0.1:50420_solr":{
+ "cores":1,
+ "freedisk":187.70782089233398},
+ "127.0.0.1:50443_solr":{
+ "cores":0,
+ "freedisk":187.70782089233398}},
+ "autoscalingJson":{"cluster-preferences":[{
+ "minimize":"cores",
+ "precision":1},
+ {"maximize":"freedisk"}]}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e359c14/solr/solrj/src/test-files/solrj/solr/autoscaling/testUtilizeNodeFailure2.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testUtilizeNodeFailure2.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testUtilizeNodeFailure2.json
new file mode 100644
index 0000000..2d6c384
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testUtilizeNodeFailure2.json
@@ -0,0 +1,66 @@
+{
+ "liveNodes":["127.0.0.1:51075_solr",
+ "127.0.0.1:51076_solr",
+ "127.0.0.1:51077_solr",
+ "127.0.0.1:51097_solr"],
+ "suggester":{
+ "action":"MOVEREPLICA",
+ "hints":{"TARGET_NODE":["127.0.0.1:51097_solr"]}},
+ "replicaInfo":{
+ "127.0.0.1:51076_solr":{"utilizenodecoll":{"shard1":[{"core_node5":{
+ "base_url":"https://127.0.0.1:51076/solr",
+ "node_name":"127.0.0.1:51076_solr",
+ "core":"utilizenodecoll_shard1_replica_n2",
+ "state":"active",
+ "type":"NRT",
+ "INDEX.sizeInBytes":6.426125764846802E-8,
+ "shard":"shard1",
+ "collection":"utilizenodecoll"}}]}},
+ "127.0.0.1:51077_solr":{"utilizenodecoll":{
+ "shard2":[{"core_node8":{
+ "base_url":"https://127.0.0.1:51077/solr",
+ "node_name":"127.0.0.1:51077_solr",
+ "core":"utilizenodecoll_shard2_replica_n6",
+ "state":"active",
+ "type":"NRT",
+ "INDEX.sizeInBytes":6.426125764846802E-8,
+ "shard":"shard2",
+ "collection":"utilizenodecoll"}}],
+ "shard1":[{"core_node3":{
+ "core":"utilizenodecoll_shard1_replica_n1",
+ "leader":"true",
+ "INDEX.sizeInBytes":6.426125764846802E-8,
+ "base_url":"https://127.0.0.1:51077/solr",
+ "node_name":"127.0.0.1:51077_solr",
+ "state":"active",
+ "type":"NRT",
+ "shard":"shard1",
+ "collection":"utilizenodecoll"}}]}},
+ "127.0.0.1:51097_solr":{},
+ "127.0.0.1:51075_solr":{"utilizenodecoll":{"shard2":[{"core_node7":{
+ "core":"utilizenodecoll_shard2_replica_n4",
+ "leader":"true",
+ "INDEX.sizeInBytes":6.426125764846802E-8,
+ "base_url":"https://127.0.0.1:51075/solr",
+ "node_name":"127.0.0.1:51075_solr",
+ "state":"active",
+ "type":"NRT",
+ "shard":"shard2",
+ "collection":"utilizenodecoll"}}]}}},
+ "nodeValues":{
+ "127.0.0.1:51076_solr":{
+ "cores":1,
+ "freedisk":188.7262191772461},
+ "127.0.0.1:51077_solr":{
+ "cores":2,
+ "freedisk":188.7262191772461},
+ "127.0.0.1:51097_solr":{
+ "cores":0,
+ "freedisk":188.7262191772461},
+ "127.0.0.1:51075_solr":{
+ "cores":1,
+ "freedisk":188.7262191772461}},
+ "autoscalingJson":{"cluster-preferences":[{
+ "minimize":"cores",
+ "precision":1},
+ {"maximize":"freedisk"}]}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e359c14/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java
index a48141e..4a16259 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java
@@ -2889,97 +2889,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
public void testScheduledTriggerFailure() throws Exception {
- String state = "{" +
- " 'liveNodes': [" +
- " '127.0.0.1:49221_solr'," +
- " '127.0.0.1:49210_solr'" +
- " ]," +
- " 'suggester': {" +
- " 'action': 'MOVEREPLICA'," +
- " 'hints': {}" +
- " }," +
- " 'replicaInfo': {" +
- " '127.0.0.1:49210_solr': {" +
- " 'testScheduledTrigger': {" +
- " 'shard1': [" +
- " {" +
- " 'core_node3': {" +
- " 'base_url': 'http://127.0.0.1:49210/solr'," +
- " 'node_name': '127.0.0.1:49210_solr'," +
- " 'core': 'testScheduledTrigger_shard1_replica_n1'," +
- " 'state': 'active'," +
- " 'type': 'NRT'," +
- " 'INDEX.sizeInBytes': 6.426125764846802E-8," +
- " 'shard': 'shard1'," +
- " 'collection': 'testScheduledTrigger'" +
- " }" +
- " }," +
- " {" +
- " 'core_node6': {" +
- " 'base_url': 'http://127.0.0.1:49210/solr'," +
- " 'node_name': '127.0.0.1:49210_solr'," +
- " 'core': 'testScheduledTrigger_shard1_replica_n4'," +
- " 'state': 'active'," +
- " 'type': 'NRT'," +
- " 'INDEX.sizeInBytes': 6.426125764846802E-8," +
- " 'shard': 'shard1'," +
- " 'collection': 'testScheduledTrigger'" +
- " }" +
- " }" +
- " ]" +
- " }" +
- " }," +
- " '127.0.0.1:49221_solr': {" +
- " 'testScheduledTrigger': {" +
- " 'shard1': [" +
- " {" +
- " 'core_node5': {" +
- " 'core': 'testScheduledTrigger_shard1_replica_n2'," +
- " 'leader': 'true'," +
- " 'INDEX.sizeInBytes': 6.426125764846802E-8," +
- " 'base_url': 'http://127.0.0.1:49221/solr'," +
- " 'node_name': '127.0.0.1:49221_solr'," +
- " 'state': 'active'," +
- " 'type': 'NRT'," +
- " 'shard': 'shard1'," +
- " 'collection': 'testScheduledTrigger'" +
- " }" +
- " }" +
- " ]" +
- " }" +
- " }" +
- " }," +
- " 'nodeValues': {" +
- " '127.0.0.1:49210_solr': {" +
- " 'node': '127.0.0.1:49210_solr'," +
- " 'cores': 2," +
- " 'freedisk': 197.39717864990234" +
- " }," +
- " '127.0.0.1:49221_solr': {" +
- " 'node': '127.0.0.1:49221_solr'," +
- " 'cores': 1," +
- " 'freedisk': 197.39717864990234" +
- " }" +
- " }," +
- " 'autoscalingJson': {" +
- " 'cluster-preferences': [" +
- " {" +
- " 'minimize': 'cores'," +
- " 'precision': 1" +
- " }," +
- " {" +
- " 'maximize': 'freedisk'" +
- " }" +
- " ]," +
- " 'cluster-policy': [" +
- " {" +
- " 'cores': '<3'," +
- " 'node': '#EACH'" +
- " }" +
- " ]" +
- " }" +
- "}";
- Map jsonObj = (Map) Utils.fromJSONString(state);
+ Map jsonObj = (Map) TestPolicy2.loadFromResource("testScheduledTriggerFailure.json");
SolrCloudManager cloudManager = createCloudManager(jsonObj);
Suggester suggester = createSuggester(cloudManager, jsonObj, null);
int count = 0;
@@ -2995,118 +2905,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
public void testUtilizeNodeFailure() throws Exception {
- String state = "{'liveNodes': ['127.0.0.1:50417_solr', '127.0.0.1:50418_solr', '127.0.0.1:50419_solr', '127.0.0.1:50420_solr', '127.0.0.1:50443_solr']," +
- " 'suggester': {" +
- " 'action': 'MOVEREPLICA'," +
- " 'hints': {'TARGET_NODE': ['127.0.0.1:50443_solr']}" +
- " }," +
- " 'replicaInfo': {" +
- " '127.0.0.1:50418_solr': {" +
- " 'utilizenodecoll': {" +
- " 'shard2': [" +
- " {" +
- " 'core_node7': {" +
- " 'core': 'utilizenodecoll_shard2_replica_n4'," +
- " 'leader': 'true'," +
- " 'INDEX.sizeInBytes': 6.426125764846802E-8," +
- " 'base_url': 'http://127.0.0.1:50418/solr'," +
- " 'node_name': '127.0.0.1:50418_solr'," +
- " 'state': 'active'," +
- " 'type': 'NRT'," +
- " 'shard': 'shard2'," +
- " 'collection': 'utilizenodecoll'" +
- " }" +
- " }" +
- " ]" +
- " }" +
- " }," +
- " '127.0.0.1:50417_solr': {" +
- " 'utilizenodecoll': {" +
- " 'shard2': [" +
- " {" +
- " 'core_node8': {" +
- " 'base_url': 'http://127.0.0.1:50417/solr'," +
- " 'node_name': '127.0.0.1:50417_solr'," +
- " 'core': 'utilizenodecoll_shard2_replica_n6'," +
- " 'state': 'active'," +
- " 'type': 'NRT'," +
- " 'INDEX.sizeInBytes': 6.426125764846802E-8," +
- " 'shard': 'shard2'," +
- " 'collection': 'utilizenodecoll'" +
- " }" +
- " }" +
- " ]" +
- " }" +
- " }," +
- " '127.0.0.1:50419_solr': {" +
- " 'utilizenodecoll': {" +
- " 'shard1': [" +
- " {" +
- " 'core_node5': {" +
- " 'base_url': 'http://127.0.0.1:50419/solr'," +
- " 'node_name': '127.0.0.1:50419_solr'," +
- " 'core': 'utilizenodecoll_shard1_replica_n2'," +
- " 'state': 'active'," +
- " 'type': 'NRT'," +
- " 'INDEX.sizeInBytes': 6.426125764846802E-8," +
- " 'shard': 'shard1'," +
- " 'collection': 'utilizenodecoll'" +
- " }" +
- " }" +
- " ]" +
- " }" +
- " }," +
- " '127.0.0.1:50420_solr': {" +
- " 'utilizenodecoll': {" +
- " 'shard1': [" +
- " {" +
- " 'core_node3': {" +
- " 'core': 'utilizenodecoll_shard1_replica_n1'," +
- " 'leader': 'true'," +
- " 'INDEX.sizeInBytes': 6.426125764846802E-8," +
- " 'base_url': 'http://127.0.0.1:50420/solr'," +
- " 'node_name': '127.0.0.1:50420_solr'," +
- " 'state': 'active'," +
- " 'type': 'NRT'," +
- " 'shard': 'shard1'," +
- " 'collection': 'utilizenodecoll'" +
- " }" +
- " }" +
- " ]" +
- " }" +
- " }," +
- " '127.0.0.1:50443_solr': {}" +
- " }," +
- " 'nodeValues': {" +
- " '127.0.0.1:50418_solr': {" +
- " 'cores': 1," +
- " 'freedisk': 187.70782089233398" +
- " }," +
- " '127.0.0.1:50417_solr': {" +
- " 'cores': 1," +
- " 'freedisk': 187.70782089233398" +
- " }," +
- " '127.0.0.1:50419_solr': {" +
- " 'cores': 1," +
- " 'freedisk': 187.70782089233398" +
- " }," +
- " '127.0.0.1:50420_solr': {" +
- " 'cores': 1," +
- " 'freedisk': 187.70782089233398" +
- " }," +
- " '127.0.0.1:50443_solr': {" +
- " 'cores': 0," +
- " 'freedisk': 187.70782089233398" +
- " }" +
- " }," +
- " 'autoscalingJson': {" +
- " 'cluster-preferences': [" +
- " {'minimize': 'cores', 'precision': 1}," +
- " {'maximize': 'freedisk'}" +
- " ]" +
- " }" +
- "}";
- Map jsonObj = (Map) Utils.fromJSONString(state);
+ Map jsonObj = (Map) TestPolicy2.loadFromResource("testUtilizeNodeFailure.json"); //(Map) Utils.fromJSONString(state);
SolrCloudManager cloudManager = createCloudManager(jsonObj);
Suggester suggester = createSuggester(cloudManager, jsonObj, null);
int count = 0;
@@ -3122,76 +2921,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
public void testUtilizeNodeFailure2() throws Exception {
- String state = "{ 'liveNodes':[" +
- " '127.0.0.1:51075_solr'," +
- " '127.0.0.1:51076_solr'," +
- " '127.0.0.1:51077_solr'," +
- " '127.0.0.1:51097_solr']," +
- " 'suggester':{" +
- " 'action':'MOVEREPLICA'," +
- " 'hints':{'TARGET_NODE':['127.0.0.1:51097_solr']}}," +
- " 'replicaInfo':{" +
- " '127.0.0.1:51076_solr':{'utilizenodecoll':{'shard1':[{'core_node5':{" +
- " 'base_url':'https://127.0.0.1:51076/solr'," +
- " 'node_name':'127.0.0.1:51076_solr'," +
- " 'core':'utilizenodecoll_shard1_replica_n2'," +
- " 'state':'active'," +
- " 'type':'NRT'," +
- " 'INDEX.sizeInBytes':6.426125764846802E-8," +
- " 'shard':'shard1'," +
- " 'collection':'utilizenodecoll'}}]}}," +
- " '127.0.0.1:51077_solr':{'utilizenodecoll':{" +
- " 'shard2':[{'core_node8':{" +
- " 'base_url':'https://127.0.0.1:51077/solr'," +
- " 'node_name':'127.0.0.1:51077_solr'," +
- " 'core':'utilizenodecoll_shard2_replica_n6'," +
- " 'state':'active'," +
- " 'type':'NRT'," +
- " 'INDEX.sizeInBytes':6.426125764846802E-8," +
- " 'shard':'shard2'," +
- " 'collection':'utilizenodecoll'}}]," +
- " 'shard1':[{'core_node3':{" +
- " 'core':'utilizenodecoll_shard1_replica_n1'," +
- " 'leader':'true'," +
- " 'INDEX.sizeInBytes':6.426125764846802E-8," +
- " 'base_url':'https://127.0.0.1:51077/solr'," +
- " 'node_name':'127.0.0.1:51077_solr'," +
- " 'state':'active'," +
- " 'type':'NRT'," +
- " 'shard':'shard1'," +
- " 'collection':'utilizenodecoll'}}]}}," +
- " '127.0.0.1:51097_solr':{}," +
- " '127.0.0.1:51075_solr':{'utilizenodecoll':{'shard2':[{'core_node7':{" +
- " 'core':'utilizenodecoll_shard2_replica_n4'," +
- " 'leader':'true'," +
- " 'INDEX.sizeInBytes':6.426125764846802E-8," +
- " 'base_url':'https://127.0.0.1:51075/solr'," +
- " 'node_name':'127.0.0.1:51075_solr'," +
- " 'state':'active'," +
- " 'type':'NRT'," +
- " 'shard':'shard2'," +
- " 'collection':'utilizenodecoll'}}]}}}," +
- " 'nodeValues':{" +
- " '127.0.0.1:51076_solr':{" +
- " 'cores':1," +
- " 'freedisk':188.7262191772461}," +
- " '127.0.0.1:51077_solr':{" +
- " 'cores':2," +
- " 'freedisk':188.7262191772461}," +
- " '127.0.0.1:51097_solr':{" +
- " 'cores':0," +
- " 'freedisk':188.7262191772461}," +
- " '127.0.0.1:51075_solr':{" +
- " 'cores':1," +
- " 'freedisk':188.7262191772461}}," +
- " 'autoscalingJson':{" +
- " 'cluster-preferences':[" +
- " {" +
- " 'minimize':'cores'," +
- " 'precision':1}," +
- " {'maximize':'freedisk'}]" +
- " }}";
- Map jsonObj = (Map) Utils.fromJSONString(state);
+ Map jsonObj = (Map) TestPolicy2.loadFromResource("testUtilizeNodeFailure2.json");
SolrCloudManager cloudManager = createCloudManager(jsonObj);
Suggester suggester = createSuggester(cloudManager, jsonObj, null);
int count = 0;
@@ -3207,271 +2937,12 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
//SOLR-12358
- public void testSortError() {
+ public void testSortError() throws IOException {
Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString("{cluster-preferences: [{minimize : cores, precision:1}, " +
"{maximize : freedisk, precision: 50}, " +
"{minimize: sysLoadAvg}]}"));
- String rowsData = "{'sortedNodes':[" +
- " {" +
- " 'node':'solr-01:8983_solr'," +
- " 'replicas':{}," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':2}," +
- " {'freedisk':1734.5261459350586}," +
- " {'sysLoadAvg':35.0}," +
- " {'node':'solr-01:8983_solr'}]}," +
- " {" +
- " 'node':'solr-07:8983_solr'," +
- " 'replicas':{}," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1721.5669250488281}," +
- " {'sysLoadAvg':10.0}," +
- " {'node':'solr-07:8983_solr'}]}," +
- " {" +
- " 'node':'solr-08:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1764.9518203735352}," +
- " {'sysLoadAvg':330.0}," +
- " {'node':'solr-08:8983_solr'}]}," +
- " {" +
- " 'node':'solr-25:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1779.7792778015137}," +
- " {'sysLoadAvg':304.0}," +
- " {'node':'solr-25:8983_solr'}]}," +
- " {" +
- " 'node':'solr-15:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1697.5930519104004}," +
- " {'sysLoadAvg':277.0}," +
- " {'node':'solr-15:8983_solr'}]}," +
- " {" +
- " 'node':'solr-13:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':2}," +
- " {'freedisk':1755.1909484863281}," +
- " {'sysLoadAvg':265.0}," +
- " {'node':'solr-13:8983_solr'}]}," +
- " {" +
- " 'node':'solr-14:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1757.6035423278809}," +
- " {'sysLoadAvg':61.0}," +
- " {'node':'solr-14:8983_solr'}]}," +
- " {" +
- " 'node':'solr-16:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1746.081386566162}," +
- " {'sysLoadAvg':260.0}," +
- " {'node':'solr-16:8983_solr'}]}," +
- " {" +
- " 'node':'solr-04:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':2}," +
- " {'freedisk':1708.7230529785156}," +
- " {'sysLoadAvg':216.0}," +
- " {'node':'solr-04:8983_solr'}]}," +
- " {" +
- " 'node':'solr-06:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1688.3182678222656}," +
- " {'sysLoadAvg':385.0}," +
- " {'node':'solr-06:8983_solr'}]}," +
- " {" +
- " 'node':'solr-02:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':6}," +
- " {'freedisk':1778.226963043213}," +
- " {'sysLoadAvg':369.0}," +
- " {'node':'solr-02:8983_solr'}]}," +
- " {" +
- " 'node':'solr-05:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1741.9401931762695}," +
- " {'sysLoadAvg':354.0}," +
- " {'node':'solr-05:8983_solr'}]}," +
- " {" +
- " 'node':'solr-23:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1718.854579925537}," +
- " {'sysLoadAvg':329.0}," +
- " {'node':'solr-23:8983_solr'}]}," +
- " {" +
- " 'node':'solr-24:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1733.6669311523438}," +
- " {'sysLoadAvg':327.0}," +
- " {'node':'solr-24:8983_solr'}]}," +
- " {" +
- " 'node':'solr-09:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1714.6191711425781}," +
- " {'sysLoadAvg':278.0}," +
- " {'node':'solr-09:8983_solr'}]}," +
- " {" +
- " 'node':'solr-10:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1755.3038482666016}," +
- " {'sysLoadAvg':266.0}," +
- " {'node':'solr-10:8983_solr'}]}," +
- " {" +
- " 'node':'solr-28:8983_solr'," +
- " 'isLive':false," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1691.3830909729004}," +
- " {'sysLoadAvg':261.0}," +
- " {'node':'solr-28:8983_solr'}]}," +
- " {" +
- " 'node':'solr-29:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':2}," +
- " {'freedisk':1706.797966003418}," +
- " {'sysLoadAvg':252.99999999999997}," +
- " {'node':'solr-29:8983_solr'}]}," +
- " {" +
- " 'node':'solr-32:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1762.432300567627}," +
- " {'sysLoadAvg':221.0}," +
- " {'node':'solr-32:8983_solr'}]}," +
- " {" +
- " 'node':'solr-21:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1760.9801979064941}," +
- " {'sysLoadAvg':213.0}," +
- " {'node':'solr-21:8983_solr'}]}," +
- " {" +
- " 'node':'solr-22:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1780.5297241210938}," +
- " {'sysLoadAvg':209.0}," +
- " {'node':'solr-22:8983_solr'}]}," +
- " {" +
- " 'node':'solr-31:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1700.1481628417969}," +
- " {'sysLoadAvg':211.0}," +
- " {'node':'solr-31:8983_solr'}]}," +
- " {" +
- " 'node':'solr-33:8983_solr'," +
- " 'isLive':false," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1748.1132926940918}," +
- " {'sysLoadAvg':199.0}," +
- " {'node':'solr-33:8983_solr'}]}," +
- " {" +
- " 'node':'solr-36:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1776.197639465332}," +
- " {'sysLoadAvg':193.0}," +
- " {'node':'solr-36:8983_solr'}]}," +
- " {" +
- " 'node':'solr-35:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1746.7729606628418}," +
- " {'sysLoadAvg':191.0}," +
- " {'node':'solr-35:8983_solr'}]}," +
- " {" +
- " 'node':'solr-12:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1713.287540435791}," +
- " {'sysLoadAvg':175.0}," +
- " {'node':'solr-12:8983_solr'}]}," +
- " {" +
- " 'node':'solr-11:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1736.784511566162}," +
- " {'sysLoadAvg':169.0}," +
- " {'node':'solr-11:8983_solr'}]}," +
- " {" +
- " 'node':'solr-35:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1766.9416885375977}," +
- " {'sysLoadAvg':155.0}," +
- " {'node':'solr-35:8983_solr'}]}," +
- " {" +
- " 'node':'solr-17:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1764.3425407409668}," +
- " {'sysLoadAvg':139.0}," +
- " {'node':'solr-17:8983_solr'}]}," +
- " {" +
- " 'node':'solr-18:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':2}," +
- " {'freedisk':1757.0613975524902}," +
- " {'sysLoadAvg':132.0}," +
- " {'node':'solr-18:8983_solr'}]}," +
- " {" +
- " 'node':'solr-20:8983_solr'," +
- " 'isLive':false," +
- " 'attributes':[" +
- " {'cores':3}," +
- " {'freedisk':1747.4205322265625}," +
- " {'sysLoadAvg':126.0}," +
- " {'node':'solr-20:8983_solr'}]}," +
- " {" +
- " 'node':'solr-27:8983_solr'," +
- " 'isLive':true," +
- " 'attributes':[" +
- " {'cores':4}," +
- " {'freedisk':1721.0442085266113}," +
- " {'sysLoadAvg':118.0}," +
- " {'node':'solr-27:8983_solr'}]}]}";
-
- List l = (List) ((Map) Utils.fromJSONString(rowsData)).get("sortedNodes");
+
+ List l = (List) TestPolicy2.loadFromResource("testSortError.json");
List<Variable.Type> params = new ArrayList<>();
params.add(CORES);
params.add(Variable.Type.FREEDISK);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e359c14/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java
index 5365e28..b274974 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java
@@ -18,6 +18,7 @@
package org.apache.solr.client.solrj.cloud.autoscaling;
import java.io.IOException;
+import java.io.InputStream;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.Arrays;
@@ -527,164 +528,10 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
}
};
}
- public void testSysPropSuggestions() {
- String diagnostics = "{" +
- " 'diagnostics': {" +
- " 'sortedNodes': [" +
- " {" +
- " 'node': '127.0.0.1:63191_solr'," +
- " 'isLive': true," +
- " 'cores': 3.0," +
- " 'sysprop.zone': 'east'," +
- " 'freedisk': 1727.1459312438965," +
- " 'heapUsage': 24.97510064011647," +
- " 'sysLoadAvg': 272.75390625," +
- " 'totaldisk': 1037.938980102539," +
- " 'replicas': {" +
- " 'zonesTest': {" +
- " 'shard1': [" +
- " {" +
- " 'core_node5': {" +
- " 'core': 'zonesTest_shard1_replica_n2'," +
- " 'leader': 'true'," +
- " 'base_url': 'https://127.0.0.1:63191/solr'," +
- " 'node_name': '127.0.0.1:63191_solr'," +
- " 'state': 'active'," +
- " 'type': 'NRT'," +
- " 'force_set_state': 'false'," +
- " 'INDEX.sizeInGB': 6.426125764846802E-8," +
- " 'shard': 'shard1'," +
- " 'collection': 'zonesTest'" +
- " }" +
- " }," +
- " {" +
- " 'core_node7': {" +
- " 'core': 'zonesTest_shard1_replica_n4'," +
- " 'base_url': 'https://127.0.0.1:63191/solr'," +
- " 'node_name': '127.0.0.1:63191_solr'," +
- " 'state': 'active'," +
- " 'type': 'NRT'," +
- " 'force_set_state': 'false'," +
- " 'INDEX.sizeInGB': 6.426125764846802E-8," +
- " 'shard': 'shard1'," +
- " 'collection': 'zonesTest'" +
- " }" +
- " }," +
- " {" +
- " 'core_node12': {" +
- " 'core': 'zonesTest_shard1_replica_n10'," +
- " 'base_url': 'https://127.0.0.1:63191/solr'," +
- " 'node_name': '127.0.0.1:63191_solr'," +
- " 'state': 'active'," +
- " 'type': 'NRT'," +
- " 'force_set_state': 'false'," +
- " 'INDEX.sizeInGB': 6.426125764846802E-8," +
- " 'shard': 'shard1'," +
- " 'collection': 'zonesTest'" +
- " }" +
- " }" +
- " ]" +
- " }" +
- " }" +
- " }," +
- " {" +
- " 'node': '127.0.0.1:63192_solr'," +
- " 'isLive': true," +
- " 'cores': 3.0," +
- " 'sysprop.zone': 'east'," +
- " 'freedisk': 1727.1459312438965," +
- " 'heapUsage': 24.98878807983566," +
- " 'sysLoadAvg': 272.75390625," +
- " 'totaldisk': 1037.938980102539," +
- " 'replicas': {" +
- " 'zonesTest': {" +
- " 'shard2': [" +
- " {" +
- " 'core_node3': {" +
- " 'core': 'zonesTest_shard1_replica_n1'," +
- " 'base_url': 'https://127.0.0.1:63192/solr'," +
- " 'node_name': '127.0.0.1:63192_solr'," +
- " 'state': 'active'," +
- " 'type': 'NRT'," +
- " 'force_set_state': 'false'," +
- " 'INDEX.sizeInGB': 6.426125764846802E-8," +
- " 'shard': 'shard2'," +
- " 'collection': 'zonesTest'" +
- " }" +
- " }," +
- " {" +
- " 'core_node9': {" +
- " 'core': 'zonesTest_shard1_replica_n6'," +
- " 'base_url': 'https://127.0.0.1:63192/solr'," +
- " 'node_name': '127.0.0.1:63192_solr'," +
- " 'state': 'active'," +
- " 'type': 'NRT'," +
- " 'force_set_state': 'false'," +
- " 'INDEX.sizeInGB': 6.426125764846802E-8," +
- " 'shard': 'shard2'," +
- " 'collection': 'zonesTest'" +
- " }" +
- " }," +
- " {" +
- " 'core_node11': {" +
- " 'core': 'zonesTest_shard1_replica_n8'," +
- " 'base_url': 'https://127.0.0.1:63192/solr'," +
- " 'node_name': '127.0.0.1:63192_solr'," +
- " 'state': 'active'," +
- " 'type': 'NRT'," +
- " 'force_set_state': 'false'," +
- " 'INDEX.sizeInGB': 6.426125764846802E-8," +
- " 'shard': 'shard2'," +
- " 'collection': 'zonesTest'" +
- " }" +
- " }" +
- " ]" +
- " }" +
- " }" +
- " }," +
- " {" +
- " 'node': '127.0.0.1:63219_solr'," +
- " 'isLive': true," +
- " 'cores': 0.0," +
- " 'sysprop.zone': 'west'," +
- " 'freedisk': 1768.6174201965332," +
- " 'heapUsage': 24.98878807983566," +
- " 'sysLoadAvg': 272.75390625," +
- " 'totaldisk': 1037.938980102539," +
- " 'replicas': {}" +
- " }," +
- " {" +
- " 'node': '127.0.0.1:63229_solr'," +
- " 'isLive': true," +
- " 'cores': 0.0," +
- " 'sysprop.zone': 'west'," +
- " 'freedisk': 1768.6174201965332," +
- " 'heapUsage': 24.98878807983566," +
- " 'sysLoadAvg': 272.75390625," +
- " 'totaldisk': 1037.938980102539," +
- " 'replicas': {}" +
- " }" +
- " ]," +
- " 'liveNodes': [" +
- " '127.0.0.1:63191_solr'," +
- " '127.0.0.1:63192_solr'," +
- " '127.0.0.1:63219_solr'," +
- " '127.0.0.1:63229_solr'" +
- " ]," +
- " 'config': {" +
- " 'cluster-preferences': [" +
- " {'minimize': 'cores', 'precision': 1}," +
- " {'maximize': 'freedisk', 'precision': 100}," +
- " {'minimize': 'sysLoadAvg', 'precision': 10}" +
- " ]," +
- " 'cluster-policy': [" +
- " {'replica': '<3', 'shard': '#EACH', 'sysprop.zone': [east, west]}" +
- " ]" +
- " }" +
- " }" +
- "}";
- Map<String, Object> m = (Map<String, Object>) Utils.fromJSONString(diagnostics);
+ public void testSysPropSuggestions() throws IOException {
+
+ Map<String, Object> m = (Map<String, Object>) loadFromResource("testSysPropSuggestions.json");
Map<String, Object> conf = (Map<String, Object>) Utils.getObjectByPath(m, false, "diagnostics/config");
Policy policy = new Policy(conf);
@@ -704,5 +551,10 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
}
}
+ public static Object loadFromResource(String file) throws IOException {
+ try (InputStream is = TestPolicy2.class.getResourceAsStream("/solrj/solr/autoscaling/" + file)) {
+ return Utils.fromJSON(is);
+ }
+ }
}