mirror of https://github.com/apache/lucene.git
SOLR-5296: Creating a collection with implicit router adds shard ranges to each shard
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1528440 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b883f6f5b8
commit
dd1fb1bca3
|
@ -85,6 +85,9 @@ Bug Fixes
|
|||
* SOLR-5295: The CREATESHARD collection API creates maxShardsPerNode number of
|
||||
replicas if replicationFactor is not specified. (Brett Hoerner, shalin)
|
||||
|
||||
* SOLR-5296: Creating a collection with implicit router adds shard ranges
|
||||
to each shard. (shalin)
|
||||
|
||||
Security
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -413,10 +413,11 @@ public class Overseer {
|
|||
}
|
||||
|
||||
private ClusterState createCollection(ClusterState state, String collectionName, List<String> shards , ZkNodeProps message) {
|
||||
log.info("Create collection {} with shards {}", collectionName, shards);;
|
||||
log.info("Create collection {} with shards {}", collectionName, shards);
|
||||
|
||||
// String routerName = message.getStr(OverseerCollectionProcessor.ROUTER,DocRouter.DEFAULT_NAME);
|
||||
DocRouter router = DocRouter.getDocRouter(message.getStr(OverseerCollectionProcessor.ROUTER,DocRouter.DEFAULT_NAME));
|
||||
Map<String, Object> routerSpec = DocRouter.getRouterSpec(message);
|
||||
String routerName = routerSpec.get("name") == null ? DocRouter.DEFAULT_NAME : (String) routerSpec.get("name");
|
||||
DocRouter router = DocRouter.getDocRouter(routerName);
|
||||
|
||||
List<DocRouter.Range> ranges = router.partitionRange(shards.size(), router.fullRange());
|
||||
|
||||
|
@ -447,7 +448,7 @@ public class Overseer {
|
|||
}
|
||||
if(val != null) collectionProps.put(e.getKey(),val);
|
||||
}
|
||||
collectionProps.put(DocCollection.DOC_ROUTER, DocRouter.getRouterSpec(message));
|
||||
collectionProps.put(DocCollection.DOC_ROUTER, routerSpec);
|
||||
|
||||
DocCollection newCollection = new DocCollection(collectionName, newSlices, collectionProps, router);
|
||||
|
||||
|
|
|
@ -220,6 +220,8 @@ public class CustomCollectionTest extends AbstractFullDistribZkTestBase {
|
|||
assertEquals("implicit", ((Map)coll.get(ROUTER)).get("name") );
|
||||
assertNotNull(coll.getStr(REPLICATION_FACTOR));
|
||||
assertNotNull(coll.getStr(MAX_SHARDS_PER_NODE));
|
||||
assertNull("A shard of a Collection configured with implicit router must have null range",
|
||||
coll.getSlice("a").getRange());
|
||||
|
||||
List<String> collectionNameList = new ArrayList<String>();
|
||||
collectionNameList.addAll(collectionInfos.keySet());
|
||||
|
|
Loading…
Reference in New Issue