Hi Haithem,

I might have phrased my question wrongly - I wasn't referring to the 
considerations of consistency level or replication factors - I was referring to 
fact that I want to insert a row and increment a counter in the same operation. 
I was concerned about the inconsistency that could arise if the counter 
increment failed, after the underlying record on which the increment was based 
succeeded. So I wasn't talking about the consistency between Cassandra nodes, 
rather the consistency between an idempotent base record and an non-idempotent 
summary counter.

Cheers,

Ben

On October 2, 2013 at 10:09:40 AM, Haithem Jarraya (a-hjarr...@expedia.com) 
wrote:

Hi Ben,

If you make sure R + W > N you should be fine.
Have a read of thisĀ 
http://www.slideshare.net/benjaminblack/introduction-to-cassandra-replication-and-consistency

Thanks,

H
On 1 Oct 2013, at 18:29, Ben Hood <0x6e6...@gmail.com> wrote:

Hi,

We're maintaining a bunch of application specific counters that are
incremented on a per event basis just after the event has been
inserted.

Given the fact that they can get of sync, we were wondering if there
are any best practices or just plain real world experience for
handling the consistency of these counters?

The application could tolerate an inconsistency for a while, so I'm
not sure that the cost of any full-on ACID semantics (should they
actually be possible in Cassandra) would be justified.

So the first inclination was to issue the increment after the insert
and hope for the best. Then at some later point, we would run a
reconciliation on the underlying data in the column family and compare
this with the counter values. Obviously you can only do this once a
counter column has gone cold - i.e. it wouldn't make sense to
reconcile something that could still get incremented.

Does it make sense to put the insert and increment in a CQL batch?

Does anybody have any high level advice for this design deliberation?

Cheers,

Ben

Reply via email to