Cassandra - 对行键的唯一约束 [英] Cassandra - unique constraint on row key
问题描述
我想知道,只要Cassandra可以在行键上指定唯一约束。类似于SQL Server的 ADD CONSTRAINT myConstrain UNIQUE(ROW_PK)
I would like to know whenever it is possible in Cassandra to specify unique constrain on row key. Something similar to SQL Server's ADD CONSTRAINT myConstrain UNIQUE (ROW_PK)
如果插入已存在的行键,现有的数据将不会被覆盖,但是我收到一些异常或响应,由于约束违反而不能执行更新。
In case of insert with already existing row key, the existing data will be not overwritten, but I receive kind of exception or response that update cannot be performed due to constrain violation.
也许这个问题有一个解决方法 - 有更新接缝为原子的计数器
Maybe there is a workaround for this problem - there are counters which updates seams to be atomic
感谢,
Maciej
推荐答案
一种可能性是使用Cages和ZooKeeper:
One possibility is to use Cages and ZooKeeper:
http://ria101.wordpress.com/2010/05/12/locking-和
http://ria101.wordpress.com/2010/05/12/locking-and-transactions-over-cassandra-using-cages
这篇关于Cassandra - 对行键的唯一约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!