[ https://issues.apache.org/jira/browse/SOLR-12217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16979783#comment-16979783 ]
Tomas Eduardo Fernandez Lobbe commented on SOLR-12217: ------------------------------------------------------ In SolrCloud, today (even before the {{shards.prefernce}} param was introduced) if a node receives the request there are two options. If it doesn’t have a replica of the target collection it’ll forward the request to a node that does. If it has one of the replicas of the collection it will *handle* the query. That query handling is different depending on the number of shards that the collection has, if it has just one shard, then it will resolve the query locally, if it has multiple shards, then it will act as coordinator, and send shard requests to each shard. SolrJ attempts to always hit a node that does host a replica of the collection to prevent an unnecessary hop. The {{shards.preference}} as it is today in master will make the coordinator choose the replicas based on some policy, however. The problem is that if the collection has a single shard, then it won’t choose any replicas, it’ll just process the query. This patch lets CloudSolrClient apply the same preference logic on the client side, so that the replica that receives the request is not selected randomly and instead is selected by the preference. This patch doesn’t solve the case where a random node that doesn’t have the collection receives the request (I.e if you are sending all queries to the same Solr node that doesn’t have any collections). But does solve the SolrJ case. > Add support for shards.preference in single shard cases > ------------------------------------------------------- > > Key: SOLR-12217 > URL: https://issues.apache.org/jira/browse/SOLR-12217 > Project: Solr > Issue Type: New Feature > Reporter: Tomas Eduardo Fernandez Lobbe > Priority: Major > Time Spent: 1h 10m > Remaining Estimate: 0h > > SOLR-11982 Added support for {{shards.preference}}, a way to define the > sorting of replicas within a shard by preference (replica types/location). > This only works on multi-shard cases. We should add support for the case of > single shards when using CloudSolrClient -- 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