mirror of https://github.com/apache/lucene.git
SOLR-7272: Use OverseerCollectionProcessor.ROUTER and DocCollection.DOC_ROUTER consistently
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1670178 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c6a5e65bd5
commit
21f4106873
|
@ -80,9 +80,9 @@ import static org.apache.solr.cloud.OverseerCollectionProcessor.ONLY_ACTIVE_NODE
|
||||||
import static org.apache.solr.cloud.OverseerCollectionProcessor.ONLY_IF_DOWN;
|
import static org.apache.solr.cloud.OverseerCollectionProcessor.ONLY_IF_DOWN;
|
||||||
import static org.apache.solr.cloud.OverseerCollectionProcessor.REPLICATION_FACTOR;
|
import static org.apache.solr.cloud.OverseerCollectionProcessor.REPLICATION_FACTOR;
|
||||||
import static org.apache.solr.cloud.OverseerCollectionProcessor.REQUESTID;
|
import static org.apache.solr.cloud.OverseerCollectionProcessor.REQUESTID;
|
||||||
import static org.apache.solr.cloud.OverseerCollectionProcessor.ROUTER;
|
|
||||||
import static org.apache.solr.cloud.OverseerCollectionProcessor.SHARDS_PROP;
|
import static org.apache.solr.cloud.OverseerCollectionProcessor.SHARDS_PROP;
|
||||||
import static org.apache.solr.cloud.OverseerCollectionProcessor.SHARD_UNIQUE;
|
import static org.apache.solr.cloud.OverseerCollectionProcessor.SHARD_UNIQUE;
|
||||||
|
import static org.apache.solr.common.cloud.DocCollection.DOC_ROUTER;
|
||||||
import static org.apache.solr.common.cloud.ZkNodeProps.makeMap;
|
import static org.apache.solr.common.cloud.ZkNodeProps.makeMap;
|
||||||
import static org.apache.solr.common.cloud.ZkStateReader.ACTIVE;
|
import static org.apache.solr.common.cloud.ZkStateReader.ACTIVE;
|
||||||
import static org.apache.solr.common.cloud.ZkStateReader.AUTO_ADD_REPLICAS;
|
import static org.apache.solr.common.cloud.ZkStateReader.AUTO_ADD_REPLICAS;
|
||||||
|
@ -901,7 +901,7 @@ public class CollectionsHandler extends RequestHandlerBase {
|
||||||
log.info("Create shard: " + req.getParamString());
|
log.info("Create shard: " + req.getParamString());
|
||||||
req.getParams().required().check(COLLECTION_PROP, SHARD_ID_PROP);
|
req.getParams().required().check(COLLECTION_PROP, SHARD_ID_PROP);
|
||||||
ClusterState clusterState = coreContainer.getZkController().getClusterState();
|
ClusterState clusterState = coreContainer.getZkController().getClusterState();
|
||||||
if(!ImplicitDocRouter.NAME.equals( ((Map) clusterState.getCollection(req.getParams().get(COLLECTION_PROP)).get(ROUTER)).get("name") ) )
|
if(!ImplicitDocRouter.NAME.equals( ((Map) clusterState.getCollection(req.getParams().get(COLLECTION_PROP)).get(DOC_ROUTER)).get("name") ) )
|
||||||
throw new SolrException(ErrorCode.BAD_REQUEST, "shards can be added only to 'implicit' collections" );
|
throw new SolrException(ErrorCode.BAD_REQUEST, "shards can be added only to 'implicit' collections" );
|
||||||
|
|
||||||
Map<String, Object> map = makeMap(QUEUE_OPERATION, CREATESHARD.toLower());
|
Map<String, Object> map = makeMap(QUEUE_OPERATION, CREATESHARD.toLower());
|
||||||
|
|
|
@ -58,8 +58,8 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static org.apache.solr.cloud.OverseerCollectionProcessor.NUM_SLICES;
|
import static org.apache.solr.cloud.OverseerCollectionProcessor.NUM_SLICES;
|
||||||
import static org.apache.solr.cloud.OverseerCollectionProcessor.ROUTER;
|
|
||||||
import static org.apache.solr.cloud.OverseerCollectionProcessor.SHARDS_PROP;
|
import static org.apache.solr.cloud.OverseerCollectionProcessor.SHARDS_PROP;
|
||||||
|
import static org.apache.solr.common.cloud.DocCollection.DOC_ROUTER;
|
||||||
import static org.apache.solr.common.cloud.ZkStateReader.MAX_SHARDS_PER_NODE;
|
import static org.apache.solr.common.cloud.ZkStateReader.MAX_SHARDS_PER_NODE;
|
||||||
import static org.apache.solr.common.cloud.ZkStateReader.REPLICATION_FACTOR;
|
import static org.apache.solr.common.cloud.ZkStateReader.REPLICATION_FACTOR;
|
||||||
import static org.apache.solr.common.params.ShardParams._ROUTE_;
|
import static org.apache.solr.common.params.ShardParams._ROUTE_;
|
||||||
|
@ -209,7 +209,7 @@ public class CustomCollectionTest extends AbstractFullDistribZkTestBase {
|
||||||
ClusterState clusterState = zkStateReader.getClusterState();
|
ClusterState clusterState = zkStateReader.getClusterState();
|
||||||
|
|
||||||
DocCollection coll = clusterState.getCollection(COLL_PREFIX + 0);
|
DocCollection coll = clusterState.getCollection(COLL_PREFIX + 0);
|
||||||
assertEquals("implicit", ((Map)coll.get(ROUTER)).get("name") );
|
assertEquals("implicit", ((Map)coll.get(DOC_ROUTER)).get("name") );
|
||||||
assertNotNull(coll.getStr(REPLICATION_FACTOR));
|
assertNotNull(coll.getStr(REPLICATION_FACTOR));
|
||||||
assertNotNull(coll.getStr(MAX_SHARDS_PER_NODE));
|
assertNotNull(coll.getStr(MAX_SHARDS_PER_NODE));
|
||||||
assertNull("A shard of a Collection configured with implicit router must have null range",
|
assertNull("A shard of a Collection configured with implicit router must have null range",
|
||||||
|
|
Loading…
Reference in New Issue