Cassandra row level locking support while accessing same row by concurrent users
Asked Answered
M

2

3

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 ?

Marquittamarr answered 26/8, 2013 at 14:23 Comment(1)
There seems to be a similar question I've answered hereCarlettacarley
S
1

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.

Savitt answered 27/8, 2013 at 9:16 Comment(0)
B
0

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.

Berkeleianism answered 26/8, 2013 at 16:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.