Reputation: 31
We are in design phase of our shopping cart application we are considering Cassandra as Inventory database. Multiple users need to be able to access same product row in Inventory DB at same time.
For example a product table containing:
productID =1000, productQuantitiy = 1
productID =2000, productQuantitiy = 5
If first user selects product 1000 and add product quantity 1 in shopping cart, other users should not be able to select this product until it gets discarded by first user (who updates product quantity as 0).
Alternatively if the first user selects 3 of product 2000, other users accessing the same product should not be able to select the same amount of this product until some is discarded by the first user (who updates product quantity as 2).
Does Cassandra provide row level locking support for this kind of scenario ?
Upvotes: 3
Views: 1346
Reputation: 14163
Cassandra does not have built in support for locking yet. The Astyanax API provides recipes which are implementations for common use cases, one of which, Distributed Row Lock, is for such locking.
Upvotes: 1
Reputation: 328
What you want is atomicity, Cassandra can syncronize with 1000 users, however it uses the timestamp to sincronize value in each column. You can use 'all' on consitence level for write and read, thereby to send and request the informations in all nodes, but maybe you can lost availability.
Upvotes: 0