summaryrefslogtreecommitdiff
path: root/server-tools/instance-manager/manager.cc
diff options
context:
space:
mode:
authorunknown <anozdrin@mysql.com>2006-06-19 14:16:10 +0400
committerunknown <anozdrin@mysql.com>2006-06-19 14:16:10 +0400
commit645e3135b210a6f3728b2a6c5cfc87ec274419b6 (patch)
tree29ea0fdc269f8eb47647db54ead61096cbb102b4 /server-tools/instance-manager/manager.cc
parent799c5935f0f10073cd23f037bbb027e11d4c1013 (diff)
downloadmariadb-git-645e3135b210a6f3728b2a6c5cfc87ec274419b6.tar.gz
The second fix for BUG#19391: IM fails to start after two executions.
server-tools/instance-manager/guardian.cc: Removed erroneous unlock() in Guardian_thread::init(): instance_map is unlocked in the caller. server-tools/instance-manager/instance_map.cc: Added TODO comment. server-tools/instance-manager/manager.cc: Make initialization of alarm infrustructure before starting Guardian thread, because Guardian uses thr_alarm().
Diffstat (limited to 'server-tools/instance-manager/manager.cc')
-rw-r--r--server-tools/instance-manager/manager.cc43
1 files changed, 31 insertions, 12 deletions
diff --git a/server-tools/instance-manager/manager.cc b/server-tools/instance-manager/manager.cc
index 00ef50a84e1..353dfcf64dc 100644
--- a/server-tools/instance-manager/manager.cc
+++ b/server-tools/instance-manager/manager.cc
@@ -147,6 +147,25 @@ void manager(const Options &options)
if (create_pid_file(options.pid_file_name, manager_pid))
return;
+ /*
+ Initialize signals and alarm-infrastructure.
+
+ NOTE: To work nicely with LinuxThreads, the signal thread is the first
+ thread in the process.
+
+ NOTE:
+ After init_thr_alarm() call it's possible to call thr_alarm() (from
+ different threads), that results in sending ALARM signal to the alarm
+ thread (which can be the main thread). That signal can interrupt
+ blocking calls.
+
+ In other words, a blocking call can be interrupted in the main thread
+ after init_thr_alarm().
+ */
+
+ sigset_t mask;
+ set_signals(&mask);
+
/* create guardian thread */
{
pthread_t guardian_thd_id;
@@ -154,9 +173,16 @@ void manager(const Options &options)
int rc;
/*
- NOTE: Guardian should be shutdown first. Only then all other threads
- need to be stopped. This should be done, as guardian is responsible for
- shutting down the instances, and this is a long operation.
+ NOTE: Guardian should be shutdown first. Only then all other threads
+ need to be stopped. This should be done, as guardian is responsible
+ for shutting down the instances, and this is a long operation.
+
+ NOTE: Guardian uses thr_alarm() when detects current state of
+ instances (is_running()), but it is not interfere with
+ flush_instances() later in the code, because until flush_instances()
+ complete in the main thread, Guardian thread is not permitted to
+ process instances. And before flush_instances() there is no instances
+ to proceed.
*/
pthread_attr_init(&guardian_thd_attr);
@@ -172,10 +198,8 @@ void manager(const Options &options)
}
- /*
- To work nicely with LinuxThreads, the signal thread is the first thread
- in the process.
- */
+ /* Load instances. */
+
int signo;
bool shutdown_complete;
@@ -189,11 +213,6 @@ void manager(const Options &options)
return;
}
- /* Initialize signals and alarm-infrastructure. */
-
- sigset_t mask;
- set_signals(&mask);
-
/* create the listener */
{
pthread_t listener_thd_id;