mysql_client.c:gw_client_close didn't close client session in cases where session->state == SESSION_STATE_STOPPING. That is a bug and lead to situation where session wasn't closed at all.

Also changed 'authorization failed' to 'access denied'
mysql_common.c: fixed memory leak in gw_receive_backend_auth, and replaced error code '2800' with '28000'.
readconnroute.c:handleError didn't set *succp pointer so uninitialized value was used in caller's context.
makefile.inc: added -lm to linker flags
mysql_backend.c: added a few comments
This commit is contained in:
VilhoRaatikka
2014-10-06 11:46:12 +03:00
parent bb11f6236f
commit aca8596efa
6 changed files with 43 additions and 44 deletions

View File

@ -825,7 +825,8 @@ handleError(
DCB *client = NULL;
SESSION *session = backend_dcb->session;
client = session->client;
/** false because connection is not available anymore */
*succp = false;
ss_dassert(client != NULL);
}

View File

@ -266,7 +266,7 @@ static bool handle_error_new_connection(
ROUTER_CLIENT_SES* rses,
DCB* backend_dcb,
GWBUF* errmsg);
static bool handle_error_reply_client(SESSION* ses, GWBUF* errmsg);
static void handle_error_reply_client(SESSION* ses, GWBUF* errmsg);
static backend_ref_t* get_root_master_bref(ROUTER_CLIENT_SES* rses);
@ -1669,7 +1669,7 @@ static int routeQuery(
route_target_t route_target;
bool succp = false;
int rlag_max = MAX_RLAG_UNDEFINED;
backend_type_t btype; /*< target backend type */
backend_type_t btype; /*< target backend type */
CHK_CLIENT_RSES(router_cli_ses);
@ -1683,7 +1683,6 @@ static int routeQuery(
packet = GWBUF_DATA(querybuf);
packet_type = packet[4];
if (rses_is_closed)
{
/**
@ -4015,7 +4014,8 @@ static void handleError (
case ERRACT_REPLY_CLIENT:
{
*succp = handle_error_reply_client(session, errmsgbuf);
handle_error_reply_client(session, errmsgbuf);
*succp = false; /*< no new backend servers were made available */
break;
}
@ -4026,13 +4026,12 @@ static void handleError (
}
static bool handle_error_reply_client(
static void handle_error_reply_client(
SESSION* ses,
GWBUF* errmsg)
{
session_state_t sesstate;
DCB* client_dcb;
bool succp;
spinlock_acquire(&ses->ses_lock);
sesstate = ses->state;
@ -4048,10 +4047,7 @@ static bool handle_error_reply_client(
{
while ((errmsg=gwbuf_consume(errmsg, GWBUF_LENGTH(errmsg))) != NULL)
;
}
succp = false; /** false because new servers aren's selected. */
return succp;
}
}
/**