Cassandra行级锁定支持与DataStax驱动程序 [英] Cassandra row level locking support with DataStax driver
问题描述
Cassandra行级锁定支持在并发用户访问同一行时
Cassandra row level locking support while accessing same row by cocurrent users
我们正在考虑Cassandra作为库存数据库的shooping cart应用程序的设计阶段。
现在需求是如果多个用户同时访问库存数据库中的相同产品行。
例如: - 产品表:productID productQuantitiy
1000 1
如果第一个用户在购物车中选择产品1000并将产品数量添加为1,则访问同一产品的其他用户不能选择
这个产品,直到它被第一个用户免费(更新的产品数量为0)。因此,cassandra为这种情况提供行级锁定支持
we are in design phase of our shooping cart application considering Cassandra as Inventory database. now requirment is that if multiple users access same product row in Inventory DB at same time. for example :- Product table : productID productQuantitiy 1000 1 If first user selects product '1000' and add product quantity as '1' in shopping cart, other users accessing the same product should not be able to select this product until it gets free by first user (updated product quantity as 0). so does cassandra provide row level locking support for this kind of scenario
推荐答案
-
分布式系统的一个复杂的问题。它也通常导致运行缓慢。
Locking is a complicated problem for distributed systems. It also usually leads to slow operations.
Cassandra 2.0 will introduce a form of lightweight transactions.
同样在2.0中,将支持CAS操作。基本上这将允许你模拟行级锁(更新行iif条件)
Also in 2.0 there will be support for CAS operations. Basically this would allow you to simulate row level locks (update the row iif condition)
虽然我不知道我完全理解你试图解决,我想你正在寻找是一致的计数器。这些已支持一段时间。
While I'm not sure I understand completely the problem you are trying to solve, I think what you are looking for is consistent counters. These have been supported for a while.
这篇关于Cassandra行级锁定支持与DataStax驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!