Clean up MySQL protocol debug logging

Removed pthread_self calls from the backend modules. This makes the debug
logging easier to parse when the messages aren't prefixed with the verbose
thread ID.
This commit is contained in:
Markus Mäkelä
2017-04-05 11:14:39 +03:00
parent cf2272f479
commit a88e98035f
3 changed files with 36 additions and 98 deletions

View File

@ -447,11 +447,7 @@ int gw_read_client_event(DCB* dcb)
protocol = (MySQLProtocol *)dcb->protocol;
CHK_PROTOCOL(protocol);
#ifdef SS_DEBUG
MXS_DEBUG("[gw_read_client_event] Protocol state: %s",
gw_mysql_protocol_state2string(protocol->protocol_auth_state));
#endif
MXS_DEBUG("Protocol state: %s", gw_mysql_protocol_state2string(protocol->protocol_auth_state));
/**
* The use of max_bytes seems like a hack, but no better option is available
@ -1051,16 +1047,14 @@ mysql_client_auth_error_handling(DCB *dcb, int auth_val, int packet_number)
switch (auth_val)
{
case MXS_AUTH_NO_SESSION:
MXS_DEBUG("%lu [gw_read_client_event] session creation failed. fd %d, "
"state = MYSQL_AUTH_NO_SESSION.", pthread_self(), dcb->fd);
MXS_DEBUG("session creation failed. fd %d, state = MYSQL_AUTH_NO_SESSION.", dcb->fd);
/** Send ERR 1045 to client */
mysql_send_auth_error(dcb, packet_number, 0, "failed to create new session");
break;
case MXS_AUTH_FAILED_DB:
MXS_DEBUG("%lu [gw_read_client_event] database specified was not valid. fd %d, "
"state = MYSQL_FAILED_AUTH_DB.", pthread_self(), dcb->fd);
MXS_DEBUG("database specified was not valid. fd %d, state = MYSQL_FAILED_AUTH_DB.", dcb->fd);
/** Send error 1049 to client */
message_len = 25 + MYSQL_DATABASE_MAXLEN;
@ -1072,18 +1066,17 @@ mysql_client_auth_error_handling(DCB *dcb, int auth_val, int packet_number)
break;
case MXS_AUTH_FAILED_SSL:
MXS_DEBUG("%lu [gw_read_client_event] client is "
MXS_DEBUG("client is "
"not SSL capable for SSL listener. fd %d, "
"state = MYSQL_FAILED_AUTH_SSL.", pthread_self(), dcb->fd);
"state = MYSQL_FAILED_AUTH_SSL.", dcb->fd);
/** Send ERR 1045 to client */
mysql_send_auth_error(dcb, packet_number, 0, "Access without SSL denied");
break;
case MXS_AUTH_SSL_INCOMPLETE:
MXS_DEBUG("%lu [gw_read_client_event] unable to "
"complete SSL authentication. fd %d, "
"state = MYSQL_AUTH_SSL_INCOMPLETE.", pthread_self(), dcb->fd);
MXS_DEBUG("unable to complete SSL authentication. fd %d, "
"state = MYSQL_AUTH_SSL_INCOMPLETE.", dcb->fd);
/** Send ERR 1045 to client */
mysql_send_auth_error(dcb, packet_number, 0,
@ -1091,8 +1084,7 @@ mysql_client_auth_error_handling(DCB *dcb, int auth_val, int packet_number)
break;
case MXS_AUTH_FAILED:
MXS_DEBUG("%lu [gw_read_client_event] authentication failed. fd %d, "
"state = MYSQL_FAILED_AUTH.", pthread_self(), dcb->fd);
MXS_DEBUG("authentication failed. fd %d, state = MYSQL_FAILED_AUTH.", dcb->fd);
/** Send error 1045 to client */
fail_str = create_auth_fail_str(session->user, dcb->remote,
session->auth_token_len > 0,
@ -1101,8 +1093,7 @@ mysql_client_auth_error_handling(DCB *dcb, int auth_val, int packet_number)
break;
default:
MXS_DEBUG("%lu [gw_read_client_event] authentication failed. fd %d, "
"state unrecognized.", pthread_self(), dcb->fd);
MXS_DEBUG("authentication failed. fd %d, state unrecognized.", dcb->fd);
/** Send error 1045 to client */
fail_str = create_auth_fail_str(session->user, dcb->remote,
session->auth_token_len > 0,
@ -1241,9 +1232,7 @@ static void gw_process_one_new_client(DCB *client_dcb)
{
/** delete client_dcb */
dcb_close(client_dcb);
MXS_ERROR("%lu [gw_MySQLAccept] Failed to create "
"protocol object for client connection.",
pthread_self());
MXS_ERROR("Failed to create protocol object for client connection.");
return;
}
CHK_PROTOCOL(protocol);
@ -1280,20 +1269,14 @@ static void gw_process_one_new_client(DCB *client_dcb)
dcb_close(client_dcb);
/** Previous state is recovered in poll_add_dcb. */
MXS_ERROR("%lu [gw_MySQLAccept] Failed to add dcb %p for "
"fd %d to epoll set.",
pthread_self(),
client_dcb,
client_dcb->fd);
MXS_ERROR("Failed to add dcb %p for fd %d to epoll set.",
client_dcb, client_dcb->fd);
return;
}
else
{
MXS_DEBUG("%lu [gw_MySQLAccept] Added dcb %p for fd "
"%d to epoll set.",
pthread_self(),
client_dcb,
client_dcb->fd);
MXS_DEBUG("Added dcb %p for fd %d to epoll set.",
client_dcb, client_dcb->fd);
}
return;
}
@ -1306,13 +1289,6 @@ static int gw_error_client_event(DCB* dcb)
session = dcb->session;
MXS_DEBUG("%lu [gw_error_client_event] Error event handling for DCB %p "
"in state %s, session %p.",
pthread_self(),
dcb,
STRDCBSTATE(dcb->state),
(session != NULL ? session : NULL));
if (session != NULL && session->state == SESSION_STATE_STOPPING)
{
goto retblock;