That works, thanks so much for the help! :) --- On Tue, 12/18/12, Reid Draper <[email protected]> wrote:
> From: Reid Draper <[email protected]> > Subject: Re: Trying to revamp the clj-riak driver > To: "bgp2396" <[email protected]> > Cc: [email protected] > Date: Tuesday, December 18, 2012, 5:21 PM > > On Dec 18, 2012, at 4:05 PM, bgp2396 <[email protected]> > wrote: > > > Thanks! I did check out both of those, but as far as I > could tell neither one supported conflict resolution, or at > least it's not documented. If it is supported, do you think > you could give an example of how to do it with sumo? I tried > passing in the :vector-clock with in the map you pass into > put, but that didn't yield any results. > > Yeah sumo documentation could use some work :). You were > right to use :vector-clock, and turns out it doesn't work > because of a bug. The good news is I just fixed it [1] and > pushed up a new release, 0.2.0. Readme is now updated and > the release should be on Clojars already [2]. > > The rest of this explanation assumes you have {allow_mult, > true} set as a bucket property. You can find a description > of how to change that here [3] > > The basic workflow with sumo (and likely any other Riak > client) should be: > > 1. GET values, which in sumo will return a seq of 0 or more > results (0 corresponds with not found, more than one means a > conflict) > 2. If there are more than 1 result, resolve the conflicts > (I'll expand on this later in the response) > 3. Update the single, resolved value with whatever you were > trying to do > 4. Write back to Riak with the vector clock returned from > step 1. (sumo will return a seq of riak objects, each of > which have identical vclocks, so you it doesn't matter which > one you choose). > > Here's a gist that shows this more explicitly [4]. > > Now, how do you actually do the conflict resolution? The > short story is it's 'app specific', but things like CRDTs > [5] make it easier. I have a Clojure implementation of some > basic > CRDTs, called knockbox [6]. > > Hope this helps, and don't hesitate ask more. > > Reid > > [1] > https://github.com/reiddraper/sumo/commit/a7f080403622e0afb31a39a2f22984df28bba220 > [2] https://clojars.org/sumo > [3] http://docs.basho.com/riak/latest/references/Configuration-Files/ > [4] https://gist.github.com/4332614 > [5] http://pagesperso-systeme.lip6.fr/Marc.Shapiro/papers/RR-6956.pdf > [6] https://github.com/reiddraper/knockbox > > > > > > My use case right now is that I'm writing a little > proxy server in clojure to interact with riak. The client > will be getting (possibly multiple) values out of riak, and > passing in the one that it wants to be correct (possibly > changing that correct one in some way was well before > sending it back). > > > > --- On Tue, 12/18/12, Reid Draper <[email protected]> > wrote: > > > >> From: Reid Draper <[email protected]> > >> Subject: Re: Trying to revamp the clj-riak driver > >> To: "bgp2396" <[email protected]> > >> Cc: [email protected] > >> Date: Tuesday, December 18, 2012, 3:44 PM > >> For a more up-to-date Clojure client, > >> I'd recommend looking at Welle [1] or Sumo [2]. Not > to > >> discourage you from doing some hacking, just > throwing some > >> other options out there. > >> > >> [1] http://clojureriak.info/ > >> [2] https://github.com/reiddraper/sumo > >> > >> Reid > >> > >> On Dec 18, 2012, at 3:12 PM, bgp2396 <[email protected]> > >> wrote: > >> > >>> I'm working on updating this driver to be in > some kind > >> of working state: > >>> https://github.com/mmcgrana/clj-riak > >>> > >>> I've actually made some good progress, you can > find my > >> fork of it here: > >>> https://github.com/mediocregopher/clj-riak > >>> > >>> I've gotten all the dependencies and such > updated, and > >> (afaik) all of the old functionality is working > again > >> (although I haven't tested mapreduce). > >>> > >>> Right now I'm trying to add in support for > vclocks and > >> conflict resolution. As it stands the driver always > passes > >> in the vclock as blank. I've switched to using one > of the > >> RiakObject constructors which has a vclock passed > in as > >> well, but now the code throws a > >> > "NullPointerException clojure.lang.Reflector.invokeNoArgInstanceMember" > >> when calling buildContent() on it. I wanted to > check on the > >> mailing list to see if anyone might know why this > is before > >> I started diving into the java code and trying to > debug that > >> to figure out where exactly in buildContent() it's > failing. > >>> > >>> Here's a gist with relevant the relevant code: > >>> https://gist.github.com/4331526 > >>> > >>> > _______________________________________________ > >>> 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
