Read Before Writes on Distributed Counters

Russell Brown russell.brown at
Thu Oct 17 11:48:32 EDT 2013

Hi Daniil,

On 17 Oct 2013, at 16:55, Daniil Churikov <ddosia at> wrote:

> Correct me if I wrong, but when you blindly do update without previous read,
> you create a sibling, which should be resolved on read. In case if you make
> a lot of increments for counter and rarely reads it will lead to siblings
> explosion.
> I am not familiar with new counters datatypes, so I am curious.

The counters in riak 1.4 are the first of a few data types we are building. The main change, conceptually, is that Riak knows about the type of the data you're storing in a counter.
Riak already detects conflicting writes, (writes that are causally concurrent), but doesn't know how to merge your data to a single value, instead it presents all the conflicting values to the client to resolve. However, in the case of a counter Riak _does_ know the meaning of your data and we're using a data type that can automatically merge to a correct value.

There is code running on Riak that will automatically merge counter siblings on write. And if siblings are detected on read, they are merged that a single value is presented to the client application.

I think Sean Cribbs has replied faster than me this time, and he's hinted at how the data type is implemented.



> --
> View this message in context:
> Sent from the Riak Users mailing list archive at
> _______________________________________________
> riak-users mailing list
> riak-users at

More information about the riak-users mailing list