incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stu Hood" <>
Subject RE: Incr/Decr Counters in Cassandra
Date Wed, 04 Nov 2009 21:57:09 GMT
This type of problem is one of the primary examples of something that should be handled by
pluggable/client-side conflict resolution in an eventually consistent system. Currently, all
conflicts in Cassandra are handled with "highest timestamp wins"

Rather than attempting to add atomic operations, I think we should support one of the following
in the (near) future:
 1) Client side resolution
   * When two writes conflict (ex: two clients simultaneously read the counter at "2", and
then write it at "3"), the next client receives a callback with the old value and both new
values, and can then do application specific resolution (ex: both clients incremented by "1",
so use "4").
 2) Pluggable resolution
   * When two writes conflict, pluggable logic on the server side decides how to merge the
writes. You could implement the same algorithm used in the example above, but the code would
have to exist on the server side.

Personally, I think (1) is the better approach, and for backwards compatibility in the API,
you could make the resolution optional.

-----Original Message-----
From: "Chris Goffinet" <>
Sent: Wednesday, November 4, 2009 3:32pm
Subject: Incr/Decr Counters in Cassandra


At Digg we've been thinking about counters in Cassandra. In a lot of  
our use cases we need this type of support from a distributed storage  
system. Anyone else out there who has such needs as well? Zookeeper  
actually has such support and we might use that if we can't get the  
support in Cassandra.

Chris Goffinet

View raw message