You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2012/09/15 21:01:35 UTC

svn commit: r1385155 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/core/ solr/core/src/java/org/apache/solr/cloud/ solr/core/src/java/org/apache/solr/handler/admin/ solr/core/src/test/org/apache/solr/cloud/

Author: markrmiller
Date: Sat Sep 15 19:01:34 2012
New Revision: 1385155

URL: http://svn.apache.org/viewvc?rev=1385155&view=rev
Log:
SOLR-3845: Rename numReplicas to replicationFactor in Collections API.

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/CHANGES.txt
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
    lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java

Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1385155&r1=1385154&r2=1385155&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Sat Sep 15 19:01:34 2012
@@ -276,6 +276,9 @@ 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 ===================
 
 

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java?rev=1385155&r1=1385154&r2=1385155&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java Sat Sep 15 19:01:34 2012
@@ -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
     // 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");

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java?rev=1385155&r1=1385154&r2=1385155&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java Sat Sep 15 19:01:34 2012
@@ -176,13 +176,13 @@ public class CollectionsHandler extends 
   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?

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java?rev=1385155&r1=1385154&r2=1385155&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java Sat Sep 15 19:01:34 2012
@@ -352,7 +352,7 @@ public class BasicDistributedZkTest exte
       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>();