[ https://issues.apache.org/jira/browse/SOLR-14172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shalin Shekhar Mangar updated SOLR-14172: ----------------------------------------- Attachment: SOLR-14172.patch Fix Version/s: 8.5 master (9.0) Assignee: Shalin Shekhar Mangar Status: Open (was: Open) This patch incorporates the test added by Andras Salamon in PR #1152 but the actual fix is slightly different. This patch changes the buildReplicaPositions method to throw an AssignmentException instead of SolrException in case the maxShardsPerNode is insufficient. It also changes the Create Collection API to return a BAD_REQUEST code instead of SERVER_ERROR in case of assignment exception. I'll note this behavior change in the upgrade notes. > Collection metadata remains in zookeeper if too many shards requested > --------------------------------------------------------------------- > > Key: SOLR-14172 > URL: https://issues.apache.org/jira/browse/SOLR-14172 > Project: Solr > Issue Type: Bug > Affects Versions: 8.3.1 > Reporter: Andras Salamon > Assignee: Shalin Shekhar Mangar > Priority: Major > Fix For: master (9.0), 8.5 > > Attachments: SOLR-14172.patch > > Time Spent: 40m > Remaining Estimate: 0h > > When I try to create a collection and request too many shards, collection > creation fails with the expected error message: > {noformat} > $ curl -i --retry 5 -s -L -k --negotiate -u : > 'http://asalamon-cdpd-rebase831-a-1.vpc.cloudera.com:8983/solr/admin/collections?action=CREATE&name=TooManyShardstest1&numShards=4&collection.configName=zk_init_too&maxShardsPerNode=1' > HTTP/1.1 400 Bad Request > Content-Type: application/json;charset=utf-8 > Content-Length: 1562 > { > "responseHeader":{ > "status":400, > "QTime":122}, > "Operation create caused > exception:":"org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: > Cannot create collection TooManyShardstest1. Value of maxShardsPerNode is 1, > and the number of nodes currently live or live and part of your createNodeSet > is 3. This allows a maximum of 3 to be created. Value of numShards is 4, > value of nrtReplicas is 1, value of tlogReplicas is 0 and value of > pullReplicas is 0. This requires 4 shards to be created (higher than the > allowed number)", > "exception":{ > "msg":"Cannot create collection TooManyShardstest1. Value of > maxShardsPerNode is 1, and the number of nodes currently live or live and > part of your createNodeSet is 3. This allows a maximum of 3 to be created. > Value of numShards is 4, value of nrtReplicas is 1, value of tlogReplicas is > 0 and value of pullReplicas is 0. This requires 4 shards to be created > (higher than the allowed number)", > "rspCode":400}, > "error":{ > "metadata":[ > "error-class","org.apache.solr.common.SolrException", > "root-error-class","org.apache.solr.common.SolrException"], > "msg":"Cannot create collection TooManyShardstest1. Value of > maxShardsPerNode is 1, and the number of nodes currently live or live and > part of your createNodeSet is 3. This allows a maximum of 3 to be created. > Value of numShards is 4, value of nrtReplicas is 1, value of tlogReplicas is > 0 and value of pullReplicas is 0. This requires 4 shards to be created > (higher than the allowed number)", > "code":400}} > {noformat} > Although the collection creation was not successful if I list the collections > it shows the new collection: > {noformat} > $ solr collection --list > TooManyShardstest1 (1) > {noformat} > Looks like metadata remains in Zookeeper: > {noformat} > $ zkcli.sh -zkhost asalamon-cdpd-rebase831-a-1.vpc.cloudera.com:2181/solr > -cmd ls /collections > INFO - 2020-01-06 04:54:01.851; > org.apache.solr.common.cloud.ConnectionManager; Waiting for client to connect > to ZooKeeper > INFO - 2020-01-06 04:54:01.880; > org.apache.solr.common.cloud.ConnectionManager; zkClient has connected > INFO - 2020-01-06 04:54:01.881; > org.apache.solr.common.cloud.ConnectionManager; Client is connected to > ZooKeeper > /collections (1) > /collections/TooManyShardstest1 (1) > DATA: > {"configName":"zk_init_too"} > /collections/TooManyShardstest1/state.json (0) > DATA: > {"TooManyShardstest1":{ > "pullReplicas":"0", > "replicationFactor":"1", > "router":{"name":"compositeId"}, > "maxShardsPerNode":"1", > "autoAddReplicas":"false", > "nrtReplicas":"1", > "tlogReplicas":"0", > "shards":{ > "shard1":{ > "range":"80000000-bfffffff", > "state":"active", > "replicas":{}}, > "shard2":{ > "range":"c0000000-ffffffff", > "state":"active", > "replicas":{}}, > "shard3":{ > "range":"0-3fffffff", > "state":"active", > "replicas":{}}, > "shard4":{ > "range":"40000000-7fffffff", > "state":"active", > "replicas":{}}}}} > {noformat} > -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org