diff --git a/server/core/poll.c b/server/core/poll.c index 6129fbfa3..01e00e4ef 100644 --- a/server/core/poll.c +++ b/server/core/poll.c @@ -340,11 +340,13 @@ poll_waitevents(void *arg) skygw_log_write_flush( LOGFILE_DEBUG, - "%lu [poll_waitevents] event %d dcb %p", + "%lu [poll_waitevents] event %d dcb %p " + "role %s", pthread_self(), ev, - dcb); - + dcb, + STRDCBROLE(dcb->dcb_role)); + if (ev & EPOLLERR) { int eno = gw_getsockerrno(dcb->fd); @@ -354,7 +356,8 @@ poll_waitevents(void *arg) skygw_log_write( LOGFILE_DEBUG, "%lu [poll_waitevents] " - "Added fake errno %d. %s", + "Added fake errno %d. " + "%s", pthread_self(), eno, strerror(eno)); diff --git a/server/core/session.c b/server/core/session.c index 3dc03872f..d55eda8bd 100644 --- a/server/core/session.c +++ b/server/core/session.c @@ -58,7 +58,7 @@ static SESSION *allSessions = NULL; * @return The newly created session or NULL if an error occured */ SESSION * -session_alloc(SERVICE *service, DCB *client) +session_alloc(SERVICE *service, DCB *client_dcb) { SESSION *session; @@ -88,7 +88,7 @@ session_alloc(SERVICE *service, DCB *client) */ spinlock_acquire(&session->ses_lock); session->service = service; - session->client = client; + session->client = client_dcb; memset(&session->stats, 0, sizeof(SESSION_STATS)); session->stats.connect = time(0); session->state = SESSION_STATE_ALLOC; @@ -99,8 +99,8 @@ session_alloc(SERVICE *service, DCB *client) * session has not been made available to the other threads at this * point. */ - session->data = client->data; - client->session = session; + session->data = client_dcb->data; + client_dcb->session = session; session->refcount = 1; /** * This indicates that session is ready to be shared with backend @@ -121,14 +121,14 @@ session_alloc(SERVICE *service, DCB *client) * session, therefore it is important that the session lock is * relinquished beforethe router call. */ - if (client->state != DCB_STATE_LISTENING) + if (client_dcb->state != DCB_STATE_LISTENING) { session->router_session = service->router->newSession(service->router_instance, session); if (session->router_session == NULL) { - client->session = NULL; + client_dcb->session = NULL; skygw_log_write_flush( LOGFILE_ERROR, "Error : Failed to create router " diff --git a/utils/skygw_debug.h b/utils/skygw_debug.h index 2a4f3f755..95540f4fe 100644 --- a/utils/skygw_debug.h +++ b/utils/skygw_debug.h @@ -170,6 +170,11 @@ typedef enum skygw_chk_t { ((s) == MYSQL_SESSION_CHANGE ? "MYSQL_SESSION_CHANGE" : \ "UNKNOWN MYSQL STATE")))))))))) +#define STRDCBROLE(r) ((r) == DCB_ROLE_SERVICE_LISTENER ? "DCB_ROLE_SERVICE_LISTENER" : \ + ((r) == DCB_ROLE_REQUEST_HANDLER ? "DCB_ROLE_REQUEST_HANDLER" : \ + "UNKNOWN DCB ROLE")) + + #define CHK_MLIST(l) { \ ss_info_dassert((l->mlist_chk_top == CHK_NUM_MLIST && \ l->mlist_chk_tail == CHK_NUM_MLIST), \