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 2016/09/20 12:39:08 UTC

lucene-solr:apiv2: SOLR-8029: more cleanup of specs. migrate-docs added

Repository: lucene-solr
Updated Branches:
  refs/heads/apiv2 e0a09f537 -> b96c56d36


SOLR-8029: more cleanup of specs. migrate-docs added


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

Branch: refs/heads/apiv2
Commit: b96c56d36b4bc572a6814c3caddd39c8bdbce670
Parents: e0a09f5
Author: Noble Paul <no...@apache.org>
Authored: Tue Sep 20 18:08:54 2016 +0530
Committer: Noble Paul <no...@apache.org>
Committed: Tue Sep 20 18:08:54 2016 +0530

----------------------------------------------------------------------
 .../src/java/org/apache/solr/api/ApiBag.java    |  1 -
 .../handler/admin/CollectionHandlerApi.java     |  5 +++--
 .../apache/solr/util/JsonSchemaValidator.java   |  5 ++++-
 .../apispec/cluster.commandstatus.delete.json   | 10 +++++++++
 .../apispec/cluster.commandstatus.json          |  9 ++++++--
 .../collections.collection.Commands.json        | 22 ++++++++++++++++++++
 .../solr/handler/admin/TestCollectionAPIs.java  |  7 ++++++-
 .../org/apache/solr/util/JsonValidatorTest.java |  1 -
 8 files changed, 52 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b96c56d3/solr/core/src/java/org/apache/solr/api/ApiBag.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/api/ApiBag.java b/solr/core/src/java/org/apache/solr/api/ApiBag.java
index 0660f43..1f55ed6 100644
--- a/solr/core/src/java/org/apache/solr/api/ApiBag.java
+++ b/solr/core/src/java/org/apache/solr/api/ApiBag.java
@@ -108,7 +108,6 @@ public class ApiBag {
         for (Object o : params.keySet()) {
           ValidatingJsonMap param = params.getMap(o.toString(), NOT_NULL);
           param.get("type", ENUM_OF, KNOWN_TYPES);
-          param.get("description", NOT_NULL);
         }
       }
       List<String> paths = url.getList("paths", NOT_NULL);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b96c56d3/solr/core/src/java/org/apache/solr/handler/admin/CollectionHandlerApi.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CollectionHandlerApi.java b/solr/core/src/java/org/apache/solr/handler/admin/CollectionHandlerApi.java
