MXS-2011 Lock router only when needed

This commit is contained in:
Johan Wikman
2018-08-23 15:21:01 +03:00
parent 0e1d2ec1ec
commit adb7bb8e8a

View File

@ -4185,13 +4185,6 @@ int blr_handle_change_master(ROUTER_INSTANCE* router,
return -1; return -1;
} }
MasterServerConfig current_master;
spinlock_acquire(&router->lock);
/* save current config option data */
blr_master_get_config(router, &current_master);
/* Abort if MASTER_USE_GTID is in use and /* Abort if MASTER_USE_GTID is in use and
* router->mariadb10_master_gtid is not set * 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); MXS_ERROR("%s: %s", router->service->name, error);
spinlock_release(&router->lock);
return -1; return -1;
} }
@ -4231,8 +4222,6 @@ int blr_handle_change_master(ROUTER_INSTANCE* router,
MXS_ERROR("%s: %s", router->service->name, error); MXS_ERROR("%s: %s", router->service->name, error);
spinlock_release(&router->lock);
return -1; return -1;
} }
} }
@ -4253,12 +4242,17 @@ int blr_handle_change_master(ROUTER_INSTANCE* router,
MXS_ERROR("%s: %s", router->service->name, error); MXS_ERROR("%s: %s", router->service->name, error);
spinlock_release(&router->lock);
return -1; return -1;
} }
} }
MasterServerConfig current_master;
spinlock_acquire(&router->lock);
/* save current config option data */
blr_master_get_config(router, &current_master);
/* Change the heartbeat */ /* Change the heartbeat */
if (h_val != -1) if (h_val != -1)
{ {