basho/riak_kv — pull request #594 by lenary (2013-07-04 15:25:52+00:00)
Title: Additions to Counters for Yokozuna

This is associated with the work in basho/yokozuna#135 - and hence will have to wait until yokozuna supports 1.4.

Firstly, the Yokozuna extractor extracts on a sibling-by-sibling basis, not the entire riak object. Hence it's useful to have a method in `riak_kv_counter` that can give the counter value from a single sibling.

Secondly, we require that Yokozuna merges all CRDTs before doing extraction, so that the most up to date value of the counter is merged. `riak_kv_counter:merge/1` is "safe" to call on a riak_object without counter siblings (ie it won't affect anything), but is quite a heavyweight thing to do. We include a simple check to see if any siblings could be a counter, before merging. This probably needs (micro-)benchmarking to see if it really does increase performance.