[ https://issues.apache.org/jira/browse/SOLR-6832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14303922#comment-14303922 ]
Timothy Potter commented on SOLR-6832: -------------------------------------- [~sachingoyal] Thanks for the patch! I'm working to get it to a committable state. I don't think adding {{preferLocalShards}} as a collection-level setting (in SolrConfig) adds much value here. If an operator wants to enforce that query parameter for all requests, they can use the built-in support for defaults or invariants on the appropriate query request handler, e.g. to make this the default on the /select handler, you could do: {code} <requestHandler name="/select" class="solr.SearchHandler"> <lst name="defaults"> <str name="echoParams">explicit</str> <int name="rows">10</int> <bool name="preferLocalShards">true</bool> ... {code} Both approaches require some config changes in solrconfig.xml, but the latter (my suggestion) avoids adding new code / config settings. That said, please let me know if you think there's another reason to have this as an explicit setting in solrconfig.xml. Also, all the code in {{findCurrentHostAddress}} can simply be replaced by {{ZkController.getBaseUrl()}} when needed. > Queries be served locally rather than being forwarded to another replica > ------------------------------------------------------------------------ > > Key: SOLR-6832 > URL: https://issues.apache.org/jira/browse/SOLR-6832 > Project: Solr > Issue Type: Bug > Components: SolrCloud > Affects Versions: 4.10.2 > Reporter: Sachin Goyal > Assignee: Timothy Potter > Attachments: SOLR-6832.patch > > > Currently, I see that code flow for a query in SolrCloud is as follows: > For distributed query: > SolrCore -> SearchHandler.handleRequestBody() -> HttpShardHandler.submit() > For non-distributed query: > SolrCore -> SearchHandler.handleRequestBody() -> QueryComponent.process() > \\ > \\ > \\ > For a distributed query, the request is always sent to all the shards even if > the originating SolrCore (handling the original distributed query) is a > replica of one of the shards. > If the original Solr-Core can check itself before sending http requests for > any shard, we can probably save some network hopping and gain some > performance. > \\ > \\ > We can change SearchHandler.handleRequestBody() or HttpShardHandler.submit() > to fix this behavior (most likely the former and not the latter). -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org