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/04/03 12:00:56 UTC

[13/13] lucene-solr:feature/autoscaling: SOLR-10339: New set-trigger and remove-trigger APIs for autoscaling

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


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/6904e044
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/6904e044
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/6904e044

Branch: refs/heads/feature/autoscaling
Commit: 6904e044685690acbd9060a471606b8fbb58c322
Parents: a4f5dc5
Author: Shalin Shekhar Mangar <sh...@apache.org>
Authored: Fri Mar 24 13:11:10 2017 +0530
Committer: Shalin Shekhar Mangar <sh...@apache.org>
Committed: Mon Apr 3 17:30:26 2017 +0530

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  2 +
 .../solr/cloud/autoscaling/AutoScaling.java     |  2 -
 .../resources/apispec/autoscaling.Commands.json | 46 +++++++++++++++-----
 .../autoscaling/AutoScalingHandlerTest.java     | 22 +++++-----
 4 files changed, 48 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6904e044/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 9682e16..3eac13f 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.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6904e044/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScaling.java
----------------------------------------------------------------------
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 5ab9110..560ce66 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 {
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6904e044/solr/core/src/resources/apispec/autoscaling.Commands.json
----------------------------------------------------------------------
diff --git a/solr/core/src/resources/apispec/autoscaling.Commands.json b/solr/core/src/resources/apispec/autoscaling.Commands.json
index 6cba77b..83f61d2 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"
           }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6904e044/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
----------------------------------------------------------------------
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 d193219..e562ff9 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