Remove ERRACT_RESET action from router error handler; remove sole call from mysql_client. Correct comments on parameters for router error handlers.

This commit is contained in:
counterpoint
2015-09-09 08:31:59 +01:00
parent 4a1ad3df69
commit 986c918d52
8 changed files with 16 additions and 41 deletions

View File

@ -45,8 +45,7 @@ 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;
/** /**

View File

@ -1130,7 +1130,7 @@ int gw_read_client_event(
else else
{ {
/** Reset error handler when routing of the new query begins */ /** Reset error handler when routing of the new query begins */
router->handleError(NULL, NULL, NULL, dcb, ERRACT_RESET, NULL); dcb->dcb_errhandle_called = false;
if (stmt_input) if (stmt_input)
{ {

View File

@ -1072,8 +1072,8 @@ int len;
* @param router_session The router session * @param router_session The router session
* @param message The error message to reply * @param message The error message to reply
* @param backend_dcb The backend DCB * @param backend_dcb The backend DCB
* @param action The action: REPLY, REPLY_AND_CLOSE, NEW_CONNECTION * @param action The action: ERRACT_NEW_CONNECTION or ERRACT_REPLY_CLIENT
* @param succp Result of action * @param succp Result of action: true iff router can continue
* *
*/ */
static void static void
@ -1084,12 +1084,6 @@ int error;
socklen_t len; socklen_t len;
char msg[85], *errmsg; char msg[85], *errmsg;
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)
{ {

View File

@ -291,7 +291,8 @@ static void freeSession(
* @param router_session The router session * @param router_session The router session
* @param message The error message to reply * @param message The error message to reply
* @param backend_dcb The backend DCB * @param backend_dcb The backend DCB
* @param action The action: REPLY, REPLY_AND_CLOSE, NEW_CONNECTION * @param action The action: ERRACT_NEW_CONNECTION or ERRACT_REPLY_CLIENT
* @param succp Result of action: true iff router can continue
* *
*/ */
static void handleError( static void handleError(
@ -307,13 +308,6 @@ static void handleError(
SESSION *session = backend_dcb->session; SESSION *session = backend_dcb->session;
session_state_t sesstate; session_state_t sesstate;
/** 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)
{ {

View File

@ -841,7 +841,8 @@ clientReply(
* @param router_session The router session * @param router_session The router session
* @param message The error message to reply * @param message The error message to reply
* @param backend_dcb The backend DCB * @param backend_dcb The backend DCB
* @param action The action: REPLY, REPLY_AND_CLOSE, NEW_CONNECTION * @param action The action: ERRACT_NEW_CONNECTION or ERRACT_REPLY_CLIENT
* @param succp Result of action: true if router can continue
* *
*/ */
static void handleError( static void handleError(
@ -858,13 +859,6 @@ static void handleError(
session_state_t sesstate; session_state_t sesstate;
ROUTER_CLIENT_SES *router_cli_ses = (ROUTER_CLIENT_SES *)router_session; ROUTER_CLIENT_SES *router_cli_ses = (ROUTER_CLIENT_SES *)router_session;
/** 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)
{ {

View File

@ -4805,9 +4805,8 @@ static void rwsplit_process_router_options(
* @param router_session The router session * @param router_session The router session
* @param errmsgbuf The error message to reply * @param errmsgbuf The error message to reply
* @param backend_dcb The backend DCB * @param backend_dcb The backend DCB
* @param action The action: REPLY, REPLY_AND_CLOSE, NEW_CONNECTION * @param action The action: ERRACT_NEW_CONNECTION or ERRACT_REPLY_CLIENT
* @param succp Result of action. True if there is at least master * @param succp Result of action: true iff router can continue
* and enough slaves to continue session. Otherwise false.
* *
* Even if succp == true connecting to new slave may have failed. succp is to * Even if succp == true connecting to new slave may have failed. succp is to
* tell whether router has enough master/slave connections to continue work. * tell whether router has enough master/slave connections to continue work.

View File

@ -4096,8 +4096,8 @@ return_succp:
* @param router_session The router session * @param router_session The router session
* @param errmsgbuf The error message to reply * @param errmsgbuf The error message to reply
* @param backend_dcb The backend DCB * @param backend_dcb The backend DCB
* @param action The action: REPLY, REPLY_AND_CLOSE, NEW_CONNECTION * @param action The action: ERRACT_NEW_CONNECTION or ERRACT_REPLY_CLIENT
* @param succp Result of action. * @param succp Result of action: true iff router can continue
* *
* Even if succp == true connecting to new slave may have failed. succp is to * Even if succp == true connecting to new slave may have failed. succp is to
* tell whether router has enough master/slave connections to continue work. * tell whether router has enough master/slave connections to continue work.
@ -4115,10 +4115,7 @@ static void handleError (
ROUTER_CLIENT_SES* rses = (ROUTER_CLIENT_SES *)router_session; ROUTER_CLIENT_SES* rses = (ROUTER_CLIENT_SES *)router_session;
CHK_DCB(backend_dcb); CHK_DCB(backend_dcb);
if(succp == NULL || action == ERRACT_RESET)
{
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)
{ {

View File

@ -2791,8 +2791,8 @@ return_succp:
* @param router_session The router session * @param router_session The router session
* @param errmsgbuf The error message to reply * @param errmsgbuf The error message to reply
* @param backend_dcb The backend DCB * @param backend_dcb The backend DCB
* @param action The action: REPLY, REPLY_AND_CLOSE, NEW_CONNECTION * @param action The action: ERRACT_NEW_CONNECTION or ERRACT_REPLY_CLIENT
* @param succp Result of action. * @param succp Result of action: true if router can continue
* *
* Even if succp == true connecting to new slave may have failed. succp is to * Even if succp == true connecting to new slave may have failed. succp is to
* tell whether router has enough master/slave connections to continue work. * tell whether router has enough master/slave connections to continue work.
@ -2809,10 +2809,8 @@ handleError(
SESSION* session; SESSION* session;
ROUTER_CLIENT_SES* rses = (ROUTER_CLIENT_SES *) router_session; ROUTER_CLIENT_SES* rses = (ROUTER_CLIENT_SES *) router_session;
if(action == ERRACT_RESET)
return;
CHK_DCB(backend_dcb); CHK_DCB(backend_dcb);
/** 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)
{ {