index ae5938b..8f860e7 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/CollectionHandlerApi.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/CollectionHandlerApi.java
@@ -63,7 +63,8 @@ public class CollectionHandlerApi extends BaseHandlerApiSupport {
     GET_COLLECTIONS(EndPoint.COLLECTIONS, GET, LIST_OP),
     GET_CLUSTER(EndPoint.CLUSTER, GET, LIST_OP, "/cluster", null),
     GET_CLUSTER_OVERSEER(EndPoint.CLUSTER, GET, OVERSEERSTATUS_OP, "/cluster/overseer", null),
-    GET_CLUSTER_CMD(EndPoint.CLUSTER_CMD_STATUS, GET, REQUESTSTATUS_OP),
+    GET_CLUSTER_STATUS_CMD(EndPoint.CLUSTER_CMD_STATUS, GET, REQUESTSTATUS_OP),
+    DELETE_CLUSTER_STATUS(EndPoint.CLUSTER_CMD_STATUS_DELETE, DELETE, DELETESTATUS_OP),
     GET_A_COLLECTION(EndPoint.COLLECTION_STATE, GET, CLUSTERSTATUS_OP),
     CREATE_COLLECTION(EndPoint.COLLECTIONS_COMMANDS,
         POST,
@@ -91,7 +92,6 @@ public class CollectionHandlerApi extends BaseHandlerApiSupport {
         POST,
         MODIFYCOLLECTION_OP,
         "modify",null),
-
     MIGRATE_DOCS(EndPoint.PER_COLLECTION,
         POST,
         MIGRATE_OP,
@@ -292,6 +292,7 @@ public class CollectionHandlerApi extends BaseHandlerApiSupport {
     CLUSTER_CMD("cluster.Commands"),
     CLUSTER_NODES("cluster.nodes"),
     CLUSTER_CMD_STATUS("cluster.commandstatus"),
+    CLUSTER_CMD_STATUS_DELETE("cluster.commandstatus.delete"),
     COLLECTIONS_COMMANDS("collections.Commands"),
     COLLECTIONS("collections"),
     COLLECTION_STATE("collection"),

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b96c56d3/solr/core/src/java/org/apache/solr/util/JsonSchemaValidator.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/util/JsonSchemaValidator.java b/solr/core/src/java/org/apache/solr/util/JsonSchemaValidator.java
index 65875d5..1284678 100644
--- a/solr/core/src/java/org/apache/solr/util/JsonSchemaValidator.java
+++ b/solr/core/src/java/org/apache/solr/util/JsonSchemaValidator.java
@@ -73,7 +73,10 @@ public class JsonSchemaValidator {
         errs.add("'type' is missing ");
       }
       Type type = Type.get(typeStr);
-      if (type == null) throw new RuntimeException("Unknown type " + typeStr);
+      if (type == null) {
+        errs.add ("Unknown type " + typeStr + "in object "+ Utils.toJSONString(jsonSchema));
+        return;
+      }
       this.type = type;
 
       for (SchemaAttribute schemaAttribute : SchemaAttribute.values()) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b96c56d3/solr/core/src/resources/apispec/cluster.commandstatus.delete.json
----------------------------------------------------------------------
diff --git a/solr/core/src/resources/apispec/cluster.commandstatus.delete.json b/solr/core/src/resources/apispec/cluster.commandstatus.delete.json
new file mode 100644
index 0000000..5576c42
--- /dev/null
+++ b/solr/core/src/resources/apispec/cluster.commandstatus.delete.json
@@ -0,0 +1,10 @@
+{
+  "methods": [
+    "DELETE"
+  ],
+  "url": {
+    "paths": [
+      "/cluster/command-status/{id}"
+    ]
+  }
+}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b96c56d3/solr/core/src/resources/apispec/cluster.commandstatus.json
----------------------------------------------------------------------
diff --git a/solr/core/src/resources/apispec/cluster.commandstatus.json b/solr/core/src/resources/apispec/cluster.commandstatus.json
index f608299..daa0763 100644
--- a/solr/core/src/resources/apispec/cluster.commandstatus.json
+++ b/solr/core/src/resources/apispec/cluster.commandstatus.json
@@ -1,11 +1,16 @@
 {
-  "documentation": "https://cwiki.apache.org/confluence/display/solr/Config+API",
   "methods": [
     "GET"
   ],
   "url": {
     "paths": [
       "/cluster/command-status/{id}"
-    ]
+    ],
+    "params": {
+      "flush": {
+        "type": "boolean",
+        "default": false
+      }
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b96c56d3/solr/core/src/resources/apispec/collections.collection.Commands.json
----------------------------------------------------------------------
diff --git a/solr/core/src/resources/apispec/collections.collection.Commands.json b/solr/core/src/resources/apispec/collections.collection.Commands.json
index aa30351..ac2120e 100644
--- a/solr/core/src/resources/apispec/collections.collection.Commands.json
+++ b/solr/core/src/resources/apispec/collections.collection.Commands.json
@@ -12,6 +12,28 @@
   "commands": {
     "modify": "collections.collection.Commands.modify",
     "reload": "collections.collection.Commands.reload",
+    "migrate-docs":{
+      "type":"object",
+      "documentation":"https://cwiki.apache.org/confluence/display/solr/Collections+API#CollectionsAPI-api12",
+      "properties":{
+        "target":{
+          "type":"string",
+          "description":"The name of the target collection to which documents will be migrated"
+        },
+        "splitKey":{
+          "type":"string",
+          "description":"he routing key prefix. For example, if uniqueKey is a!123, then you would use split.key=a!"
+        },
+        "forwardTimeout":{
+          "type":"integer",
+          "description":"The timeout, in seconds, until which write requests made to the source collection for the given split.key will be forwarded to the target shard. The default is 60 seconds."
+        },
+        "async": {
+          "type": "string",
+          "description": "Request ID to track this action which will be processed asynchronously"
+        }
+      }
+    },
     "balanceshardunique":{
       "type":"object",
       "properties":{

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b96c56d3/solr/core/src/test/org/apache/solr/handler/admin/TestCollectionAPIs.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/admin/TestCollectionAPIs.java b/solr/core/src/test/org/apache/solr/handler/admin/TestCollectionAPIs.java
index 537c4dc..78f9911 100644
--- a/solr/core/src/test/org/apache/solr/handler/admin/TestCollectionAPIs.java
+++ b/solr/core/src/test/org/apache/solr/handler/admin/TestCollectionAPIs.java
@@ -136,6 +136,11 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {
         "{operation : balanceshardunique ,collection : coll1, property : preferredLeader}"
     );
 
+    compareOutput(apiBag, "/collections/coll1", POST,
+        "{migrate-docs : {forwardTimeout: 1800, target: coll2, splitKey: 'a123!'} }", null,
+        "{operation : migrate ,collection : coll1, target.collection:coll2, forward.timeout:1800, split.key:'a123!'}"
+    );
+
   }
 
   ZkNodeProps compareOutput(final ApiBag apiBag, final String path, final SolrRequest.METHOD method,
@@ -195,7 +200,7 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {
       if (actualVal instanceof String[]) {
         actualVal = Arrays.asList((String[]) actualVal);
       }
-      assertEquals(errorMessage(expected, actual), e.getValue(), actualVal);
+      assertEquals(errorMessage(expected, actual), String.valueOf(e.getValue()),String.valueOf(actualVal));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b96c56d3/solr/core/src/test/org/apache/solr/util/JsonValidatorTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/util/JsonValidatorTest.java b/solr/core/src/test/org/apache/solr/util/JsonValidatorTest.java
index 38210b7..f142eb5 100644
--- a/solr/core/src/test/org/apache/solr/util/JsonValidatorTest.java
+++ b/solr/core/src/test/org/apache/solr/util/JsonValidatorTest.java
@@ -36,7 +36,6 @@ public class JsonValidatorTest extends SolrTestCaseJ4 {
     checkSchema("collections.collection.Commands");
     checkSchema("collections.collection.shards.Commands");
     checkSchema("collections.collection.shards.shard.Commands");
-    checkSchema("collections.collection.shards.shard.replica.Commands");
     checkSchema("cores.Commands");
     checkSchema("cores.core.Commands");
     checkSchema("node.Commands");