jaydeepkumar1984 opened a new pull request, #3059:
URL: https://github.com/apache/cassandra/pull/3059

   As part of 
[CASSANDRA-17248](https://issues.apache.org/jira/browse/CASSANDRA-17248) (in C* 
3.0.26), the following code was introduced in 
[QueryProcessor.java](https://github.com/apache/cassandra/commit/242f7f9b18db77bce36c9bba00b2acda4ff3209e#r137491766)
   
   ```
   // Make sure the missing one is going to be eventually re-prepared           
     
   evictPrepared(hashWithKeyspace);                
   evictPrepared(hashWithoutKeyspace); 
   ```
   This code could very well create a race condition between two calls of 
[QueryProcessor::prepare](https://github.com/apache/cassandra/blob/cassandra-4.0/src/java/org/apache/cassandra/cql3/QueryProcessor.java#L575)
 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](https://github.com/apache/cassandra/blob/cassandra-3.0.25/src/java/org/apache/cassandra/cql3/QueryProcessor.java#L391),
 then such eviction was not present. Hence, this seems like a regression since 
the 3.0.26 version of the Cassandra.
   
   To fix this issue, we should not evict the cache entries, i.e., the 
above-mentioned code path introduced since C* 3.0.26 is no longer required.
   
   
   [Cassandra-17401](https://issues.apache.org/jira/browse/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: 
https://github.com/apache/cassandra/pull/3058
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to