Hi,

I've just rolled up my sleeves and have started to make my application more
robust with conflict resolution.

I am currently using a @RiakVClock in my POJO (I need to think more about
whether the read/modify/write approach is preferable or whether I'd have to
rearchitect things).

I read in the Riak Handbook the recommendation that conflicts are best
resolved on read -  not write - however the example App.java snipping on
the Storing data in
Riak<https://github.com/basho/riak-java-client/wiki/Storing-data-in-riak#appjava>
page
in the Java client's doco uses a resolver on both the store() and
fetch()operations.

Indeed, if I don't specify my conflict resolver in my store(), things blow
up (in my unit test, mind - I'm still getting my head around the whole area
so my test may be a bit contrived).

However when I use it in both places, my conflicts are being resolved
twice. Is this anticipated?

My store is:

bucket.store(record).returnBody(true).
withoutFetch().withResolver(myConflictResolver);
and my fetch is:

bucket.fetch(id, Record.class).withResolver(myConflictResolver).execute();
The order of operations in my test is:

   1. Store new record
   2. Fetch the record as firstRecord
   3. Fetch the record as secondRecord
   4. Modify a field on firstRecord and secondRecord
   5. Save firstRecord
   6. Save secondRecord - this invokes my resolver with two siblings
   7. Read record - this also invokes my resolver with the two siblings

Am I missing something? Or is this what's supposed to happen? I'm not too
worried - the double-handling is hardly that intensive - but I'm keen to
get it right.

Thanks in advance,
Matt
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to