Add more error logging to DCB handling

If an illegal DCB close is done with a backend DCB, it will log the server
where it was connected. This allows us to know whether the DCB was
connected to a master or a slave.

Added more debug assertions to readwritesplit code. The DCBs should never
enter the DCB_STATE_DISCONNECTED.

Removed useless debug log messages. The messages usually just flood the
logs with no use to the developers.
This commit is contained in:
Markus Makela
2016-11-05 11:28:18 +02:00
parent 87e94f6bc6
commit c30d0dfc9d
3 changed files with 37 additions and 19 deletions

View File

@ -1032,9 +1032,6 @@ gw_read_and_write(DCB *dcb, MYSQL_session local_session)
{
GWBUF* errbuf;
bool succp;
#if defined(SS_DEBUG)
MXS_ERROR("Backend read error handling #2.");
#endif
errbuf = mysql_create_custom_error(1,
0,
"Read from backend failed");
@ -1554,12 +1551,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,
@ -1572,9 +1563,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);

View File

@ -1096,7 +1096,8 @@ static bool get_dcb(DCB **p_dcb, ROUTER_CLIENT_SES *rses, backend_type_t btype,
{
*p_dcb = backend_ref[i].bref_dcb;
succp = true;
ss_dassert(backend_ref[i].bref_dcb->state != DCB_STATE_ZOMBIE);
ss_dassert(backend_ref[i].bref_dcb->state != DCB_STATE_ZOMBIE ||
backend_ref[i].bref_dcb->state != DCB_STATE_DISCONNECTED);
break;
}
}
@ -1228,7 +1229,8 @@ static bool get_dcb(DCB **p_dcb, ROUTER_CLIENT_SES *rses, backend_type_t btype,
*p_dcb = master_bref->bref_dcb;
succp = true;
/** if bref is in use DCB should not be closed */
ss_dassert(master_bref->bref_dcb->state != DCB_STATE_ZOMBIE);
ss_dassert(master_bref->bref_dcb->state != DCB_STATE_ZOMBIE ||
master_bref->bref_dcb->state != DCB_STATE_DISCONNECTED);
}
else
{