If you're going to use the withoutFetch() method it is required that you use that @RiakVClock annotated field in your class - you need to store the vclock from when you fetched in that field.
When you call StoreObject.execute() it is extracted from your object and passed to the Converter.fromDomain() method. Since you're using your own Converter, in that method you need to store the vclock in the IRiakObject you're constructing and returning. The RiakObjectBuilder has a withVClock method (and of course the DefaultRiakObject constructor takes it as a parameter). As for your second question ... yeah, MapReduce doesn't have that. It's probably something worth thinking about for a future release (and yeah, I'm pretty much in charge of the Java client right now - I'll add it to my backlog). As-is the best suggestion I would have is using the MapReduceResult.getResultRaw() and then pass that String to your own code for conversion. Thanks! - Roach (BTW - I apologize for the late reply - your original email was caught up in our listserv server for some reason and I only received it today). On Mon, May 20, 2013 at 10:32 AM, Y N <[email protected]> wrote: > Hi Brian, > > Thanks for the response. > > I am not using the default JSONConverter, but have my own. The way I am > currently resolving siblings is as follows: > > Create a new object > Merge fields (using whatever logic) > Return new object with merged fields > > In this case, what should I use for the vclock for the newly created object > that was resolved? Do I randomly pick from one of the objects being > resolved, or is there some order or precedence I should use? > > On a side note, I am not sure if you are responsible for the Riak Java > client. If so, I don't see an option to allow me to use my own converter for > objects obtained via a MapReduce query (through the Java client). Is this > feature currently available, or is this something that will be added at some > point? > > A .withConverter(blah) would be nice for mapreduce queries as well. > > Thanks! > > > ________________________________ > From: Brian Roach <[email protected]> > To: Y N <[email protected]> > Cc: "[email protected]" <[email protected]> > Sent: Monday, May 20, 2013 7:42 AM > Subject: Re: Java client and siblings question > > Hello! > > When you do your fetch (read) and resolve any conflicts, you're going > to get a vector clock along with each sibling. If you're using the > default JSONConverter it will be stored in your POJO's @RiakVClock > annotated field. That's the vector clock you're going to use when you > do your store (write) later - the modified object you're passing to > Bucket.store() should contain it. > > The withoutFetch() option simply allows you to break this into two > separate actions. Without it, when you called StoreObject.execute() > that's exactly what would be happening. > > Thanks! > - Roach > > On Sat, Apr 27, 2013 at 5:35 PM, Y N <[email protected]> wrote: >> Hi, >> >> I am currently using the latest java client, and I have a question >> regarding >> updating data in a bucket where siblings are allowed (i.e. allowSiblings = >> true). >> >> I finally understand the whole read-resolve-mutate-write cycle, and also >> doing an update / store using previously fetched data (i.e. not in the >> same >> "transaction"). >> >> This question is regarding the latter case (updating previously fetched >> data). My read uses a resolver. My data class has a @RiakVClock field >> defined. >> >> The problem is when I do the store(blah).withoutFetch(). It seems to be >> generating siblings. I just realized that's probably because my resolver >> (during the read) is creating a new object and then merging then siblings >> into the new object, however it's not setting the vclock field. >> >> My question is, during the read resolve stage, what should I use for the >> vlock? Should I just copy it from one of the other siblings, or is there >> some specific sort order I should use to pick a particular vlock for the >> new >> object? >> >> Thanks. >> >> _______________________________________________ >> riak-users mailing list >> [email protected] >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com >> > > _______________________________________________ riak-users mailing list [email protected] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
