Cassandra - 对行键的唯一约束 [英] Cassandra - unique constraint on row key

查看:548
本文介绍了Cassandra - 对行键的唯一约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,只要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屋!

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