bumptech/riak-haskell-client — pull request #3 by edahlgren (2013-01-02 18:07:33+00:00)
Title: Echo back riak put for retries=1 or greater

The current behavior:

bos's put requires you to try another put if your vclock is Nothing, no matter the state of Riak. see the recursion here:

https://github.com/bumptech/riak-haskell-client/blob/master/src/Network/Riak/Resolvable/Internal.hs#L140

So if riak=Nothing and you're putting something with a vclock=Nothing, then you'll necessarily resolveMany' (which is a foldl' resolve), giving back a value to put in Riak that is resolve x x. Now this wouldn't matter if you follow the recursion all the way through -> this value is then put in riak and the new vclock is returned. But if you have retries set to 1, then you'll exhaust your retries before you can put again, leaving x in riak and echoing back resolve x x.

Needing to set retries to 2 is arbitrary and hard to remember (and generates needless extra retries) , and there's really no reason why the value stored in riak should be resolve x x if there's no siblings generated the first time around.

So:
Remove the constraint in the riak-haskell-bindings to recurse on all vclock=Nothing (riak=Something, vclock=Nothing should generate real siblings and cause a recurse anyway), so that we can keep retries=1 and actually echo the same things that we put.

Note: this didn't really matter for a lot of our buckets because oftentimes resolve x x = x. This fails for fk-c-state.