In Cassandra, if I update different columns concurrently in one row, will there be any write conflicts?
For example I have a table
CREATE TABLE foo (k text, a text, b text, PRIMARY KEY (k))
One thread in my code updates column a
INSERT INTO foo (k, a) VALUES ('hello', 'foo')
while the other thread updates column b
INSERT INTO foo (k, b) VALUES ('hello', 'bar').
When running concurrently, it is possible that the two queries arrive at the server at the same time.
Could I always expect the same result as I update the two columns in one CQL?
INSERT INTO foo(k, a, b) VALUES ('hello', 'foo', 'bar')
Will there be any write conflicts? Is each insertion atomic?
As Tom mentioned in his reply that in Cassandra, all the operations are column-based. Then each column should have a timestamp. In such a case, the above scenario will not bring any trouble given one thread will only update column a
while the other only update column b
. Is my understanding correct?
Thank you!