No need to evict the statements as it creates race condition between … #3059
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.
As part of CASSANDRA-17248 (in C* 4.0.2), the following code was introduced in QueryProcessor.java
This code could very well create a race condition between two calls of QueryProcessor::prepare call in which one thread is adding and another thread is silently removing from the cache. Imagine there are thousands of threads calling the API, and then it might be possible for one thread to update the cache and another thread to remove it.
If we look at the code of Cassandra 3.0.25, then such eviction was not present. Hence, this is a regression for the post 4.0.2 version of Cassandra. To fix this issue, we should not evict the cache entries, i.e., the above-mentioned code path introduced since C* 4.0.2 is no longer required on trunk/5.0, as discussed in the ticket.
For the 4.0 branch, we will keep the eviction logic but optimize it further to address CASSANDRA-17401, as it is essential for folks on pre-4.0.1 trying to upgrade to the latest 4.0 version.
Cassandra-17401
Reproducing this is extremely tricky because it totally depends on the timing of the multiple threads, here is the pull request that reproduces it: #3058