Hi Sanket -

Could you please try *removing* the precommit hook from the "uuid_log"
bucket and define it on the "test_kv_wo" bucket type instead?

Removal:
curl -4vvv -H 'Content-Type: application/json' -X PUT
localhost:8098/types/test_kv_wo/buckets/uuid_log/props -d
'{"props":{"precommit":[]}}'

Confirm:
curl -4vvv localhost:8098/types/test_kv_wo/buckets/uuid_log/props

Add precommit hook to bucket type:
curl -4vvv -H 'Content-Type: application/json' -X PUT
localhost:8098/types/test_kv_wo/props -d
'{"props":{"precommit":[{"mod":"precommit","fun":"pre_uuid"}]}}'

Confirm:
curl -4vvv localhost:8098/types/test_kv_wo/props

You can then use redbug to trace calls within Erlang:

riak attach

The following statement will wait for up to 10 minutes and will
display up to 10 calls to your pre_uuid function. Note that the period
is significant:

redbug:start(600000, 10, "precommit:pre_uuid/1->return").

If you run the above redbug statement on all nodes, you should see one
or more outputs showing that it was called. You can confirm that
redbug is working by tracing calls to now():

redbug:start("erlang:now/0").

--
Luke Bakken
Engineer
lbak...@basho.com

On Tue, May 10, 2016 at 6:49 PM, Sanket Agrawal
<sanket.agra...@gmail.com> wrote:
> One more thing - I set up the hooks by bucket, not bucket type. The
> documentation for 2.1.4 says that hooks are defined on the bucket level.
> Here is how I set up precommit hook (derived from "Riak Handbook" p95):
>
> curl -X PUT localhost:8098/types/test_kv_wo/buckets/uuid_log/props -H
> 'Content-Type: application/json' -d '{ "props": { "precommit": [{"mod":
> "precommit", "fun": "pre_uuid"}]}}' -v
>
>
> On Tue, May 10, 2016 at 9:15 PM, Sanket Agrawal <sanket.agra...@gmail.com>
> wrote:
>>
>> I just set up a precommit hook function in dev environment (KV 2.1.4)
>> which doesn't seem to be triggering off at all. The object is being stored
>> in the bucket, but the precommit logic is not kicking off. I checked couple
>> of things as listed below but came up with no error - so, it is a
>> head-scratcher why precommit hook is not triggering:

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to