Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-17053: If all shards fail, fail the request despite shards.tolerant #2102

Merged
merged 4 commits into from
Nov 30, 2023

Conversation

aparnasuresh85
Copy link
Contributor

https://issues.apache.org/jira/browse/SOLR-17053

Description

If the request is tolerant to errors, logic in SearchHandler simply sets partialResults to true upon detecting an error in ShardResponse. This means a failure to query any shard would be reported back as partialResults=true, instead of a query failure.

Why: Improve the error handling and reporting in the search system by making sure that query failures are distinct from partial results

Solution

Evaluate if all shards failed while fetching top results. If yes, fail the request by throwing a SolrException, if not set partialResults=true

Tests

Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.

Added a test in TestTolerantSearch: testAllShardsFail() that performs distributed search across 2 shards, but both shards have failures. The test performs the distributed search first by setting shards.tolerant=false and then by toggling it to true. The test confirms that in both cases, a SolrException is thrown. Also ensured existing tests in TestTolerant pass with the new code changes.

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide

@dsmiley

Copy link
Contributor

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful! Can you please add a CHANGES.txt entry under 9.5 in the Improvements section?

Suggested text:

Distributed search with shards.tolerant: if all shards fail, fail the request"

@aparnasuresh85
Copy link
Contributor Author

Wonderful! Can you please add a CHANGES.txt entry under 9.5 in the Improvements section?

Suggested text:

Distributed search with shards.tolerant: if all shards fail, fail the request"

Done.

@dsmiley dsmiley merged commit c1a3fd3 into apache:main Nov 30, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants