Cassandra - 冲突解决具有相同时间戳的混合列更新 [英] Cassandra - conflict resolution for mixed column updates with identical timestamp

查看:581
本文介绍了Cassandra - 冲突解决具有相同时间戳的混合列更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在使用相同的客户端时间戳进行两次更新的情况下哪些写入胜利。

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

初始数据: KeyA:{col1 :val AA,col2:val BB,col3:val CC}

客户端1发送更新: KeyA:{col1:val C1,col2:val B1}

客户端2发送更新: KeyA:{col1:val C2,col2:val B2}

KeyA ?行查询会返回什么结果?

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} - 混合更新

  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.

是混合方案也可以?

推荐答案

时间戳是属性的每列不是整个插入本身。通过比较实际列值本身来解析具有相同确切时间戳的多个列。这是通过按字节比较字符串值来实现的,所以返回的值是确定性的。

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.

这篇关于Cassandra - 冲突解决具有相同时间戳的混合列更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