Cassandra row level isolation

2019-08-15 11:19发布

问题:

I have a table created in cql :

create table isolation_demo(key text,column1 text,column2 text,column3 text ,primary key(key,column1,column2));

I have 2 statement in a batch.

update isolation_demo set column3 ='ABC' where key =1 and column1 =1 and column2=1;
delete from isolation_demo where key =1 and column1 =2 and column2=2;

here the both statements share same partition key. (key=1), but different clustering column values. Will these 2 statements be isolated?

回答1:

These queries must be isolated, as mentioned in C* docs here and here:

In early versions of Cassandra, it was possible to see partial updates in a row when one user was updating the row while another user was reading that same row. For example, if one user was writing a row with two thousand columns, another user could potentially read that same row and see some of the columns, but not all of them if the write was still in progress.

Full row-level isolation is in place, which means that writes to a row are isolated to the client performing the write and are not visible to any other user until they are complete.