mirror of https://github.com/apache/lucene.git
SOLR-5208: Support for the setting of core.properties key/values at create-time on Collections API
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1543969 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
51a45c9f4d
commit
4dc4d39cb9
|
@ -91,6 +91,9 @@ New Features
|
||||||
|
|
||||||
* SOLR-5456: Admin UI - Allow creating new Files (steffkes)
|
* SOLR-5456: Admin UI - Allow creating new Files (steffkes)
|
||||||
|
|
||||||
|
* SOLR-5208: Support for the setting of core.properties key/values at create-time on
|
||||||
|
Collections API (Erick Erickson)
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
|
||||||
|
|
||||||
public static final String COLL_CONF = "collection.configName";
|
public static final String COLL_CONF = "collection.configName";
|
||||||
|
|
||||||
|
public static final String COLL_PROP_PREFIX = "property.";
|
||||||
|
|
||||||
public static final Map<String,Object> COLL_PROPS = ZkNodeProps.makeMap(
|
public static final Map<String,Object> COLL_PROPS = ZkNodeProps.makeMap(
|
||||||
ROUTER, DocRouter.DEFAULT_NAME,
|
ROUTER, DocRouter.DEFAULT_NAME,
|
||||||
|
@ -545,6 +546,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
|
||||||
params.set(CoreAdminParams.COLLECTION, collectionName);
|
params.set(CoreAdminParams.COLLECTION, collectionName);
|
||||||
params.set(CoreAdminParams.SHARD, sliceName);
|
params.set(CoreAdminParams.SHARD, sliceName);
|
||||||
params.set(ZkStateReader.NUM_SHARDS_PROP, numSlices);
|
params.set(ZkStateReader.NUM_SHARDS_PROP, numSlices);
|
||||||
|
addPropertyParams(message, params);
|
||||||
|
|
||||||
ShardRequest sreq = new ShardRequest();
|
ShardRequest sreq = new ShardRequest();
|
||||||
params.set("qt", adminPath);
|
params.set("qt", adminPath);
|
||||||
|
@ -739,7 +741,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
|
||||||
params.set(CoreAdminParams.SHARD_RANGE, subRange.toString());
|
params.set(CoreAdminParams.SHARD_RANGE, subRange.toString());
|
||||||
params.set(CoreAdminParams.SHARD_STATE, Slice.CONSTRUCTION);
|
params.set(CoreAdminParams.SHARD_STATE, Slice.CONSTRUCTION);
|
||||||
params.set(CoreAdminParams.SHARD_PARENT, parentSlice.getName());
|
params.set(CoreAdminParams.SHARD_PARENT, parentSlice.getName());
|
||||||
|
addPropertyParams(message, params);
|
||||||
sendShardRequest(nodeName, params);
|
sendShardRequest(nodeName, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -849,6 +851,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
|
||||||
params.set(CoreAdminParams.NAME, shardName);
|
params.set(CoreAdminParams.NAME, shardName);
|
||||||
params.set(CoreAdminParams.COLLECTION, collectionName);
|
params.set(CoreAdminParams.COLLECTION, collectionName);
|
||||||
params.set(CoreAdminParams.SHARD, sliceName);
|
params.set(CoreAdminParams.SHARD, sliceName);
|
||||||
|
addPropertyParams(message, params);
|
||||||
// TODO: Figure the config used by the parent shard and use it.
|
// TODO: Figure the config used by the parent shard and use it.
|
||||||
//params.set("collection.configName", configName);
|
//params.set("collection.configName", configName);
|
||||||
|
|
||||||
|
@ -1287,6 +1290,14 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
|
||||||
shardHandler.submit(sreq, replica, sreq.params);
|
shardHandler.submit(sreq, replica, sreq.params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addPropertyParams(ZkNodeProps message, ModifiableSolrParams params) {
|
||||||
|
// Now add the property.key=value pairs
|
||||||
|
for (String key : message.keySet()) {
|
||||||
|
if (key.indexOf(COLL_PROP_PREFIX) != -1) {
|
||||||
|
params.set(key, message.getStr(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
private void createCollection(ClusterState clusterState, ZkNodeProps message, NamedList results) throws KeeperException, InterruptedException {
|
private void createCollection(ClusterState clusterState, ZkNodeProps message, NamedList results) throws KeeperException, InterruptedException {
|
||||||
String collectionName = message.getStr("name");
|
String collectionName = message.getStr("name");
|
||||||
if (clusterState.getCollections().contains(collectionName)) {
|
if (clusterState.getCollections().contains(collectionName)) {
|
||||||
|
@ -1401,6 +1412,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
|
||||||
params.set(CoreAdminParams.COLLECTION, collectionName);
|
params.set(CoreAdminParams.COLLECTION, collectionName);
|
||||||
params.set(CoreAdminParams.SHARD, sliceName);
|
params.set(CoreAdminParams.SHARD, sliceName);
|
||||||
params.set(ZkStateReader.NUM_SHARDS_PROP, numSlices);
|
params.set(ZkStateReader.NUM_SHARDS_PROP, numSlices);
|
||||||
|
addPropertyParams(message, params);
|
||||||
|
|
||||||
ShardRequest sreq = new ShardRequest();
|
ShardRequest sreq = new ShardRequest();
|
||||||
params.set("qt", adminPath);
|
params.set("qt", adminPath);
|
||||||
|
|
|
@ -318,6 +318,7 @@ public class CollectionsHandler extends RequestHandlerBase {
|
||||||
SHARDS_PROP,
|
SHARDS_PROP,
|
||||||
"router.");
|
"router.");
|
||||||
|
|
||||||
|
copyPropertiesIfNotNull(req.getParams(), props);
|
||||||
|
|
||||||
ZkNodeProps m = new ZkNodeProps(props);
|
ZkNodeProps m = new ZkNodeProps(props);
|
||||||
handleResponse(OverseerCollectionProcessor.CREATECOLLECTION, m, rsp);
|
handleResponse(OverseerCollectionProcessor.CREATECOLLECTION, m, rsp);
|
||||||
|
@ -342,6 +343,7 @@ public class CollectionsHandler extends RequestHandlerBase {
|
||||||
|
|
||||||
Map<String, Object> map = makeMap(QUEUE_OPERATION, CREATESHARD);
|
Map<String, Object> map = makeMap(QUEUE_OPERATION, CREATESHARD);
|
||||||
copyIfNotNull(req.getParams(),map,COLLECTION_PROP, SHARD_ID_PROP, REPLICATION_FACTOR,CREATE_NODE_SET);
|
copyIfNotNull(req.getParams(),map,COLLECTION_PROP, SHARD_ID_PROP, REPLICATION_FACTOR,CREATE_NODE_SET);
|
||||||
|
copyPropertiesIfNotNull(req.getParams(), map);
|
||||||
ZkNodeProps m = new ZkNodeProps(map);
|
ZkNodeProps m = new ZkNodeProps(map);
|
||||||
handleResponse(CREATESHARD, m, rsp);
|
handleResponse(CREATESHARD, m, rsp);
|
||||||
}
|
}
|
||||||
|
@ -373,6 +375,17 @@ public class CollectionsHandler extends RequestHandlerBase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void copyPropertiesIfNotNull(SolrParams params, Map<String, Object> props) {
|
||||||
|
Iterator<String> iter = params.getParameterNamesIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
String param = iter.next();
|
||||||
|
if (param.indexOf(OverseerCollectionProcessor.COLL_PROP_PREFIX) != -1) {
|
||||||
|
props.put(param, params.get(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void handleDeleteShardAction(SolrQueryRequest req,
|
private void handleDeleteShardAction(SolrQueryRequest req,
|
||||||
SolrQueryResponse rsp) throws InterruptedException, KeeperException {
|
SolrQueryResponse rsp) throws InterruptedException, KeeperException {
|
||||||
log.info("Deleting Shard : " + req.getParamString());
|
log.info("Deleting Shard : " + req.getParamString());
|
||||||
|
@ -420,6 +433,7 @@ public class CollectionsHandler extends RequestHandlerBase {
|
||||||
if (rangesStr != null) {
|
if (rangesStr != null) {
|
||||||
props.put(CoreAdminParams.RANGES, rangesStr);
|
props.put(CoreAdminParams.RANGES, rangesStr);
|
||||||
}
|
}
|
||||||
|
copyPropertiesIfNotNull(req.getParams(), props);
|
||||||
|
|
||||||
ZkNodeProps m = new ZkNodeProps(props);
|
ZkNodeProps m = new ZkNodeProps(props);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue