Draft
Conversation
Add ClearIndicesCacheParametersIT to test and document the current behavior of the clear cache API across all query parameter combinations (request, query, fielddata). Tests exercise the full REST flow via real HTTP requests and verify which caches are actually cleared by checking index stats. The tests document the bug from elastic#94512: when only request=true is specified, all three caches are cleared instead of just the request cache. This happens because IndexService.clearCaches() cannot distinguish between 'not specified' (default false) and 'explicitly set to false'. Co-authored-by: Ben Chaplin <benchaplin@protonmail.com>
|
Cursor Agent can help with this pull request. Just |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
gradle check?This PR introduces a new integration test suite,
ClearIndicesCacheParametersIT, to investigate and confirm the query parameter parsing bug in the Clear Cache API (related to elastic#94512).The tests demonstrate that the
_cache/clearendpoint incorrectly interprets boolean query parameters (e.g.,request=falseorrequestnot specified) as "clear all" due to a fallback mechanism inIndexService.clearCachesandIndicesService.clearIndexShardCache. This occurs because the system cannot distinguish between a parameter being explicitly set tofalseand it defaulting tofalsewhen not provided.The 19 test methods cover various combinations of
request,query, andfielddataparameters. All tests currently pass, asserting the existing (buggy) behavior. Specific test cases that highlight the bug are clearly marked with[BUG]in their assertion messages and Javadoc, making it straightforward to flip the assertions once a fix is implemented.