Merge branch '2.1' into develop

This commit is contained in:
Johan Wikman
2017-02-09 15:07:13 +02:00
31 changed files with 517 additions and 229 deletions

View File

@ -291,20 +291,15 @@ static void handleError(MXS_ROUTER *instance,
{
backend_dcb->dcb_errhandle_called = true;
}
spinlock_acquire(&session->ses_lock);
sesstate = session->state;
client_dcb = session->client_dcb;
if (sesstate == SESSION_STATE_ROUTER_READY)
{
CHK_DCB(client_dcb);
spinlock_release(&session->ses_lock);
client_dcb->func.write(client_dcb, gwbuf_clone(errbuf));
}
else
{
spinlock_release(&session->ses_lock);
}
/** false because connection is not available anymore */
dcb_close(backend_dcb);

View File

@ -82,7 +82,6 @@
#include <maxscale/atomic.h>
#include <maxscale/spinlock.h>
#include <maxscale/dcb.h>
#include <maxscale/spinlock.h>
#include <maxscale/modinfo.h>
#include <maxscale/log_manager.h>
#include <maxscale/protocol/mysql.h>
@ -105,9 +104,6 @@ static void rses_end_locked_router_action(ROUTER_CLIENT_SES* rses);
static SERVER_REF *get_root_master(SERVER_REF *servers);
static int handle_state_switch(DCB* dcb, DCB_REASON reason, void * routersession);
static SPINLOCK instlock;
static ROUTER_INSTANCE *instances;
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -119,8 +115,6 @@ static ROUTER_INSTANCE *instances;
MXS_MODULE* MXS_CREATE_MODULE()
{
MXS_NOTICE("Initialise readconnroute router module.");
spinlock_init(&instlock);
instances = NULL;
static MXS_ROUTER_OBJECT MyObject =
{
@ -252,10 +246,6 @@ createInstance(SERVICE *service, char **options)
* insert this router instance into the linked list of routers
* that have been created with this module.
*/
spinlock_acquire(&instlock);
inst->next = instances;
instances = inst;
spinlock_release(&instlock);
return (MXS_ROUTER *) inst;
}
@ -710,20 +700,16 @@ static void handleError(MXS_ROUTER *instance, void *router_session, GWBUF *errbu
{
problem_dcb->dcb_errhandle_called = true;
}
spinlock_acquire(&session->ses_lock);
sesstate = session->state;
client_dcb = session->client_dcb;
if (sesstate == SESSION_STATE_ROUTER_READY)
{
CHK_DCB(client_dcb);
spinlock_release(&session->ses_lock);
client_dcb->func.write(client_dcb, gwbuf_clone(errbuf));
}
else
{
spinlock_release(&session->ses_lock);
}
if (DCB_ROLE_CLIENT_HANDLER == problem_dcb->dcb_role)
{

View File

@ -1535,10 +1535,8 @@ static void handle_error_reply_client(MXS_SESSION *ses, ROUTER_CLIENT_SES *rses,
DCB *client_dcb;
backend_ref_t *bref;
spinlock_acquire(&ses->ses_lock);
sesstate = ses->state;
client_dcb = ses->client_dcb;
spinlock_release(&ses->ses_lock);
if ((bref = get_bref_from_dcb(rses, backend_dcb)) != NULL)
{

View File

@ -860,8 +860,6 @@ static void* newSession(MXS_ROUTER* router_inst, MXS_SESSION* session)
bool using_db = false;
bool have_db = false;
spinlock_acquire(&session->ses_lock);
/* To enable connecting directly to a sharded database we first need
* to disable it for the client DCB's protocol so that we can connect to them*/
if (protocol->client_capabilities & GW_MYSQL_CAPABILITIES_CONNECT_WITH_DB &&
@ -880,8 +878,6 @@ static void* newSession(MXS_ROUTER* router_inst, MXS_SESSION* session)
MXS_INFO("Client'%s' connecting with empty database.", data->user);
}
spinlock_release(&session->ses_lock);
client_rses = (ROUTER_CLIENT_SES *)MXS_CALLOC(1, sizeof(ROUTER_CLIENT_SES));
if (client_rses == NULL)
@ -3647,10 +3643,8 @@ static void handle_error_reply_client(MXS_SESSION* ses,
DCB* client_dcb;
backend_ref_t* bref;
spinlock_acquire(&ses->ses_lock);
sesstate = ses->state;
client_dcb = ses->client_dcb;
spinlock_release(&ses->ses_lock);
/**
* If bref exists, mark it closed