No need to evict the statements as it creates race condition between …#3059
Closed
jaydeepkumar1984 wants to merge 1 commit into
Closed
No need to evict the statements as it creates race condition between …#3059jaydeepkumar1984 wants to merge 1 commit into
jaydeepkumar1984 wants to merge 1 commit into
Conversation
3dea20c to
3a39a13
Compare
3a39a13 to
b50980f
Compare
df3eb40 to
54e39a9
Compare
ifesdjeen
approved these changes
Jan 12, 2026
Contributor
Author
|
Thanks a lot @ifesdjeen for the review! Sure, I will commit this patch to trunk only. |
Contributor
Author
|
I have just committed this approved PR to trunk. Here is the PR for 5.0 jaydeepkumar1984#67 - please review. |
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.
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