update objects in precommit hooks

Jon Meredith jmeredith at basho.com
Fri Apr 1 09:23:24 EDT 2011


Hi Damian,

The put FSM is being overhauled at the moment.  The current 0.14.1 code does
not apply the updated values in precommit hooks.  In my testing it worked
ok, but I think that is probably because there were already values present
in Riak and the changes were included at the vnode level.

You could try building from source on github, the branch the put FSM was
refactored on has been pulled in now.  There is a QuickCheck test that
executes code that looks very similar to yours.

    MD = riak_object:get_metadata(Obj),
    UpdMD = dict:store(?MD_USERMETA, [{"X-Riak-Meta-PrecommitHook","was
here"}], MD),
    riak_object:update_metadata(Obj, UpdMD).

I'd be very interested to hear if it resolves your problem.

BR, Jon.
Basho Technologies.

2011/4/1 Damian Dobroczyński <qoocku at gmail.com>

> Hi, list!
>
> I'm trying to update object metadata dictionary within my precommit hook
> (in Erlang) using `riak_object:update_metadata/2' like this:
>
>  Old = riak_object:get_metadata(O),
>  New = dict:store(<<"X-my-metadata-name">>, Value, Old),
>  NewObject = riak_object:update_metadata(O, New),
>
> Unfortunately, the retrieved object does not contain the new keys. Where
> can be the problem?
>
> -- D.
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110401/536695bf/attachment.html>


More information about the riak-users mailing list