From b91dacee5f7fdea74b0aced43dae677ce6b1a4e2 Mon Sep 17 00:00:00 2001 From: Benedict Becker Date: Thu, 11 Oct 2018 11:43:13 -0400 Subject: [PATCH] SOLR-12853 Add ability to set CreateNodeList.shuffle parameter in Create collection requests --- .../solr/client/solrj/request/CollectionAdminRequest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java index 0f6de19f70e2..9f22ca27c729 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java @@ -428,6 +428,7 @@ public static class Create extends AsyncCollectionSpecificAdminRequest { protected Integer nrtReplicas; protected Integer pullReplicas; protected Integer tlogReplicas; + protected Boolean createNodeSetShuffle = null; protected Properties properties; protected Boolean autoAddReplicas; @@ -468,6 +469,7 @@ private Create(String collection, String config, String routerName, Integer numS public Create setNrtReplicas(Integer nrtReplicas) { this.nrtReplicas = nrtReplicas; return this;} public Create setTlogReplicas(Integer tlogReplicas) { this.tlogReplicas = tlogReplicas; return this;} public Create setPullReplicas(Integer pullReplicas) { this.pullReplicas = pullReplicas; return this;} + public Create setCreateNodeSetShuffle(boolean createNodeSetShuffle) { this.createNodeSetShuffle = createNodeSetShuffle; return this; } public Create setReplicationFactor(Integer repl) { this.nrtReplicas = repl; return this; } public Create setStateFormat(Integer stateFormat) { this.stateFormat = stateFormat; return this; } @@ -480,7 +482,8 @@ private Create(String collection, String config, String routerName, Integer numS public String getShards() { return shards; } public Integer getNumShards() { return numShards; } public Integer getMaxShardsPerNode() { return maxShardsPerNode; } - + public Boolean getCreateNodeSetShuffle() { return createNodeSetShuffle; } + public Integer getReplicationFactor() { return getNumNrtReplicas(); } public Integer getNumNrtReplicas() { return nrtReplicas; } public Boolean getAutoAddReplicas() { return autoAddReplicas; } @@ -536,6 +539,8 @@ public SolrParams getParams() { params.set("collection.configName", configName); if (createNodeSet != null) params.set(CREATE_NODE_SET_PARAM, createNodeSet); + if (createNodeSetShuffle != null) + params.set(CREATE_NODE_SET_SHUFFLE_PARAM, createNodeSetShuffle); if (numShards != null) { params.set( ZkStateReader.NUM_SHARDS_PROP, numShards); }