diff --git a/server/core/dcb.c b/server/core/dcb.c index e6ef6baf8..8db2db5e2 100644 --- a/server/core/dcb.c +++ b/server/core/dcb.c @@ -2412,55 +2412,6 @@ gw_write(DCB *dcb, GWBUF *writeq, bool *stop_writing) } #endif /* FAKE_CODE */ -#if defined(SS_DEBUG_MYSQL) - { - size_t len; - uint8_t* packet = (uint8_t *)buf; - char* str; - - /** Print only MySQL packets */ - if (written > 5) - { - str = (char *)&packet[5]; - len = packet[0]; - len += 256 * packet[1]; - len += 256 * 256 * packet[2]; - - if (strncmp(str, "insert", 6) == 0 || - strncmp(str, "create", 6) == 0 || - strncmp(str, "drop", 4) == 0) - { - ss_dassert((dcb->dcb_server_status & (SERVER_RUNNING | SERVER_MASTER | SERVER_SLAVE)) == - (SERVER_RUNNING | SERVER_MASTER)); - } - - if (strncmp(str, "set autocommit", 14) == 0 && nbytes > 17) - { - char* s = (char *)MXS_CALLOC(1, nbytes + 1); - MXS_ABORT_IF_NULL(s); - - if (nbytes - 5 > len) - { - size_t len2 = packet[4 + len]; - len2 += 256 * packet[4 + len + 1]; - len2 += 256 * 256 * packet[4 + len + 2]; - - char* str2 = (char *)&packet[4 + len + 5]; - snprintf(s, 5 + len + len2, "long %s %s", (char *)str, (char *)str2); - } - else - { - snprintf(s, len, "%s", (char *)str); - } - MXS_INFO("%lu [gw_write] Wrote %d bytes : %s ", - pthread_self(), - w, - s); - MXS_FREE(s); - } - } - } -#endif saved_errno = errno; errno = 0; @@ -2477,13 +2428,13 @@ gw_write(DCB *dcb, GWBUF *writeq, bool *stop_writing) #endif { char errbuf[STRERROR_BUFLEN]; - MXS_ERROR("Write to dcb %p " - "in state %s fd %d failed due errno %d, %s", - dcb, - STRDCBSTATE(dcb->state), - dcb->fd, - saved_errno, - strerror_r(saved_errno, errbuf, sizeof(errbuf))); + MXS_ERROR("Write to %s %s in state %s failed due errno %d, %s", + DCB_STRTYPE(dcb), dcb->remote, STRDCBSTATE(dcb->state), + saved_errno, strerror_r(saved_errno, errbuf, sizeof(errbuf))); + MXS_DEBUG("Write to %s %s in state %s failed due errno %d, %s (at %p, fd %d)", + DCB_STRTYPE(dcb), dcb->remote, STRDCBSTATE(dcb->state), + saved_errno, strerror_r(saved_errno, errbuf, sizeof(errbuf)), + dcb, dcb->fd); } } else diff --git a/server/include/dcb.h b/server/include/dcb.h index 2fbabd191..6da199e85 100644 --- a/server/include/dcb.h +++ b/server/include/dcb.h @@ -156,6 +156,11 @@ typedef enum DCB_ROLE_INTERNAL /*< Internal DCB not connected to the outside */ } dcb_role_t; +#define DCB_STRTYPE(dcb) (dcb->dcb_role == DCB_ROLE_CLIENT_HANDLER ? "Client DCB" : \ + dcb->dcb_role == DCB_ROLE_BACKEND_HANDLER ? "Backend DCB" : \ + dcb->dcb_role == DCB_ROLE_SERVICE_LISTENER ? "Listener DCB" : \ + dcb->dcb_role == DCB_ROLE_INTERNAL ? "Internal DCB" : "Unknown DCB") + /** * Callback reasons for the DCB callback mechanism. */ diff --git a/server/modules/protocol/MySQLBackend/mysql_backend.c b/server/modules/protocol/MySQLBackend/mysql_backend.c index 456d4b500..76d52ce2d 100644 --- a/server/modules/protocol/MySQLBackend/mysql_backend.c +++ b/server/modules/protocol/MySQLBackend/mysql_backend.c @@ -1549,12 +1549,6 @@ static int gw_backend_hangup(DCB *dcb) /* dcb_close(dcb); */ goto retblock; } -#if defined(SS_DEBUG) - if (ses_state != SESSION_STATE_STOPPING) - { - MXS_ERROR("Backend hangup error handling."); - } -#endif router->handleError(router_instance, rsession, @@ -1567,9 +1561,6 @@ static int gw_backend_hangup(DCB *dcb) /** There are no required backends available, close session. */ if (!succp) { -#if defined(SS_DEBUG) - MXS_ERROR("Backend hangup -> closing session."); -#endif spinlock_acquire(&session->ses_lock); session->state = SESSION_STATE_STOPPING; spinlock_release(&session->ses_lock);