Place checks in callback routines because DCB will not always contain a reference to a router session, and the associated data will be invalid in this case.
This commit is contained in:
@ -2574,11 +2574,6 @@ dcb_call_callback(DCB *dcb, DCB_REASON reason)
|
|||||||
{
|
{
|
||||||
DCB_CALLBACK *cb, *nextcb;
|
DCB_CALLBACK *cb, *nextcb;
|
||||||
|
|
||||||
if (NULL == dcb->session->router_session)
|
|
||||||
{
|
|
||||||
dcb_close(dcb);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
spinlock_acquire(&dcb->cb_lock);
|
spinlock_acquire(&dcb->cb_lock);
|
||||||
cb = dcb->callbacks;
|
cb = dcb->callbacks;
|
||||||
while (cb)
|
while (cb)
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
* 19/03/2015 Massimiliano Pinto Addition of basic MariaDB 10 compatibility support
|
* 19/03/2015 Massimiliano Pinto Addition of basic MariaDB 10 compatibility support
|
||||||
* 07/05/2015 Massimiliano Pinto Added MariaDB 10 Compatibility
|
* 07/05/2015 Massimiliano Pinto Added MariaDB 10 Compatibility
|
||||||
* 11/05/2015 Massimiliano Pinto Only MariaDB 10 Slaves can register to binlog router with a MariaDB 10 Master
|
* 11/05/2015 Massimiliano Pinto Only MariaDB 10 Slaves can register to binlog router with a MariaDB 10 Master
|
||||||
|
* 25/09/2015 Martin Brampton Block callback processing when no router session in the DCB
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -1606,6 +1607,15 @@ blr_slave_callback(DCB *dcb, DCB_REASON reason, void *data)
|
|||||||
ROUTER_SLAVE *slave = (ROUTER_SLAVE *)data;
|
ROUTER_SLAVE *slave = (ROUTER_SLAVE *)data;
|
||||||
ROUTER_INSTANCE *router = slave->router;
|
ROUTER_INSTANCE *router = slave->router;
|
||||||
|
|
||||||
|
if (NULL == dcb->session->router_session)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* The following processing will fail if there is no router session,
|
||||||
|
* because the "data" parameter will not contain meaningful data,
|
||||||
|
* so we have no choice but to stop here.
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (reason == DCB_REASON_DRAINED)
|
if (reason == DCB_REASON_DRAINED)
|
||||||
{
|
{
|
||||||
if (slave->state == BLRS_DUMPING)
|
if (slave->state == BLRS_DUMPING)
|
||||||
|
@ -69,6 +69,7 @@
|
|||||||
* 27/06/2014 Mark Riddoch Addition of server weighting
|
* 27/06/2014 Mark Riddoch Addition of server weighting
|
||||||
* 11/06/2015 Martin Brampton Remove decrement n_current (moved to dcb.c)
|
* 11/06/2015 Martin Brampton Remove decrement n_current (moved to dcb.c)
|
||||||
* 09/09/2015 Martin Brampton Modify error handler
|
* 09/09/2015 Martin Brampton Modify error handler
|
||||||
|
* 25/09/2015 Martin Brampton Block callback processing when no router session in the DCB
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -1010,6 +1011,14 @@ static int handle_state_switch(DCB* dcb,DCB_REASON reason, void * routersession)
|
|||||||
SERVICE* service = session->service;
|
SERVICE* service = session->service;
|
||||||
ROUTER* router = (ROUTER *)service->router;
|
ROUTER* router = (ROUTER *)service->router;
|
||||||
|
|
||||||
|
if (NULL == dcb->session->router_session && DCB_REASON_ERROR != reason)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* We cannot handle a DCB that does not have a router session,
|
||||||
|
* except in the case where error processing is invoked.
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
switch(reason)
|
switch(reason)
|
||||||
{
|
{
|
||||||
case DCB_REASON_CLOSE:
|
case DCB_REASON_CLOSE:
|
||||||
|
@ -71,6 +71,7 @@ extern __thread log_info_t tls_log_info;
|
|||||||
* 17/07/2014 Massimiliano Pinto Server connection counter is updated in closeSession
|
* 17/07/2014 Massimiliano Pinto Server connection counter is updated in closeSession
|
||||||
*
|
*
|
||||||
* 09/09/2015 Martin Brampton Modify error handler
|
* 09/09/2015 Martin Brampton Modify error handler
|
||||||
|
* 25/09/2015 Martin Brampton Block callback processing when no router session in the DCB
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -5308,6 +5309,15 @@ static int router_handle_state_switch(
|
|||||||
int rc = 1;
|
int rc = 1;
|
||||||
SERVER* srv;
|
SERVER* srv;
|
||||||
CHK_DCB(dcb);
|
CHK_DCB(dcb);
|
||||||
|
if (NULL == dcb->session->router_session)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* The following processing will fail if there is no router session,
|
||||||
|
* because the "data" parameter will not contain meaningful data,
|
||||||
|
* so we have no choice but to stop here.
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
bref = (backend_ref_t *)data;
|
bref = (backend_ref_t *)data;
|
||||||
CHK_BACKEND_REF(bref);
|
CHK_BACKEND_REF(bref);
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ extern __thread log_info_t tls_log_info;
|
|||||||
* Date Who Description
|
* Date Who Description
|
||||||
* 01/12/2014 Vilho Raatikka/Markus Mäkelä Initial implementation
|
* 01/12/2014 Vilho Raatikka/Markus Mäkelä Initial implementation
|
||||||
* 09/09/2015 Martin Brampton Modify error handler
|
* 09/09/2015 Martin Brampton Modify error handler
|
||||||
|
* 25/09/2015 Martin Brampton Block callback processing when no router session in the DCB
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -4404,6 +4405,15 @@ router_handle_state_switch(
|
|||||||
SERVER* srv;
|
SERVER* srv;
|
||||||
|
|
||||||
CHK_DCB(dcb);
|
CHK_DCB(dcb);
|
||||||
|
if (NULL == dcb->session->router_session)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* The following processing will fail if there is no router session,
|
||||||
|
* because the "data" parameter will not contain meaningful data,
|
||||||
|
* so we have no choice but to stop here.
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
bref = (backend_ref_t *) data;
|
bref = (backend_ref_t *) data;
|
||||||
CHK_BACKEND_REF(bref);
|
CHK_BACKEND_REF(bref);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user