From adb7bb8e8a429b2ac6530741dd56d6261eb577a6 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 23 Aug 2018 15:21:01 +0300 Subject: [PATCH] MXS-2011 Lock router only when needed --- .../modules/routing/binlogrouter/blr_slave.cc | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/server/modules/routing/binlogrouter/blr_slave.cc b/server/modules/routing/binlogrouter/blr_slave.cc index 432e13700..2d38746ce 100644 --- a/server/modules/routing/binlogrouter/blr_slave.cc +++ b/server/modules/routing/binlogrouter/blr_slave.cc @@ -4185,13 +4185,6 @@ int blr_handle_change_master(ROUTER_INSTANCE* router, return -1; } - MasterServerConfig current_master; - - spinlock_acquire(&router->lock); - - /* save current config option data */ - blr_master_get_config(router, ¤t_master); - /* Abort if MASTER_USE_GTID is in use and * router->mariadb10_master_gtid is not set */ @@ -4204,8 +4197,6 @@ int blr_handle_change_master(ROUTER_INSTANCE* router, MXS_ERROR("%s: %s", router->service->name, error); - spinlock_release(&router->lock); - return -1; } @@ -4231,8 +4222,6 @@ int blr_handle_change_master(ROUTER_INSTANCE* router, MXS_ERROR("%s: %s", router->service->name, error); - spinlock_release(&router->lock); - return -1; } } @@ -4253,12 +4242,17 @@ int blr_handle_change_master(ROUTER_INSTANCE* router, MXS_ERROR("%s: %s", router->service->name, error); - spinlock_release(&router->lock); - return -1; } } + MasterServerConfig current_master; + + spinlock_acquire(&router->lock); + + /* save current config option data */ + blr_master_get_config(router, ¤t_master); + /* Change the heartbeat */ if (h_val != -1) {