2010/4/28 Roland Hänel <rol...@haenel.me>: > Two clients insert the same key/colum with different values at the same > time: > > client A does insert(keyspace, key_1, > column_name_1, value_A, timestamp_1, consistency_level.QUORUM) > client B does insert(keyspace, key_1, > column_name_1, value_B, timestamp_1, consistency_level.QUORUM) > > After that, both clients read their value: > > client A does > get(keyspace, key_1, column_name_1, consistency_level.QUORUM) > client B does > get(keyspace, key_1, column_name_1, consistency_level.QUORUM) > > It is obvious that since the insert happens 'at the same time', i.e. with > the same timestamp, we cannot say > which value (value_A or value_B) gets written to the row. However, do we > have a guarantee that either value_A > or value_B is written, and that both read operations will return the same > result?
The guarantee is that "eventually" you will get a consistent result. Say both writes overlap such that value A is present on replicas R1 and R2, and value B is present on replica R3 (after both writes complete). Simultaneous read operations could then both attempt to "repair" the other nodes, and again there could be overlap, resulting in still 2 values present, possibly on different nodes this time. So: you can see different values on reads when there are two "simultaneous" writes, and this can continue in the worst-case scenario until one read's repair can finish before another begins. -- Jonathan Ellis Project Chair, Apache Cassandra co-founder of Riptano, the source for professional Cassandra support http://riptano.com