Move responsibility for closing DCB on error to router error handling. Check that routers remove or disable links to closed DCB.

This commit is contained in:
counterpoint
2015-09-09 09:33:00 +01:00
parent 2e50dfd484
commit f6916a23bd
10 changed files with 89 additions and 85 deletions

View File

@ -58,6 +58,7 @@ extern __thread log_info_t tls_log_info;
*
* Date Who Description
* 01/12/2014 Vilho Raatikka/Markus Mäkelä Initial implementation
* 09/09/2015 Martin Brampton Modify error handler
*
* @endverbatim
*/
@ -4103,37 +4104,38 @@ return_succp:
* tell whether router has enough master/slave connections to continue work.
*/
static void handleError (
ROUTER* instance,
void* router_session,
GWBUF* errmsgbuf,
DCB* backend_dcb,
error_action_t action,
bool* succp)
ROUTER* instance,
void* router_session,
GWBUF* errmsgbuf,
DCB* backend_dcb,
error_action_t action,
bool* succp)
{
SESSION* session;
ROUTER_INSTANCE* inst = (ROUTER_INSTANCE *)instance;
ROUTER_CLIENT_SES* rses = (ROUTER_CLIENT_SES *)router_session;
SESSION* session;
ROUTER_INSTANCE* inst = (ROUTER_INSTANCE *)instance;
ROUTER_CLIENT_SES* rses = (ROUTER_CLIENT_SES *)router_session;
CHK_DCB(backend_dcb);
CHK_DCB(backend_dcb);
/** Don't handle same error twice on same DCB */
if (backend_dcb->dcb_errhandle_called)
{
/** we optimistically assume that previous call succeed */
*succp = true;
return;
}
else
{
backend_dcb->dcb_errhandle_called = true;
}
session = backend_dcb->session;
/** Don't handle same error twice on same DCB */
if (backend_dcb->dcb_errhandle_called)
{
/** we optimistically assume that previous call succeed */
*succp = true;
return;
}
else
{
backend_dcb->dcb_errhandle_called = true;
}
session = backend_dcb->session;
if (session == NULL || rses == NULL)
{
*succp = false;
return;
}
if (session == NULL || rses == NULL)
{
*succp = false;
}
else
{
CHK_SESSION(session);
CHK_CLIENT_RSES(rses);
@ -4143,7 +4145,7 @@ static void handleError (
if (!rses_begin_locked_router_action(rses))
{
*succp = false;
return;
break;
}
/**
* This is called in hope of getting replacement for
@ -4171,6 +4173,8 @@ static void handleError (
*succp = false;
break;
}
}
dcb_close(backend_dcb);
}