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/15 07:41:57 UTC
lucene-solr:apiv2: SOLR-8029: balanceshardunique added
Repository: lucene-solr
Updated Branches:
refs/heads/apiv2 cf1bbc3d7 -> c47ea512b
SOLR-8029: balanceshardunique 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/c47ea512
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/c47ea512
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/c47ea512
Branch: refs/heads/apiv2
Commit: c47ea512b8d483a8ccf47373ce6a6e4028a5ecca
Parents: cf1bbc3
Author: Noble Paul <no...@apache.org>
Authored: Thu Sep 15 13:11:40 2016 +0530
Committer: Noble Paul <no...@apache.org>
Committed: Thu Sep 15 13:11:40 2016 +0530
----------------------------------------------------------------------
.../solr/handler/admin/CollectionHandlerApi.java | 5 +++--
.../apispec/collections.collection.Commands.json | 18 ++++++++++++++++++
.../solr/handler/admin/TestCollectionAPIs.java | 5 +++++
3 files changed, 26 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c47ea512/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 df35a99..b7881d1 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
@@ -183,9 +183,10 @@ public class CollectionHandlerApi extends BaseHandlerApiSupport {
@Override
public void invoke(SolrQueryRequest req, SolrQueryResponse rsp, BaseHandlerApiSupport apiHandler) throws Exception {
rsp.add("nodes", ((CollectionHandlerApi) apiHandler).handler.coreContainer.getZkController().getClusterState().getLiveNodes());
- ;
}
- }
+ },
+ BALANCESHARDUNIQUE(EndPoint.PER_COLLECTION, POST, BALANCESHARDUNIQUE_OP, "balanceshardunique",null)
+
;
public final String commandName;
public final EndPoint endPoint;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c47ea512/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 98553ca..18ecd67 100644
--- a/solr/core/src/resources/apispec/collections.collection.Commands.json
+++ b/solr/core/src/resources/apispec/collections.collection.Commands.json
@@ -12,6 +12,24 @@
"commands": {
"modify": "collections.collection.Commands.modify",
"reload": "collections.collection.Commands.reload",
+ "balanceshardunique":{
+ "type":"object",
+ "properties":{
+ "onlyactivenodes":{
+ "type":"boolean",
+ "description":"Defaults to true. Normally, the property is instantiated on active nodes only. If this parameter is specified as 'false', then inactive nodes are also included for distribution."
+
+ },
+ "shardUnique":{
+ "type":"boolean",
+ "description":"Something of a safety valve. There is one pre-defined property (preferredLeader) that defaults this value to 'true'. For all other properties that are balanced, this must be set to 'true' or an error message is returned."
+ },
+ "property":{
+ "type":"string",
+ "description": "the actual property"
+ }
+ }
+ },
"rebalance-leaders" :{
"type":"object",
"properties":{
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c47ea512/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 8d0dd41..5f09aaf 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
@@ -131,6 +131,11 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {
"{operation : removerole ,role : overseer, node : 'localhost_8978'}"
);
+ compareOutput(apiBag, "/collections/coll1", POST,
+ "{balanceshardunique : {property: preferredLeader} }", null,
+ "{operation : balanceshardunique ,collection : coll1, property : preferredLeader}"
+ );
+
System.out.println();