diff --git a/server/modules/routing/binlogrouter/blr.c b/server/modules/routing/binlogrouter/blr.c index 1e8702d25..843c7d04e 100644 --- a/server/modules/routing/binlogrouter/blr.c +++ b/server/modules/routing/binlogrouter/blr.c @@ -2404,6 +2404,10 @@ errorReply(MXS_ROUTER *instance, MXS_FREE(errmsg); } *succp = true; + if (backend_dcb == router->master) + { + router->master = NULL; + } dcb_close(backend_dcb); MXS_NOTICE("%s: Master %s disconnected after %ld seconds. " "%lu events read.", diff --git a/server/modules/routing/binlogrouter/blr_master.c b/server/modules/routing/binlogrouter/blr_master.c index a545efb07..e3405986e 100644 --- a/server/modules/routing/binlogrouter/blr_master.c +++ b/server/modules/routing/binlogrouter/blr_master.c @@ -425,6 +425,7 @@ void blr_master_close(ROUTER_INSTANCE *router) { dcb_close(router->master); + router->master = NULL; router->master_state = BLRM_UNCONNECTED; router->master_event_state = BLR_EVENT_DONE; gwbuf_free(router->stored_event);