Complementory fix to bug #694, http://bugs.mariadb.com/show_bug.cgi?id=694
Added new error action to router.h, added functionality to reset error flag from DCB in handleError. Error is reset before every new routing call.
This commit is contained in:
@ -68,7 +68,8 @@ typedef void *ROUTER;
|
|||||||
*/
|
*/
|
||||||
typedef enum error_action {
|
typedef enum error_action {
|
||||||
ERRACT_NEW_CONNECTION = 0x001,
|
ERRACT_NEW_CONNECTION = 0x001,
|
||||||
ERRACT_REPLY_CLIENT = 0x002
|
ERRACT_REPLY_CLIENT = 0x002,
|
||||||
|
ERRACT_RESET = 0x004
|
||||||
} error_action_t;
|
} error_action_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -759,7 +759,7 @@ int gw_read_client_event(
|
|||||||
* else : write custom error to client dcb.
|
* else : write custom error to client dcb.
|
||||||
*/
|
*/
|
||||||
if(rsession == NULL)
|
if(rsession == NULL)
|
||||||
{
|
{
|
||||||
/** COM_QUIT */
|
/** COM_QUIT */
|
||||||
if (MYSQL_IS_COM_QUIT(payload))
|
if (MYSQL_IS_COM_QUIT(payload))
|
||||||
{
|
{
|
||||||
@ -776,7 +776,7 @@ int gw_read_client_event(
|
|||||||
*/
|
*/
|
||||||
dcb_close(dcb);
|
dcb_close(dcb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(SS_DEBUG)
|
#if defined(SS_DEBUG)
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
@ -843,6 +843,8 @@ int gw_read_client_event(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
router->handleError(NULL, NULL, NULL, dcb, ERRACT_RESET, NULL);
|
||||||
|
|
||||||
if (stmt_input)
|
if (stmt_input)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -872,17 +874,25 @@ int gw_read_client_event(
|
|||||||
{
|
{
|
||||||
bool succp;
|
bool succp;
|
||||||
GWBUF* errbuf;
|
GWBUF* errbuf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send error message indicating that routing
|
* Create error to be sent to client if session
|
||||||
* failed
|
* can't be continued.
|
||||||
*/
|
*/
|
||||||
mysql_send_custom_error(
|
errbuf = mysql_create_custom_error(
|
||||||
dcb,
|
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
"Routing query to backend failed. See "
|
"Routing query to backend failed. See "
|
||||||
"the error log for further details.");
|
"the error log for further details.");
|
||||||
|
|
||||||
|
router->handleError(
|
||||||
|
router_instance,
|
||||||
|
session->router_session,
|
||||||
|
errbuf,
|
||||||
|
dcb,
|
||||||
|
ERRACT_REPLY_CLIENT,
|
||||||
|
&succp);
|
||||||
|
free(errbuf);
|
||||||
/**
|
/**
|
||||||
* Create error to be sent to client if session
|
* Create error to be sent to client if session
|
||||||
* can't be continued.
|
* can't be continued.
|
||||||
@ -896,12 +906,12 @@ int gw_read_client_event(
|
|||||||
* available.
|
* available.
|
||||||
*/
|
*/
|
||||||
router->handleError(
|
router->handleError(
|
||||||
router_instance,
|
router_instance,
|
||||||
session->router_session,
|
session->router_session,
|
||||||
errbuf,
|
errbuf,
|
||||||
dcb,
|
dcb,
|
||||||
ERRACT_NEW_CONNECTION,
|
ERRACT_NEW_CONNECTION,
|
||||||
&succp);
|
&succp);
|
||||||
free(errbuf);
|
free(errbuf);
|
||||||
/**
|
/**
|
||||||
* If there are not enough backends close
|
* If there are not enough backends close
|
||||||
@ -1587,7 +1597,7 @@ static int route_by_statement(
|
|||||||
goto return_rc;
|
goto return_rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (*p_readbuf != NULL);
|
while (rc == 1 && *p_readbuf != NULL);
|
||||||
|
|
||||||
return_rc:
|
return_rc:
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -4407,6 +4407,13 @@ static void handleError (
|
|||||||
|
|
||||||
CHK_DCB(backend_dcb);
|
CHK_DCB(backend_dcb);
|
||||||
|
|
||||||
|
/** Reset error handle flag from a given DCB */
|
||||||
|
if (action == ERRACT_RESET)
|
||||||
|
{
|
||||||
|
backend_dcb->dcb_errhandle_called = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/** Don't handle same error twice on same DCB */
|
/** Don't handle same error twice on same DCB */
|
||||||
if (backend_dcb->dcb_errhandle_called)
|
if (backend_dcb->dcb_errhandle_called)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user