简体   繁体   中英

Cassandra consistency fails

[Update]

The previous statement was quite misleading so I am elaborating more here:

I ran a test that sends out queries via Thrift protocol in PHP and the script looks like:

for ($i=0; $i<100; $i++) {  
    $query = "update ns.table set value='before' where key='key$i';";  
    // randomly select a node and send query  
}  

for ($i=0; $i<100; $i++) {  
    $query = "update ns.table set value='after' where key='key$i';";  
    // randomly select a node and send query  
}  

The table started as empty, and after the test only certain rows contain the value "after" while most rows contain "before".

I did not receive any error throughout the test. So somehow the queries in the second loop failed silently.

All queries are sent with consistency level ALL, and the table has a replication factor of 2.

My cassandra version is DSE 4.6.3, and the cluster has a total of 39 nodes.

[Update2]

After putting a sleep (for 3 seconds) in between the two loops the test can now give me correct result, with all rows in the table having the value "after".

But this is still confusing since for consistency level ALL I am expecting all queries to be made transactionally. No need for the sleep function.

After syncing the clocks of nodes the issue has been resolved.

Thanks @mshuler for pointing out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM