SOLR-17677: Ensure DBQ is safe before running #3203
Merged
+258
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/SOLR-17677
Description
Several Solr Query implementations require a SolrIndexSearcher which is not always available. This often causes ClassCastExceptions and other errors when the queries are run by a non-SIS IndexSearcher, such as during delete-by-query operations.
Solution
This PR works around this limitation by detecting and blocking these queries during DBQs:
SolrSearcherRequirer
(not thrilled with the name), is introduced that can by used by Query implementations that want to indicate their reliance on SolrIndexSearcher.QueryVisitor
implementationSolrSearcherRequirementDetector
(again - could use help with naming) is introduced which uses Lucene'svisit()
support to determine if a part of a query requires a SIS.A better, longer-term fix would be to modify the implementation of these queries to not rely on SIS, but that approach would likely miss the upcoming 9.8.1 release. The solution above is sub-par, but at least gives us something in time for the 9.8.1 release.
Tests
New test cases in TestCloudDeleteByQuery. Unit tests in SolrSearcherRequirementDetectorTest.
Checklist
Please review the following and check all that apply:
main
branch../gradlew check
.