mirror of https://github.com/apache/lucene.git
SOLR-11522: /autoscaling/suggestions now include rebalance options as well even if there are no violations
This commit is contained in:
parent
2b4717c6f4
commit
e16d7d6993
|
@ -80,7 +80,12 @@ public interface MapWriter extends MapSerializable {
|
|||
|
||||
void writeMap(EntryWriter ew) throws IOException;
|
||||
|
||||
|
||||
/**Get a child object value using json path
|
||||
*
|
||||
* @param path the full path to that object such as a/b/c[4]/d etc
|
||||
* @param def the default
|
||||
* @return the found value or default
|
||||
*/
|
||||
default Object _get(String path, Object def) {
|
||||
Object v = Utils.getObjectByPath(this, false, path);
|
||||
return v == null ? def : v;
|
||||
|
|
|
@ -2666,7 +2666,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
|
|||
List<Suggester.SuggestionInfo> suggestions = PolicyHelper.getSuggestions(cfg, cloudManagerWithData(dataproviderdata));
|
||||
assertEquals(2, suggestions.size());
|
||||
for (Suggester.SuggestionInfo suggestion : suggestions) {
|
||||
Utils.getObjectByPath(suggestion, true, "operation/move-replica/targetNode");
|
||||
suggestion._get("operation/move-replica/targetNode", null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
|
|||
suggestions = PolicyHelper.getSuggestions(new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson))
|
||||
, createCloudManager(state, metaData));
|
||||
assertEquals(1, suggestions.size());
|
||||
String repName = (String) Utils.getObjectByPath(suggestions.get(0).operation, true, "command/move-replica/replica");
|
||||
String repName = (String) suggestions.get(0)._get("operation/command/move-replica/replica", null);
|
||||
|
||||
AtomicBoolean found = new AtomicBoolean(false);
|
||||
session.getNode("node1").forEachReplica(replicaInfo -> {
|
||||
|
@ -372,7 +372,7 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
|
|||
assertEquals(2, suggestions.size());
|
||||
for (Suggester.SuggestionInfo suggestion : suggestions) {
|
||||
assertTrue(ImmutableSet.of("127.0.0.1:63219_solr", "127.0.0.1:63229_solr").contains(
|
||||
Utils.getObjectByPath(suggestion, true, "operation/command/move-replica/targetNode")));
|
||||
suggestion._get("operation/command/move-replica/targetNode", null)));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue