mirror of https://github.com/apache/lucene.git
SOLR-12846: Added support for "host" variable in autoscaling policy rules
This commit is contained in:
parent
8c70811f3a
commit
c31a95d261
|
@ -149,6 +149,9 @@ New Features
|
|||
* SOLR-12780: Add support for Leaky ReLU and TanH activations in contrib/ltr NeuralNetworkModel class.
|
||||
(Kamuela Lau, Christine Poerschke)
|
||||
|
||||
* SOLR-12846: Added support for "host" variable in autoscaling policy rules (noble)
|
||||
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -389,9 +389,11 @@ public class TestPolicyCloud extends SolrCloudTestCase {
|
|||
Map<String, Object> val = cloudManager.getNodeStateProvider().getNodeValues(rulesCollection.getReplicas().get(0).getNodeName(), Arrays.asList(
|
||||
"freedisk",
|
||||
"cores",
|
||||
"host",
|
||||
"heapUsage",
|
||||
"sysLoadAvg"));
|
||||
assertNotNull(val.get("freedisk"));
|
||||
assertNotNull(val.get("host"));
|
||||
assertNotNull(val.get("heapUsage"));
|
||||
assertNotNull(val.get("sysLoadAvg"));
|
||||
assertTrue(((Number) val.get("cores")).intValue() > 0);
|
||||
|
|
|
@ -205,6 +205,12 @@ public interface Variable {
|
|||
min = 0)
|
||||
NUMBER,
|
||||
|
||||
@Meta(name = "host",
|
||||
type = String.class,
|
||||
wildCards = Policy.EACH,
|
||||
supportArrayVals = true)
|
||||
HOST,
|
||||
|
||||
@Meta(name = "STRING",
|
||||
type = String.class,
|
||||
wildCards = Policy.EACH,
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
{"diagnostics":{
|
||||
"sortedNodes":[{
|
||||
"node":"127.0.0.191:63191_solr",
|
||||
"isLive":true,
|
||||
"cores":3.0,
|
||||
"host":"127.0.0.191",
|
||||
"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.191:63191/solr",
|
||||
"node_name":"127.0.0.191: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.191:63191/solr",
|
||||
"node_name":"127.0.0.191: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.191:63191/solr",
|
||||
"node_name":"127.0.0.191:63191_solr",
|
||||
"state":"active",
|
||||
"type":"NRT",
|
||||
"force_set_state":"false",
|
||||
"INDEX.sizeInGB":6.426125764846802E-8,
|
||||
"shard":"shard1",
|
||||
"collection":"zonesTest"}}]}}},
|
||||
{
|
||||
"node":"127.0.0.191:63192_solr",
|
||||
"isLive":true,
|
||||
"cores":3.0,
|
||||
"host":"127.0.0.191",
|
||||
"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.191:63192/solr",
|
||||
"node_name":"127.0.0.191: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.191:63192/solr",
|
||||
"node_name":"127.0.0.191: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.191:63192/solr",
|
||||
"node_name":"127.0.0.191:63192_solr",
|
||||
"state":"active",
|
||||
"type":"NRT",
|
||||
"force_set_state":"false",
|
||||
"INDEX.sizeInGB":6.426125764846802E-8,
|
||||
"shard":"shard2",
|
||||
"collection":"zonesTest"}}]}}},
|
||||
{
|
||||
"node":"127.0.0.219:63219_solr",
|
||||
"isLive":true,
|
||||
"cores":0.0,
|
||||
"host":"127.0.0.219",
|
||||
"sysprop.zone":"west",
|
||||
"freedisk":1768.6174201965332,
|
||||
"heapUsage":24.98878807983566,
|
||||
"sysLoadAvg":272.75390625,
|
||||
"totaldisk":1037.938980102539,
|
||||
"replicas":{}},
|
||||
{
|
||||
"node":"127.0.0.219:63229_solr",
|
||||
"isLive":true,
|
||||
"cores":0.0,
|
||||
"host":"127.0.0.219",
|
||||
"sysprop.zone":"west",
|
||||
"freedisk":1768.6174201965332,
|
||||
"heapUsage":24.98878807983566,
|
||||
"sysLoadAvg":272.75390625,
|
||||
"totaldisk":1037.938980102539,
|
||||
"replicas":{}}],
|
||||
"liveNodes":["127.0.0.191:63191_solr",
|
||||
"127.0.0.191:63192_solr",
|
||||
"127.0.0.219:63219_solr",
|
||||
"127.0.0.219:63229_solr"],
|
||||
"config":{
|
||||
"cluster-preferences":[{
|
||||
"minimize":"cores",
|
||||
"precision":1},
|
||||
{"maximize":"freedisk",
|
||||
"precision":100}],
|
||||
"cluster-policy":[{
|
||||
"replica":"<3",
|
||||
"shard":"#EACH",
|
||||
"host":["127.0.0.191",
|
||||
"127.0.0.219:63219"]}]}}}
|
|
@ -291,7 +291,7 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
|
|||
return new DelegatingClusterStateProvider(null) {
|
||||
|
||||
@Override
|
||||
public ClusterState getClusterState() throws IOException {
|
||||
public ClusterState getClusterState() {
|
||||
return clusterState;
|
||||
}
|
||||
|
||||
|
@ -309,7 +309,25 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
|
|||
};
|
||||
}
|
||||
|
||||
public void testSysPropSuggestions() throws IOException {
|
||||
public void testHostAttribute() {
|
||||
Map<String, Object> m = (Map<String, Object>) loadFromResource("testHostAttribute.json");
|
||||
Map<String, Object> conf = (Map<String, Object>) Utils.getObjectByPath(m, false, "diagnostics/config");
|
||||
Policy policy = new Policy(conf);
|
||||
SolrCloudManager cloudManagerFromDiagnostics = createCloudManagerFromDiagnostics(m);
|
||||
Policy.Session session = policy.createSession(cloudManagerFromDiagnostics);
|
||||
List<Violation> violations = session.getViolations();
|
||||
for (Violation violation : violations) {
|
||||
assertEquals(1.0d, violation.replicaCountDelta.doubleValue(), 0.0001);
|
||||
}
|
||||
assertEquals(2, violations.size());
|
||||
List<Suggester.SuggestionInfo> suggestions = PolicyHelper.getSuggestions(new AutoScalingConfig(conf), cloudManagerFromDiagnostics);
|
||||
assertEquals(2, suggestions.size());
|
||||
for (Suggester.SuggestionInfo suggestion : suggestions) {
|
||||
assertTrue(ImmutableSet.of("127.0.0.219:63219_solr", "127.0.0.219:63229_solr").contains(
|
||||
suggestion._get("operation/command/move-replica/targetNode", null)));
|
||||
}
|
||||
}
|
||||
public void testSysPropSuggestions() {
|
||||
|
||||
Map<String, Object> m = (Map<String, Object>) loadFromResource("testSysPropSuggestions.json");
|
||||
|
||||
|
|
Loading…
Reference in New Issue