Alin,

Sorry for your troubles, you are hitting a bug.  If a post-commit hook
fails the exception is caught and silently dropped on the floor.  That is,
it is not logged anywhere at any time and therefore you have no way to know
if it failed or not.

Just recently a patch was merged for this in the master branch that will be
included in the next release.  However, it's worth noting that the patch
also doesn't log anything by default (well it does, but to the debug level
which is not enabled by default).  Rather it increments a new stat
(accessible via `riak-admin status`) named `postcommit_fail`.  While I was
making this patch I also went ahead and did the same for pre-commit hooks.

So while developing you can run with debug level and then in production you
can run the following to determine if something failed:

$ ./rel/riak/bin/riak-admin status | grep commit
precommit_fail : 0
postcommit_fail : 0

-Ryan

On Fri, Feb 3, 2012 at 5:37 AM, Alin Popa <[email protected]> wrote:

> Hi guys,
>
> I've worked a bit with the Riak's post commit hooks:
>
> 1. Create a post commit module/function:
>
> *-module(post_commit_hooks).*
> *
> *
> *-export([log/1]).*
> *
> *
> *log(Object) ->*
> *  error_logger:info_msg("OBJECT: ~p~n",[Object]).*
>
> 2. Updated the app.conf file in order to pick it up
> 3. Compiled the file using the erts that's embedded into the riak
> distribution (which is 1.0.3 btw)
> 4. Started the riak node
> 5. Done some simple operations (get and save of objects) and I was able to
> see the object being dumped to the console.log file.
>
> For the failing scenario:
> 1. Changed the function a bit in order to call an inexistent function
>
> *-module(post_commit_hooks).*
> *
> *
> *-export([log/1]).*
> *
> *
> *log(Object) ->*
> *  error_loggerrrrr:info_msg("OBJECT: ~p~n",[Object]).*
>
> 2. Stop riak
> 3. Enabled sasl logging {sasl,[{error_logger_mf_maxfiles,
> 5},{sasl_error_logger, {file,
> "/Users/alin/riak/log/sasl-error.log"}},{error_logger_mf_maxbytes,
> 10485760},{errorlog_type, error},{error_logger_mf_dir,
> "/Users/alin/riak/log"}]}
> 4. Recompile the file, using the same erts version
> 5. Start riak
> 6. Read and save of the riak objects, but this time, can't see any error
> to the log files (especially sasl-error.log, as basho's wiki is suggesting
> [1], even though I can see different kind of messages to sasl-error.log
> that are not related to the failing execution).
>
> Is it something that I'm missing, or is this a bug ?
>
> Thanks,
> Alin
>
> [1] http://wiki.basho.com/Commit-Hooks.html
>
> _______________________________________________
> 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

Reply via email to