Merge branch '2.2' into develop
This commit is contained in:
@ -391,7 +391,8 @@ dcb_connect(SERVER *server, MXS_SESSION *session, const char *protocol)
|
||||
if (user && strlen(user))
|
||||
{
|
||||
MXS_DEBUG("Looking for persistent connection DCB user %s protocol %s", user, protocol);
|
||||
dcb = server_get_persistent(server, user, protocol, session->client_dcb->poll.thread.id);
|
||||
dcb = server_get_persistent(server, user, session->client_dcb->remote,
|
||||
protocol, session->client_dcb->poll.thread.id);
|
||||
if (dcb)
|
||||
{
|
||||
/**
|
||||
@ -428,6 +429,11 @@ dcb_connect(SERVER *server, MXS_SESSION *session, const char *protocol)
|
||||
memcpy(&(dcb->func), funcs, sizeof(MXS_PROTOCOL));
|
||||
dcb->protoname = MXS_STRDUP_A(protocol);
|
||||
|
||||
if (session->client_dcb->remote)
|
||||
{
|
||||
dcb->remote = MXS_STRDUP_A(session->client_dcb->remote);
|
||||
}
|
||||
|
||||
const char *authenticator = server->authenticator ?
|
||||
server->authenticator : dcb->func.auth_default ?
|
||||
dcb->func.auth_default() : "NullAuthDeny";
|
||||
|
@ -213,12 +213,15 @@ server_free(SERVER *tofreeserver)
|
||||
/**
|
||||
* Get a DCB from the persistent connection pool, if possible
|
||||
*
|
||||
* @param server The server to set the name on
|
||||
* @param user The name of the user needing the connection
|
||||
* @param protocol The name of the protocol needed for the connection
|
||||
* @param server The server to set the name on
|
||||
* @param user The name of the user needing the connection
|
||||
* @param ip Client IP address
|
||||
* @param protocol The name of the protocol needed for the connection
|
||||
* @param id Thread ID
|
||||
*
|
||||
* @return A DCB or NULL if no connection is found
|
||||
*/
|
||||
DCB *
|
||||
server_get_persistent(SERVER *server, const char *user, const char *protocol, int id)
|
||||
DCB* server_get_persistent(SERVER *server, const char *user, const char* ip, const char *protocol, int id)
|
||||
{
|
||||
DCB *dcb, *previous = NULL;
|
||||
|
||||
@ -232,9 +235,12 @@ server_get_persistent(SERVER *server, const char *user, const char *protocol, in
|
||||
{
|
||||
if (dcb->user
|
||||
&& dcb->protoname
|
||||
&& dcb->remote
|
||||
&& ip
|
||||
&& !dcb-> dcb_errhandle_called
|
||||
&& !(dcb->flags & DCBF_HUNG)
|
||||
&& 0 == strcmp(dcb->user, user)
|
||||
&& 0 == strcmp(dcb->remote, ip)
|
||||
&& 0 == strcmp(dcb->protoname, protocol))
|
||||
{
|
||||
if (NULL == previous)
|
||||
|
@ -139,7 +139,7 @@ void LocalClient::process(uint32_t events)
|
||||
error();
|
||||
}
|
||||
|
||||
if (m_queue.size() && m_state != VC_ERROR)
|
||||
if (m_queue.size() && m_state != VC_ERROR && m_state != VC_WAITING_HANDSHAKE)
|
||||
{
|
||||
drain_queue();
|
||||
}
|
||||
|
@ -336,8 +336,8 @@ int MySQLSendHandshake(DCB* dcb)
|
||||
mysql_server_capabilities_one[1] = (uint8_t)(GW_MYSQL_CAPABILITIES_SERVER >> 8);
|
||||
|
||||
// Check that we match the old values
|
||||
ss_dassert(mysql_server_capabilities_one[0] = 0xff);
|
||||
ss_dassert(mysql_server_capabilities_one[1] = 0xf7);
|
||||
ss_dassert(mysql_server_capabilities_one[0] == 0xff);
|
||||
ss_dassert(mysql_server_capabilities_one[1] == 0xf7);
|
||||
|
||||
if (is_maria)
|
||||
{
|
||||
@ -1016,6 +1016,10 @@ gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Update the current command, required by KILL command processing
|
||||
MySQLProtocol *proto = (MySQLProtocol*)dcb->protocol;
|
||||
proto->current_command = (mxs_mysql_cmd_t)mxs_mysql_get_command(read_buffer);
|
||||
|
||||
char* message = handle_variables(session, &read_buffer);
|
||||
|
||||
if (message)
|
||||
|
@ -334,7 +334,7 @@ newSession(MXS_ROUTER *instance, MXS_SESSION *session)
|
||||
{
|
||||
if (master_host)
|
||||
{
|
||||
if (ref == master_host && (inst->bitvalue & SERVER_SLAVE))
|
||||
if (ref == master_host && (inst->bitvalue & (SERVER_SLAVE | SERVER_MASTER)) == SERVER_SLAVE)
|
||||
{
|
||||
/* Skip root master here, as it could also be slave of an external server that
|
||||
* is not in the configuration. Intermediate masters (Relay Servers) are also
|
||||
@ -353,16 +353,13 @@ newSession(MXS_ROUTER *instance, MXS_SESSION *session)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (inst->bitvalue == SERVER_MASTER)
|
||||
{
|
||||
/* Master_host is NULL, no master server. If requested router_option is 'master'
|
||||
* candidate wll be NULL.
|
||||
* candidate will be NULL.
|
||||
*/
|
||||
if (inst->bitvalue & SERVER_MASTER)
|
||||
{
|
||||
candidate = NULL;
|
||||
break;
|
||||
}
|
||||
candidate = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If no candidate set, set first running server as our initial candidate server */
|
||||
@ -548,7 +545,7 @@ static inline bool connection_is_valid(ROUTER_INSTANCE* inst, ROUTER_CLIENT_SES*
|
||||
if (SERVER_IS_RUNNING(router_cli_ses->backend->server) &&
|
||||
(router_cli_ses->backend->server->status & inst->bitmask & inst->bitvalue))
|
||||
{
|
||||
if ((inst->bitvalue & SERVER_MASTER) && router_cli_ses->backend->active)
|
||||
if ((inst->bitvalue == SERVER_MASTER) && router_cli_ses->backend->active)
|
||||
{
|
||||
// If we're using an active master server, verify that it is still a master
|
||||
rval = router_cli_ses->backend == get_root_master(inst->service->dbref);
|
||||
|
Reference in New Issue
Block a user