Java Client update vs store

Cosmin Marginean cosminaru at
Tue Feb 3 17:39:12 EST 2015

I have an edge case where consistency is favoured over availability so I’m using a "consistent": true bucket type for a very specific operation.
I worked in testing my setup so ended up faking an entire failure by deliberately using an incorrect vClock.

Using StoreValue, the (second) write fails as expected  

FetchValue fetchOp = new FetchValue.Builder(location(id)).build();
VClock vClock = client.execute(fetchOp).getVectorClock();
//fiddle with vClock or allow the first write to finish before the next step
StoreValue storeOp = new StoreValue.Builder(value)
StoreValue.Response response = client.execute(storeOp);

Caused by: com.basho.riak.client.core.netty.RiakResponseException: failed
at com.basho.riak.client.core.netty.RiakResponseHandler.channelRead(

I managed to override the UpdateValue class to simulate a similar failure scenario (so I don’t have to do the fetch + store myself). I was expecting a similar result, however, after some analysis I realised that an exception is being swallowed somewhere.
I believe the trouble might be around this area:

The exception is not allowed to bubble up to the client code. Additionally, another net effect of this seems to be that a null response is returned here
UpdateValue.Response res = client.execute(updateOp);

So a call to res.wasUpdated() will produce a NPE!

The way I see it, this code needs to either  
1) return not-null res and res.wasUpdated() as false
2) allow the exception to bubble up

Please let me know your thoughts

Thank you

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the riak-users mailing list