mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix race condition: instance map wasn't locked for the
duration of the whole 'flush instances'. As a consequence, it was possible to query instance map, while it is in the inconsistent state. The patch was reworked after review. server-tools/instance-manager/guardian.cc: do not lock instance map in Guardian_thread::init() server-tools/instance-manager/instance_map.cc: Eliminate race condition: lock instance map and guardian for the duration of the whole "FLUSH INSTANCES" execution. server-tools/instance-manager/instance_map.h: add new method. cleanup interface. add comments. server-tools/instance-manager/manager.cc: use instance_map.flush_instances instead of instance_map.load() and guardian_thread.init()
This commit is contained in:
@ -63,21 +63,24 @@ public:
|
||||
void lock();
|
||||
void unlock();
|
||||
int init();
|
||||
/*
|
||||
Process a given option and assign it to appropricate instance. This is
|
||||
required for the option handler, passed to my_search_option_files().
|
||||
*/
|
||||
int process_one_option(const char *group, const char *option);
|
||||
|
||||
Instance_map(const char *default_mysqld_path_arg);
|
||||
~Instance_map();
|
||||
|
||||
/* loads options from config files */
|
||||
int load();
|
||||
/* adds instance to internal hash */
|
||||
int add_instance(Instance *instance);
|
||||
/* inits instances argv's after all options have been loaded */
|
||||
int complete_initialization();
|
||||
|
||||
public:
|
||||
const char *mysqld_path;
|
||||
Guardian_thread *guardian;
|
||||
|
||||
private:
|
||||
/* loads options from config files */
|
||||
int load();
|
||||
/* inits instances argv's after all options have been loaded */
|
||||
int complete_initialization();
|
||||
private:
|
||||
enum { START_HASH_SIZE = 16 };
|
||||
pthread_mutex_t LOCK_instance_map;
|
||||
|
Reference in New Issue
Block a user