Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-10339: New set-trigger and remove-trigger APIs for autoscaling

Shalin Shekhar Mangar6904e0446856
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 9682e161d1c..3eac13fc349 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -71,6 +71,8 @@ New Features
* SOLR-10393: Adds UUID Streaming Evaluator (Dennis Gove)
+* SOLR-10339: New set-trigger and remove-trigger APIs for autoscaling. (shalin)
+
Bug Fixes
----------------------
* SOLR-9262: Connection and read timeouts are being ignored by UpdateShardHandler after SOLR-4509.
diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScaling.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScaling.java
index 5ab911005d7..560ce663fe4 100644
--- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScaling.java
+++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScaling.java
@@ -19,8 +19,6 @@ package org.apache.solr.cloud.autoscaling;
import java.util.Date;
import java.util.Map;
-import java.util.concurrent.TimeUnit;
-import java.util.function.Predicate;
public class AutoScaling {
diff --git a/solr/core/src/resources/apispec/autoscaling.Commands.json b/solr/core/src/resources/apispec/autoscaling.Commands.json
index 6cba77bb932..83f61d20d20 100644
--- a/solr/core/src/resources/apispec/autoscaling.Commands.json
+++ b/solr/core/src/resources/apispec/autoscaling.Commands.json
@@ -41,15 +41,39 @@
"actions": {
"type": "array",
"description": "The actions to be performed in sequence when the trigger is activated",
- "items": {
- "type": "object"
+ "event": {
+ "type": "string",
+ "description": "The event type on which to set a trigger"
+ },
+ "waitFor": {
+ "type": "string",
+ "description": "The amount of time to wait after the trigger condition is satisfied before trigger is activated"
+ },
+ "lowerBound": {
+ "type": "number",
+ "description": "The lower bound of the condition below which the trigger is activated"
+ },
+ "upperBound": {
+ "type": "number",
+ "description": "The upper bound of the condition below which the trigger is activated"
+ },
+ "enabled": {
+ "type": "boolean",
+ "description": "The state of the trigger"
+ },
+ "actions": {
+ "type": "array",
+ "description": "The actions to be performed in sequence when the trigger is activated",
+ "items": {
+ "type": "object"
+ }
}
- }
- },
- "required": [
- "name",
- "event"
- ]
+ },
+ "required": [
+ "name",
+ "event"
+ ]
+ }
},
"remove-trigger": {
"description": "Remove a trigger",
@@ -82,21 +106,21 @@
},
"stage": {
"type": "array",
- "description": "The stage of the trigger for which to listen"
+ "description": "The stage of the trigger for which to listen",
"items": {
"type" : "string"
}
},
"beforeAction": {
"type": "array",
- "description": "The name of the action before which the listener should be notified"
+ "description": "The name of the action before which the listener should be notified",
"items": {
"type" : "string"
}
},
"afterAction": {
"type": "array",
- "description": "The name of the action after which the listener should be notified"
+ "description": "The name of the action after which the listener should be notified",
"items": {
"type" : "string"
}
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
index d193219346f..e562ff9bd4a 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
@@ -195,16 +195,16 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
"\t\t\"waitFor\" : \"10m\",\n" +
"\t\t\"enabled\" : \"true\",\n" +
"\t\t\"actions\" : [\n" +
- "\t\t\t{\n" +
- "\t\t\t\t\"name\" : \"compute_plan\",\n" +
- "\t\t\t\t\"class\" : \"solr.ComputePlanAction\"\n" +
- "\t\t\t},\n" +
- "\t\t\t{\n" +
- "\t\t\t\t\"name\" : \"log_plan\",\n" +
- "\t\t\t\t\"class\" : \"solr.LogPlanAction\",\n" +
- "\t\t\t\t\"collection\" : \".system\"\n" +
- "\t\t\t}\n" +
- "\t\t]\n" +
+ "\t\t\t{\n" +
+ "\t\t\t\t\"name\" : \"compute_plan\",\n" +
+ "\t\t\t\t\"class\" : \"solr.ComputePlanAction\"\n" +
+ "\t\t\t},\n" +
+ "\t\t\t{\n" +
+ "\t\t\t\t\"name\" : \"log_plan\",\n" +
+ "\t\t\t\t\"class\" : \"solr.LogPlanAction\",\n" +
+ "\t\t\t\t\"collection\" : \".system\"\n" +
+ "\t\t\t}\n" +
+ "\t\t]\n" +
"\t}\n" +
"}";
SolrRequest req = new AutoScalingRequest(SolrRequest.METHOD.POST, path, setTriggerCommand);
@@ -358,4 +358,4 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
return null;
}
}
-}
+}
\ No newline at end of file