Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra row level locking support with DataStax driver

Cassandra row level locking support while accessing same row by cocurrent users

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

like image 584
user2718418 Avatar asked Aug 26 '13 14:08

user2718418


1 Answers

  1. Locking is a complicated problem for distributed systems. It also usually leads to slow operations.

  2. Cassandra 2.0 will introduce a form of lightweight transactions.

  3. 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)

  4. 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.

like image 168
Alex Popescu Avatar answered Sep 28 '22 01:09

Alex Popescu