API for handlers in WiredTiger changed to include session state, update our use of the API to match that change.

This commit is contained in:
Gregory Burd 2013-10-30 13:11:14 -04:00
parent 95515f111c
commit 1664fdcf8c

View file

@ -440,6 +440,7 @@ __close_cursors_on(WterlConnHandle *conn_handle, const char *uri)
return; return;
} }
/** /**
* Callback to handle error messages. * Callback to handle error messages.
* *
@ -454,13 +455,15 @@ __close_cursors_on(WterlConnHandle *conn_handle, const char *uri)
* operation or library failure. * operation or library failure.
*/ */
int int
__wterl_error_handler(WT_EVENT_HANDLER *handler, int error, const char *message) __wterl_error_handler(WT_EVENT_HANDLER *handler, WT_SESSION *session,
int error, const char *message)
{ {
struct wterl_event_handlers *eh = (struct wterl_event_handlers *)handler; struct wterl_event_handlers *eh = (struct wterl_event_handlers *)handler;
ErlNifEnv *msg_env; ErlNifEnv *msg_env;
ErlNifPid *to_pid; ErlNifPid *to_pid;
int rc = 0; int rc = 0;
UNUSED(session);
enif_mutex_lock(eh->error_mutex); enif_mutex_lock(eh->error_mutex);
msg_env = eh->msg_env_error; msg_env = eh->msg_env_error;
to_pid = &eh->to_pid; to_pid = &eh->to_pid;
@ -492,13 +495,14 @@ __wterl_error_handler(WT_EVENT_HANDLER *handler, int error, const char *message)
* operation or library failure. * operation or library failure.
*/ */
int int
__wterl_message_handler(WT_EVENT_HANDLER *handler, const char *message) __wterl_message_handler(WT_EVENT_HANDLER *handler, WT_SESSION *session, const char *message)
{ {
struct wterl_event_handlers *eh = (struct wterl_event_handlers *)handler; struct wterl_event_handlers *eh = (struct wterl_event_handlers *)handler;
ErlNifEnv *msg_env; ErlNifEnv *msg_env;
ErlNifPid *to_pid; ErlNifPid *to_pid;
int rc = 0; int rc = 0;
UNUSED(session);
enif_mutex_lock(eh->message_mutex); enif_mutex_lock(eh->message_mutex);
msg_env = eh->msg_env_message; msg_env = eh->msg_env_message;
to_pid = &eh->to_pid; to_pid = &eh->to_pid;
@ -529,13 +533,14 @@ __wterl_message_handler(WT_EVENT_HANDLER *handler, const char *message)
* operation or library failure. * operation or library failure.
*/ */
int int
__wterl_progress_handler(WT_EVENT_HANDLER *handler, const char *operation, uint64_t counter) __wterl_progress_handler(WT_EVENT_HANDLER *handler, WT_SESSION *session, const char *operation, uint64_t counter)
{ {
struct wterl_event_handlers *eh = (struct wterl_event_handlers *)handler; struct wterl_event_handlers *eh = (struct wterl_event_handlers *)handler;
ErlNifEnv *msg_env; ErlNifEnv *msg_env;
ErlNifPid *to_pid; ErlNifPid *to_pid;
int rc = 0; int rc = 0;
UNUSED(session);
enif_mutex_lock(eh->progress_mutex); enif_mutex_lock(eh->progress_mutex);
msg_env = eh->msg_env_progress; msg_env = eh->msg_env_progress;
to_pid = &eh->to_pid; to_pid = &eh->to_pid;
@ -2303,7 +2308,7 @@ on_load(ErlNifEnv *env, void **priv_data, ERL_NIF_TERM load_info)
char msg[1024]; char msg[1024];
snprintf(msg, 1024, "NIF on_load complete (wterl version: %s, wiredtiger version: %s)", priv->wterl_vsn, priv->wiredtiger_vsn); snprintf(msg, 1024, "NIF on_load complete (wterl version: %s, wiredtiger version: %s)", priv->wterl_vsn, priv->wiredtiger_vsn);
__wterl_message_handler((WT_EVENT_HANDLER *)&priv->eh, msg); __wterl_message_handler((WT_EVENT_HANDLER *)&priv->eh, NULL, msg);
return 0; return 0;
} }