summaryrefslogtreecommitdiff
path: root/server-tools/instance-manager/manager.cc
diff options
context:
space:
mode:
authorunknown <petr@mysql.com>2006-02-21 15:57:56 +0300
committerunknown <petr@mysql.com>2006-02-21 15:57:56 +0300
commit21aa5867142d421b34a3f04820fea6e6a9ea527c (patch)
tree97bed2340b3e2c7f36e6d1712661050cd07b1064 /server-tools/instance-manager/manager.cc
parent4e69c153e31f16c2d46e9bd5cacc92b8e92cf00e (diff)
downloadmariadb-git-21aa5867142d421b34a3f04820fea6e6a9ea527c.tar.gz
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()
Diffstat (limited to 'server-tools/instance-manager/manager.cc')
-rw-r--r--server-tools/instance-manager/manager.cc22
1 files changed, 7 insertions, 15 deletions
diff --git a/server-tools/instance-manager/manager.cc b/server-tools/instance-manager/manager.cc
index 3ecd5fbc0d0..95f9029f648 100644
--- a/server-tools/instance-manager/manager.cc
+++ b/server-tools/instance-manager/manager.cc
@@ -135,15 +135,6 @@ void manager(const Options &options)
if (instance_map.init() || user_map.init())
return;
-
- if (instance_map.load())
- {
- log_error("Cannot init instances repository. This might be caused by "
- "the wrong config file options. For instance, missing mysqld "
- "binary. Aborting.");
- return;
- }
-
if (user_map.load(options.password_file_name))
return;
@@ -207,12 +198,13 @@ void manager(const Options &options)
shutdown_complete= FALSE;
- /* init list of guarded instances */
- guardian_thread.lock();
-
- guardian_thread.init();
-
- guardian_thread.unlock();
+ if (instance_map.flush_instances())
+ {
+ log_error("Cannot init instances repository. This might be caused by "
+ "the wrong config file options. For instance, missing mysqld "
+ "binary. Aborting.");
+ return;
+ }
/*
After the list of guarded instances have been initialized,