Skip to content

Apache Lucene open-source search software

SOLR-3845: Rename numReplicas to replicationFactor in Collections API.

Mark Robert Miller95fea9de6498
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index cd1e5f86c73..891dfd3cfa3 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -280,6 +280,8 @@ Other Changes
* SOLR-3749: Allow default UpdateLog syncLevel to be configured by
solrconfig.xml (Raintung Li, Mark Miller)
+* SOLR-3845: Rename numReplicas to replicationFactor in Collections API.
+ (yonik, Mark Miller)
================== 4.0.0-BETA ===================
diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
index a26a04fd4b7..00d1fd06f68 100644
--- a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
@@ -42,6 +42,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class OverseerCollectionProcessor implements Runnable {
+ public static final String REPLICATION_FACTOR = "replicationFactor";
+
public static final String DELETECOLLECTION = "deletecollection";
public static final String CREATECOLLECTION = "createcollection";
@@ -153,12 +155,12 @@ public class OverseerCollectionProcessor implements Runnable {
// look at the replication factor and see if it matches reality
// if it does not, find best nodes to create more cores
- String numReplicasString = message.getStr("numReplicas");
+ String numReplicasString = message.getStr(REPLICATION_FACTOR);
int numReplicas;
try {
numReplicas = numReplicasString == null ? 0 : Integer.parseInt(numReplicasString);
} catch (Exception ex) {
- SolrException.log(log, "Could not parse numReplicas", ex);
+ SolrException.log(log, "Could not parse " + REPLICATION_FACTOR, ex);
return false;
}
String numShardsString = message.getStr("numShards");
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
index 25f1d0eefd4..dc2a95ba373 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
@@ -176,13 +176,13 @@ public class CollectionsHandler extends RequestHandlerBase {
private void handleCreateAction(SolrQueryRequest req,
SolrQueryResponse rsp) throws InterruptedException, KeeperException {
log.info("Creating Collection : " + req.getParamString());
- Integer numReplicas = req.getParams().getInt("numReplicas", 0);
+ Integer numReplicas = req.getParams().getInt(OverseerCollectionProcessor.REPLICATION_FACTOR, 0);
String name = req.getParams().required().get("name");
String configName = req.getParams().get("collection.configName");
String numShards = req.getParams().get("numShards");
ZkNodeProps m = new ZkNodeProps(Overseer.QUEUE_OPERATION,
- OverseerCollectionProcessor.CREATECOLLECTION, "numReplicas", numReplicas.toString(), "name", name,
+ OverseerCollectionProcessor.CREATECOLLECTION, OverseerCollectionProcessor.REPLICATION_FACTOR, numReplicas.toString(), "name", name,
"collection.configName", configName, "numShards", numShards);
// TODO: what if you want to block until the collection is available?
diff --git a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
index f7b32b2beb1..dcf3963f442 100644
--- a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
@@ -352,7 +352,7 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase {
int numShards = _TestUtil.nextInt(random(), 0, shardCount) + 1;
int numReplicas = _TestUtil.nextInt(random(), 0, 5) + 1;
params.set("numShards", numShards);
- params.set("numReplicas", numReplicas);
+ params.set(OverseerCollectionProcessor.REPLICATION_FACTOR, numReplicas);
String collectionName = "awholynewcollection_" + i;
int clientIndex = random().nextInt(2);
List<Integer> list = new ArrayList<Integer>();