Cassandra - conflict resolution for mixed column updates with identical timestamp

爷,独闯天下 提交于 2020-01-04 02:55:11

问题


I would like to know which write wins in case of two updates with the same client timestamp.

Initial data: KeyA: { col1:"val AA", col2:"val BB", col3:"val CC"}

Client 1 sends update: KeyA: { col1:"val C1", col2:"val B1"}

Client 2 sends update: KeyA: { col1:"val C2", col2:"val B2"}

Both updates have the same timestamp.

What result will be returned by row query on KeyA ?

  1. { col1:"val C1", col2:"val B1", col3:"val CC"} - Clint 1 wins
  2. { col1:"val C2", col2:"val B2", col3:"val CC"} - Client 2 wins
  3. { col1:"val C2", col2:"val B1", col3:"val CC"} - mixed update

I expect, that result is unpredictable - since both updates have the same timestamp.

Is mixed scenario also possible?


回答1:


Timestamps are a property of each column not the entire insert itself. Multiple columns with the same exact timestamp are resolved by comparing the actual column value itself. This is done by comparing the values lexically by bytes, so that the value returned is deterministic.

So in your example, if every column inserted by both clients had the same exact timestamp, you could see a mixed update depending on how the actual column values compare.




回答2:


Here is a link to a post I wrote a while ago about Cassandra Timestamps and conflicts.



来源:https://stackoverflow.com/questions/9602413/cassandra-conflict-resolution-for-mixed-column-updates-with-identical-timestam

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