[
https://issues.apache.org/jira/browse/SOLR-6832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sachin Goyal updated SOLR-6832:
-------------------------------
Attachment: SOLR-6832.patch
Attaching a patch for this ticket.
The patch creates an option *preferLocalShards* in solrconfig.xml and in the
query request params (giving more preference to the one in the query).
If this option is set, *HttpShardHandler.preferCurrentHostForDistributedReq()*
tries to find a local URL and puts that URL as the first one in the list of
URLs sent to LBHttpSolrServer. This ensures that the current host's cores will
be given preference for distributed queries.
Other important function is *ResponseBuilder.findCurrentHostAddress()* which
tries to find the current host's URL by searching for current core's name in
the list of shards. The URL found by this function is used by the
HttpShardHandle's function above.
Default value of the option is kept as 'false' to ensure normal behavior.
> 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
> 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: [email protected]
For additional commands, e-mail: [email protected]