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:
parent
c5c9165a26
commit
da77da803b
@ -68,7 +68,8 @@ typedef void *ROUTER;
|
||||
*/
|
||||
typedef enum error_action {
|
||||
ERRACT_NEW_CONNECTION = 0x001,
|
||||
ERRACT_REPLY_CLIENT = 0x002
|
||||
ERRACT_REPLY_CLIENT = 0x002,
|
||||
ERRACT_RESET = 0x004
|
||||
} error_action_t;
|
||||
|
||||
|
||||
|
@ -759,7 +759,7 @@ int gw_read_client_event(
|
||||
* else : write custom error to client dcb.
|
||||
*/
|
||||
if(rsession == NULL)
|
||||
{
|
||||
{
|
||||
/** COM_QUIT */
|
||||
if (MYSQL_IS_COM_QUIT(payload))
|
||||
{
|
||||
@ -776,7 +776,7 @@ int gw_read_client_event(
|
||||
*/
|
||||
dcb_close(dcb);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
#if defined(SS_DEBUG)
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
@ -843,6 +843,8 @@ int gw_read_client_event(
|
||||
}
|
||||
else
|
||||
{
|
||||
router->handleError(NULL, NULL, NULL, dcb, ERRACT_RESET, NULL);
|
||||
|
||||
if (stmt_input)
|
||||
{
|
||||
/**
|
||||
@ -872,17 +874,25 @@ int gw_read_client_event(
|
||||
{
|
||||
bool succp;
|
||||
GWBUF* errbuf;
|
||||
|
||||
|
||||
/**
|
||||
* Send error message indicating that routing
|
||||
* failed
|
||||
* Create error to be sent to client if session
|
||||
* can't be continued.
|
||||
*/
|
||||
mysql_send_custom_error(
|
||||
dcb,
|
||||
errbuf = mysql_create_custom_error(
|
||||
1,
|
||||
0,
|
||||
"Routing query to backend failed. See "
|
||||
"the error log for further details.");
|
||||
"Routing query to backend failed. See "
|
||||
"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
|
||||
* can't be continued.
|
||||
@ -896,12 +906,12 @@ int gw_read_client_event(
|
||||
* available.
|
||||
*/
|
||||
router->handleError(
|
||||
router_instance,
|
||||
session->router_session,
|
||||
errbuf,
|
||||
dcb,
|
||||
ERRACT_NEW_CONNECTION,
|
||||
&succp);
|
||||
router_instance,
|
||||
session->router_session,
|
||||
errbuf,
|
||||
dcb,
|
||||
ERRACT_NEW_CONNECTION,
|
||||
&succp);
|
||||
free(errbuf);
|
||||
/**
|
||||
* If there are not enough backends close
|
||||
@ -1587,7 +1597,7 @@ static int route_by_statement(
|
||||
goto return_rc;
|
||||
}
|
||||
}
|
||||
while (*p_readbuf != NULL);
|
||||
while (rc == 1 && *p_readbuf != NULL);
|
||||
|
||||
return_rc:
|
||||
return rc;
|
||||
|
@ -4407,6 +4407,13 @@ static void handleError (
|
||||
|
||||
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 */
|
||||
if (backend_dcb->dcb_errhandle_called)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user