If you use LOCAL_ONE for write and read and you have RF>1, it means both 
operations could go to different replicas that does not have the data yet.
Try to use LOCAL_QUORUM instead, as usual check your clocks as well.

From: Jeff Jirsa <jji...@gmail.com>
Reply-To: "user@cassandra.apache.org" <user@cassandra.apache.org>
Date: Thursday 28 March 2019 at 23:29
To: cassandra <user@cassandra.apache.org>
Subject: Re: Cassandra Possible read/write race condition in LOCAL_ONE?

Yes it can race; if you don't want to race, you'd want to use SERIAL or 
LOCAL_SERIAL.

On Thu, Mar 28, 2019 at 3:04 PM Richard Xin <richardxin...@yahoo.com.invalid> 
wrote:
Hi,
Our Cassandra Consistency level is currently set to LOCAL_ONE, we have script 
doing followings
1) insert one record into table_A
2) select last_inserted_record from table_A and do something ...

step #1 & 2 are running sequentially without pause,  and I assume 1 & 2 suppose 
to run in same DC

we are facing sporadic issues that step #2 didnt get inserted data by #1.
is it possible to have a race condition when LOCAL_ONE that #2 might not get 
inserted data on step #1?

Thanks in advance!
Richard

Reply via email to