0

We are planning to Use datastax 2.0. driver in our application . We have following scenario in our application .There are two different transactions, one for increasing the consumption and the other for decreasing the consumption that can be done at the same time.
For Example:
Let us assume Repair_Qty = 10 From Machine 1 - I am doing a new repair and so the new Repair_Qty should be 10 + 1 .. i.e. 11 From Machine 2 at the same time, someone else is canceling a Repair. The Repair_Qty should be 11-1 = 10. However, as the transaction happened at same time and as there is no Transaction lock, the new Repair Qty will be 10-1 = 9 which is wrong.
I want to know if there is some mechanism for WRITE-READ_WRITE lock support in the datastax java driver.

Please help.

Regards,
Arun

Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23

1 Answers1

-1

I would suggest you to do that at your application level somehow. As cassandra is eventually consistent, those kind of operations tend to fail.

Ananth
  • 971
  • 9
  • 23
  • 1
    I think your comment missed the idea. Handling distributed locks at the application level is not possible. One always needs some kind of instance to handle that. The database is a logical choice. The better option would be to avoid the need for a locking transaction by changing the data model, but this isn’t possible in all cases. – PeMa Sep 07 '20 at 17:49