[
https://issues.apache.org/jira/browse/SOLR-14630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17164594#comment-17164594
]
Christine Poerschke commented on SOLR-14630:
--------------------------------------------
Hi [~idjurasevic]. Here's how i understood your description:
{quote}Precondition: create collection with 4 shards on one server.
{quote}
There are four different URLs, all on the same port number, e.g.
* localhost:8983/solr/collection1_shard1_replica1
* localhost:8983/solr/collection1_shard2_replica1
* localhost:8983/solr/collection1_shard3_replica1
* localhost:8983/solr/collection1_shard4_replica1
{quote}... route exists in query param ...
{quote}
Taking an example from
[https://lucene.apache.org/solr/guide/8_5/solrcloud-query-routing-and-read-tolerance.html#_route_-parameter]
we have a query equivalent to
{{[http://localhost:8983/solr/collection1/select?q=*:*&_route_=user1]!}}.
The exact value of the {{_route_}} parameter is not important, but the presence
of the {{_route_}} parameter is important. Via the {{_route_}} parameter we
want to target one of the four shards. Let's target shard2.
The BaseCloudSolrClient class considers the {{_route_}} parameter e.g. at
[https://github.com/apache/lucene-solr/blob/releases/lucene-solr/8.5.2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java#L1090-L1099]
When
[https://github.com/apache/lucene-solr/blob/releases/lucene-solr/8.5.2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java#L1129-L1133]
is reached the sortedReplicas list presumably contains only one element, the
one for shard2.
{quote}... Previous part of code adds base
url(localhost:8983/solr/collection_name) to theUrlList, it doesn't create core
address(localhost:8983/solr/core_name). ...
{quote}
At line
[https://github.com/apache/lucene-solr/blob/releases/lucene-solr/8.5.2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java#L1131]
the url {{localhost:8983/solr/collection1}} rather than
{{localhost:8983/solr/collection1_shard2_replica1}} is chosen.
*Now what happens next?* Some possibilities:
* The request goes to {{localhost:8983/solr/collection1}} and sometimes
reaches shard2 and sometimes reaches another shard.
* The request goes to {{localhost:8983/solr/collection1}} and always reaches a
particular shard e.g. shard1 but that is not the intended shard2.
* The request goes to the wrong shard and the wrong search results are
returned.
* The request goes to the wrong shard who then forwards to the correct shard.
The correct search results are returned but performance is inefficient because
of the forwarding.
* Something else.
{quote}... a series of simple steps that illustrate a problem? ...
{quote}
Thinking out aloud ... indexing exactly four documents, one for each of the
four shards, can make a simple collection.
{quote}... externally observable ... {{fl=id,[shard]}}} on a query tells you
where the doc came from. ...
{quote}
If the wrong results are returned the {{[shard]}} part of the results would
tell. And if the results are correct but the routing unexpected then might this
be observable via the logs?
> CloudSolrClient doesn't pick correct core when server contains more shards
> --------------------------------------------------------------------------
>
> Key: SOLR-14630
> URL: https://issues.apache.org/jira/browse/SOLR-14630
> Project: Solr
> Issue Type: Bug
> Components: SolrCloud, SolrJ
> Affects Versions: 8.5.1, 8.5.2
> Reporter: Ivan Djurasevic
> Priority: Major
>
> Precondition: create collection with 4 shards on one server.
> During search and update, solr cloud client picks wrong core even _route_
> exists in query param. In BaseSolrClient class, method sendRequest,
>
> {code:java}
> sortedReplicas.forEach( replica -> {
> if (seenNodes.add(replica.getNodeName())) {
> theUrlList.add(ZkCoreNodeProps.getCoreUrl(replica.getBaseUrl(),
> joinedInputCollections));
> }
> });
> {code}
>
> Previous part of code adds base url(localhost:8983/solr/collection_name) to
> theUrlList, it doesn't create core address(localhost:8983/solr/core_name). If
> we change previous code to:
> {quote}
> {code:java}
> sortedReplicas.forEach(replica -> {
> if (seenNodes.add(replica.getNodeName())) {
> theUrlList.add(replica.getCoreUrl());
> }
> });{code}
> {quote}
> Solr cloud client picks core which is defined with _route_ parameter.
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]