SOLR-7104: Propagate property prefix params for ADDREPLICA

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1660551 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Anshum Gupta 2015-02-18 01:00:33 +00:00
parent 8a254abccd
commit d17e0ec7f4
3 changed files with 16 additions and 0 deletions

View File

@ -139,6 +139,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

View File

@ -1023,6 +1023,7 @@ public class CollectionsHandler extends RequestHandlerBase {
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);
}

View File

@ -46,6 +46,7 @@ import org.apache.solr.common.cloud.ZkCoreNodeProps;
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 CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
clusterPropTest();
// last
deleteCollectionWithDownNodes();
addReplicaTest();
if (DEBUG) {
super.printLayout();
@ -1115,6 +1118,10 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
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 CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
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);
}
}