With protocol buffers this is the case. The ifNotModified() method expects you to supply a vector clock which is then matched against the vector clock of an existing object in Riak with that key. Since there is no object in riak ... it returns "notfound" - it can't find it.
Unfortunately that makes your situation somewhat difficult to handle all in one go using the StoreObject. What I woud suggest is doing a fetch first then do the store with the withoutFetch() option. In the case where the fetch returned nothing, do your store of your new object with the ifNoneMatch() option if it's possible another writer created it between your fetch and store. In the case where the fetch returned an object, use the ifNotModified() since you have the vclock. - Roach On Sat, May 25, 2013 at 8:21 PM, Y N <[email protected]> wrote: > I am using ifNotModified and am running into a weird situation. > > I am using the following API: > > return bucket.store(key, new > MyObject()).withMutator(mutator).withConverter(converter).ifNotModified(true).returnBody(true).execute(); > > The problem I run into is that I get a not found exception when there is no > existing object in Riak for the specified key. If I change ifNotModified to > false, then it works as expected. I am allocating a new object in my mutator > if there is no existing object from the fetch cycle. Note, this is with the > default bucket settings. > > My expectation was that even with ifNotModified set to true, this should > succeed if there is no existing object in Riak matching the key (hence, > nothing has been modified and the store should succeed). > > Please clarify the behavior of the API. > > Thanks. _______________________________________________ riak-users mailing list [email protected] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
