Cleanup, added also a macro for printing dcb state.
This commit is contained in:
@ -340,11 +340,13 @@ poll_waitevents(void *arg)
|
|||||||
|
|
||||||
skygw_log_write_flush(
|
skygw_log_write_flush(
|
||||||
LOGFILE_DEBUG,
|
LOGFILE_DEBUG,
|
||||||
"%lu [poll_waitevents] event %d dcb %p",
|
"%lu [poll_waitevents] event %d dcb %p "
|
||||||
|
"role %s",
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
ev,
|
ev,
|
||||||
dcb);
|
dcb,
|
||||||
|
STRDCBROLE(dcb->dcb_role));
|
||||||
|
|
||||||
if (ev & EPOLLERR)
|
if (ev & EPOLLERR)
|
||||||
{
|
{
|
||||||
int eno = gw_getsockerrno(dcb->fd);
|
int eno = gw_getsockerrno(dcb->fd);
|
||||||
@ -354,7 +356,8 @@ poll_waitevents(void *arg)
|
|||||||
skygw_log_write(
|
skygw_log_write(
|
||||||
LOGFILE_DEBUG,
|
LOGFILE_DEBUG,
|
||||||
"%lu [poll_waitevents] "
|
"%lu [poll_waitevents] "
|
||||||
"Added fake errno %d. %s",
|
"Added fake errno %d. "
|
||||||
|
"%s",
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
eno,
|
eno,
|
||||||
strerror(eno));
|
strerror(eno));
|
||||||
|
|||||||
@ -58,7 +58,7 @@ static SESSION *allSessions = NULL;
|
|||||||
* @return The newly created session or NULL if an error occured
|
* @return The newly created session or NULL if an error occured
|
||||||
*/
|
*/
|
||||||
SESSION *
|
SESSION *
|
||||||
session_alloc(SERVICE *service, DCB *client)
|
session_alloc(SERVICE *service, DCB *client_dcb)
|
||||||
{
|
{
|
||||||
SESSION *session;
|
SESSION *session;
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ session_alloc(SERVICE *service, DCB *client)
|
|||||||
*/
|
*/
|
||||||
spinlock_acquire(&session->ses_lock);
|
spinlock_acquire(&session->ses_lock);
|
||||||
session->service = service;
|
session->service = service;
|
||||||
session->client = client;
|
session->client = client_dcb;
|
||||||
memset(&session->stats, 0, sizeof(SESSION_STATS));
|
memset(&session->stats, 0, sizeof(SESSION_STATS));
|
||||||
session->stats.connect = time(0);
|
session->stats.connect = time(0);
|
||||||
session->state = SESSION_STATE_ALLOC;
|
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
|
* session has not been made available to the other threads at this
|
||||||
* point.
|
* point.
|
||||||
*/
|
*/
|
||||||
session->data = client->data;
|
session->data = client_dcb->data;
|
||||||
client->session = session;
|
client_dcb->session = session;
|
||||||
session->refcount = 1;
|
session->refcount = 1;
|
||||||
/**
|
/**
|
||||||
* This indicates that session is ready to be shared with backend
|
* 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
|
* session, therefore it is important that the session lock is
|
||||||
* relinquished beforethe router call.
|
* relinquished beforethe router call.
|
||||||
*/
|
*/
|
||||||
if (client->state != DCB_STATE_LISTENING)
|
if (client_dcb->state != DCB_STATE_LISTENING)
|
||||||
{
|
{
|
||||||
session->router_session =
|
session->router_session =
|
||||||
service->router->newSession(service->router_instance,
|
service->router->newSession(service->router_instance,
|
||||||
session);
|
session);
|
||||||
|
|
||||||
if (session->router_session == NULL) {
|
if (session->router_session == NULL) {
|
||||||
client->session = NULL;
|
client_dcb->session = NULL;
|
||||||
skygw_log_write_flush(
|
skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"Error : Failed to create router "
|
"Error : Failed to create router "
|
||||||
|
|||||||
@ -170,6 +170,11 @@ typedef enum skygw_chk_t {
|
|||||||
((s) == MYSQL_SESSION_CHANGE ? "MYSQL_SESSION_CHANGE" : \
|
((s) == MYSQL_SESSION_CHANGE ? "MYSQL_SESSION_CHANGE" : \
|
||||||
"UNKNOWN MYSQL STATE"))))))))))
|
"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) { \
|
#define CHK_MLIST(l) { \
|
||||||
ss_info_dassert((l->mlist_chk_top == CHK_NUM_MLIST && \
|
ss_info_dassert((l->mlist_chk_top == CHK_NUM_MLIST && \
|
||||||
l->mlist_chk_tail == CHK_NUM_MLIST), \
|
l->mlist_chk_tail == CHK_NUM_MLIST), \
|
||||||
|
|||||||
Reference in New Issue
Block a user