Quantcast
Channel: User user1944408 - Stack Overflow
Viewing all articles
Browse latest Browse all 26

Answer by user1944408 for Atomically updating shared state in Cassandra

$
0
0
  1. As Richard pointed out the best way at the moment is to use atomic batches where you update many deltas. If something goes wrong just replay the batch.

  2. The other possible solution is to use ZooKeeper as a coordination and distributed locking service: http://ria101.wordpress.com/tag/zookeeper/

  3. Another possible solution is to use counters so you don't need to do this

    your current_balance = read_users_balance(u);new_balance     = current_balance + delta_for_user(u);

    because with counters you don't need to read balance before updating. http://www.datastax.com/dev/blog/whats-new-in-cassandra-0-8-part-2-counters

However there is a problem with counters, they are not idempotent so if you don't receive acknowledge that your increment/decrement was successful you cannot replay that counter as it can lead to overcount.

New counters will solve that problem.


Viewing all articles
Browse latest Browse all 26

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>