You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by an...@apache.org on 2015/02/18 02:01:48 UTC

svn commit: r1660552 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/CHANGES.txt solr/core/ solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java

Author: anshum
Date: Wed Feb 18 01:01:48 2015
New Revision: 1660552

URL: http://svn.apache.org/r1660552
Log:
SOLR-7104: Propagate property prefix params for ADDREPLICA (merge from trunk)

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/core/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
    lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1660552&r1=1660551&r2=1660552&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Wed Feb 18 01:01:48 2015
@@ -91,6 +91,9 @@ Bug Fixes
   operate on stale cluster state due to overseer holding the state update lock for a
   long time. (Mark Miller, shalin)
 
+* SOLR-7104: Propagate property prefix parameters for ADDREPLICA Collections API call.
+  (Varun Thacker via Anshum Gupta)
+
 Optimizations
 ----------------------
  * SOLR-7049: Move work done by the LIST Collections API call to the Collections

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java?rev=1660552&r1=1660551&r2=1660552&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java Wed Feb 18 01:01:48 2015
@@ -1023,6 +1023,7 @@ public class CollectionsHandler extends
     props.put(Overseer.QUEUE_OPERATION, CollectionAction.ADDREPLICA.toString());
     copyIfNotNull(req.getParams(), props, COLLECTION_PROP, "node", SHARD_ID_PROP, ShardParams._ROUTE_,
         CoreAdminParams.NAME, CoreAdminParams.INSTANCE_DIR, CoreAdminParams.DATA_DIR, ASYNC);
+    copyPropertiesIfNotNull(req.getParams(), props);
     ZkNodeProps m = new ZkNodeProps(props);
     handleResponse(CollectionAction.ADDREPLICA.toString(), m, rsp);
   }

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java?rev=1660552&r1=1660551&r2=1660552&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java Wed Feb 18 01:01:48 2015
@@ -46,6 +46,7 @@ import org.apache.solr.common.cloud.ZkCo
 import org.apache.solr.common.cloud.ZkNodeProps;
 import org.apache.solr.common.cloud.ZkStateReader;
 import org.apache.solr.common.params.CollectionParams.CollectionAction;
+import org.apache.solr.common.params.CoreAdminParams;
 import org.apache.solr.common.params.MapSolrParams;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.NamedList;
@@ -80,6 +81,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Objects;
+import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.CompletionService;
 import java.util.concurrent.ExecutorCompletionService;
@@ -197,6 +199,7 @@ public class CollectionsAPIDistributedZk
     clusterPropTest();
     // last
     deleteCollectionWithDownNodes();
+    addReplicaTest();
 
     if (DEBUG) {
       super.printLayout();
@@ -1115,6 +1118,10 @@ public class CollectionsAPIDistributedZk
       addReplica = new CollectionAdminRequest.AddReplica();
       addReplica.setCollectionName(collectionName);
       addReplica.setShardName("shard2");
+      Properties props = new Properties();
+      String instancePathStr = createTempDir().toString();
+      props.put(CoreAdminParams.INSTANCE_DIR, instancePathStr); //Use name via the property.instanceDir method
+      addReplica.setProperties(props);
       client.request(addReplica);
 
       timeout = System.currentTimeMillis() + 3000;
@@ -1127,6 +1134,11 @@ public class CollectionsAPIDistributedZk
 
       assertNotNull(newReplica);
 
+      HttpSolrClient coreclient = new HttpSolrClient(newReplica.getStr(ZkStateReader.BASE_URL_PROP));
+      CoreAdminResponse status = CoreAdminRequest.getStatus(newReplica.getStr("core"), coreclient);
+      NamedList<Object> coreStatus = status.getCoreStatus(newReplica.getStr("core"));
+      String instanceDirStr = (String) coreStatus.get("instanceDir");
+      assertEquals(Paths.get(instanceDirStr).toString(), instancePathStr);
     }
 
   }