How the LWT- Light Weight Transaction is working when we use IF NOT EXIST?

会有一股神秘感。 提交于 2021-01-28 03:19:39

问题


The question is that, When we use

    INSERT INTO USERS (login, email, name, login_count)        
    values ('jbellis', 'jbellis@datastax.com', 'Jonathan Ellis', 1)        
    IF NOT EXISTS    

in IF NOT EXIST exactly which columns are compared together? primary key(partition-key + clustering-key)? or just partition-key?


回答1:


Here is a diagram of the 4 phases of LWT: http://www.slideshare.net/doanduyhai/cassandra-introduction-nantesjug/89

The original blog post is here: http://www.datastax.com/dev/blog/lightweight-transactions-in-cassandra-2-0

exactly which columns are compare together? primary key? partition-key?

The whole primary key is checked on disk. In the example it is a simple primary key so it's also the partition key, e.g. login column



来源:https://stackoverflow.com/questions/35428976/how-the-lwt-light-weight-transaction-is-working-when-we-use-if-not-exist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!