Re: Cassandra Possible read/write race condition in LOCAL_ONE?

2019-03-29 Thread Jacques-Henri Berthemet
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 
Reply-To: "user@cassandra.apache.org" 
Date: Thursday 28 March 2019 at 23:29
To: cassandra 
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  
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


Re: Cassandra Possible read/write race condition in LOCAL_ONE?

2019-03-28 Thread Jon Haddad
I'm reading the OP as doing this from a single server, if that's the
case QUORUM / LOCAL_QUORUM will work.

On Thu, Mar 28, 2019 at 3:29 PM Jeff Jirsa  wrote:
>
> 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  
> 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

-
To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org
For additional commands, e-mail: user-h...@cassandra.apache.org



Re: Cassandra Possible read/write race condition in LOCAL_ONE?

2019-03-28 Thread Jeff Jirsa
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 
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
>


Cassandra Possible read/write race condition in LOCAL_ONE?

2019-03-28 Thread Richard Xin
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