Initializing a commit hook

Mav erick mav4001 at gmail.com
Fri Nov 18 19:57:58 EST 2016


No luck :(

I set up a bucket type called test-bucket-type. I did NOT set data type.
I set the hooks
Ran your curl -X PUT. The Hook was not called. Tried several times, no luck
I changed the curl to hit my non-typed bucket, and the commit hook hit

$ riak-admin bucket-type list
default (active)
test-bucket-type (active)
sets (active)
maps (active)
counters (active)

I made sure the hooks are applied
Also note there is **no** data type associated
{
  "props": {
    "active": true,
    "allow_mult": true,
    "basic_quorum": false,
    "big_vclock": 50,
    "chash_keyfun": {
      "fun": "chash_std_keyfun",
      "mod": "riak_core_util"
    },
    "claimant": "riak at 10.243.44.165",
    "dvv_enabled": true,
    "dw": "quorum",
    "last_write_wins": false,
    "linkfun": {
      "fun": "mapreduce_linkfun",
      "mod": "riak_kv_wm_link_walker"
    },
    "n_val": 3,
    "notfound_ok": true,
    "old_vclock": 86400,
    "postcommit": [],
    "pr": 0,
    "precommit": [
      {
        "fun": "precommit_hook",
        "mod": "commit_hooks"
      }
    ],
    "pw": 0,
    "r": "quorum",
    "rw": "quorum",
    "small_vclock": 50,
    "w": "quorum",
    "young_vclock": 20
  }
}

curl -4vvv -H 'Content-Type: text/plain'
localhost:8098/types/test-bucket-type/buckets/test-bucket/keys/test-key -d
"THIS IS THE DATA FOR TEST-KEY"


On 18 November 2016 at 18:24, Luke Bakken <lbakken at basho.com> wrote:

> Thanks for correcting that. Everything looks set up correctly.
>
> How are you saving objects? If you're using HTTP, what is the URL?
>
> Can you associate your precommit hook with a bucket type
> ("test-bucket-type" below) that is *not* set up for the "map" data
> type and see if your hook is called correctly?
>
> This command should save an object and trigger the precommit hook
> *with* a bucket and bucket type:
>
> curl -4vvv -H 'Content-Type: text/plain'
> localhost:8098/types/test-bucket-type/buckets/test-bucket/keys/test-key
> -d "THIS IS THE DATA FOR TEST-KEY"
>
> Luke
>
> On Fri, Nov 18, 2016 at 3:03 PM, Mav erick <mav4001 at gmail.com> wrote:
> >
> > * Hostname was NOT found in DNS cache
> > *   Trying 127.0.0.1...
> > * Connected to localhost (127.0.0.1) port 8098 (#0)
> >> GET /types/maps/props HTTP/1.1
> >> User-Agent: curl/7.35.0
> >> Host: localhost:8098
> >> Accept: */*
> >>
> > < HTTP/1.1 200 OK
> > < Vary: Accept-Encoding
> > * Server MochiWeb/1.1 WebMachine/1.10.6 (no drinks) is not blacklisted
> > < Server: MochiWeb/1.1 WebMachine/1.10.6 (no drinks)
> > < Date: Fri, 18 Nov 2016 22:27:56 GMT
> > < Content-Type: application/json
> > < Content-Length: 545
> > <
> > * Connection #0 to host localhost left intact
> > {"props":{"active":true,"allow_mult":true,"basic_
> quorum":false,"big_vclock":50,"chash_keyfun":{"mod"
> > :"riak_core_util","fun":"chash_std_keyfun"},"claimant":"
> riak at 10.243.44.165","datatype":"map","dvv_en
> > abled":true,"dw":"quorum","last_write_wins":false,"
> linkfun":{"mod":"riak_kv_wm_link_walker","fun":"m
> > apreduce_linkfun"},"n_val":3,"notfound_ok":true,"old_vclock"
> :86400,"postcommit":[],"pr":0,"precommit
> > ":[{"mod":"commit_hooks","fun":"precommit_hook"}],"pw":0,"r"
> :"quorum","rw":"quorum","smal
> > l_vclock":50,"w":"quorum","young_vclock":20}}
> >
> > $ curl -4vvv localhost:8098/types/maps/buckets/testbucket/props
> > * Hostname was NOT found in DNS cache
> > *   Trying 127.0.0.1...
> > * Connected to localhost (127.0.0.1) port 8098 (#0)
> >> GET /types/maps//buckets/testbucket/props HTTP/1.1
> >> User-Agent: curl/7.35.0
> >> Host: localhost:8098
> >> Accept: */*
> >>
> > < HTTP/1.1 200 OK
> > < Vary: Accept-Encoding
> > * Server MochiWeb/1.1 WebMachine/1.10.6 (no drinks) is not blacklisted
> > < Server: MochiWeb/1.1 WebMachine/1.10.6 (no drinks)
> > < Date: Fri, 18 Nov 2016 22:59:22 GMT
> > < Content-Type: application/json
> > < Content-Length: 565
> > <
> > * Connection #0 to host localhost left intact
> > {"props":{"name":"testbucket","active":true,"allow_mult":
> true,"basic_quorum":false,"big_vclock":
> > chash_keyfun":{"mod":"riak_core_util","fun":"chash_std_
> keyfun"},"claimant":"riak at 10.243.44.165",
> > atype":"map","dvv_enabled":true,"dw":"quorum","last_
> write_wins":false,"linkfun":{"mod":"riak_kv_
> > ink_walker","fun":"mapreduce_linkfun"},"n_val":3,"notfound_
> ok":true,"old_vclock":86400,"postcomm
> > [],"pr":0,"precommit":[{"mod":"commit_hooks","fun":"
> precommit_hook"}],"pw":0,"r":"quo
> > ,"rw":"quorum","small_vclock":50,"w":"quorum","young_vclock":20}}$
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20161118/039c167c/attachment-0002.html>


More information about the riak-users mailing list