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

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1385154 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2012-09-15 18:59:16 +00:00
parent 9a7f34fc24
commit 95fea9de64
4 changed files with 9 additions and 5 deletions

View File

@ -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 ===================

View File

@ -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");

View File

@ -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?

View File

@ -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>();