summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/t/disabled.def1
-rw-r--r--server-tools/instance-manager/listener.cc3
-rw-r--r--server-tools/instance-manager/manager.cc8
-rw-r--r--server-tools/instance-manager/thread_registry.cc21
-rw-r--r--server-tools/instance-manager/thread_registry.h3
5 files changed, 31 insertions, 5 deletions
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 2ed9dbcd400..e01d3d5db96 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -11,7 +11,6 @@
##############################################################################
user_limits : Bug#23921 random failure of user_limits.test
-im_daemon_life_cycle : Bug#24415 see note: [19 Dec 23:17] Trudy Pelzer
im_options : Bug#20294 2006-07-24 stewart Instance manager test im_options fails randomly
concurrent_innodb : BUG#21579 2006-08-11 mleich innodb_concurrent random failures with varying differences
ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
diff --git a/server-tools/instance-manager/listener.cc b/server-tools/instance-manager/listener.cc
index 43cc3f66c94..e68ba2fe8ce 100644
--- a/server-tools/instance-manager/listener.cc
+++ b/server-tools/instance-manager/listener.cc
@@ -177,10 +177,13 @@ void Listener::run()
return;
err:
+ log_error("Listener: failed to initialize. Initiate shutdown...");
+
// we have to close the ip sockets in case of error
for (i= 0; i < num_sockets; i++)
closesocket(sockets[i]);
+ thread_registry->set_error_status();
thread_registry->unregister_thread(&thread_info);
thread_registry->request_shutdown();
return;
diff --git a/server-tools/instance-manager/manager.cc b/server-tools/instance-manager/manager.cc
index 48dfa4c3571..bde685d7a28 100644
--- a/server-tools/instance-manager/manager.cc
+++ b/server-tools/instance-manager/manager.cc
@@ -181,6 +181,9 @@ void Manager::stop_all_threads()
/* Stop all threads. */
p_thread_registry->deliver_shutdown();
+
+ /* Set error status in the thread registry. */
+ p_thread_registry->set_error_status();
}
@@ -248,7 +251,6 @@ bool Manager::init_user_map(User_map *user_map)
int Manager::main()
{
- int rc= 1;
bool shutdown_complete= FALSE;
pid_t manager_pid= getpid();
@@ -442,8 +444,6 @@ int Manager::main()
log_info("Manager: finished.");
- rc= 0;
-
err:
/* delete the pid file */
my_delete(Options::Main::pid_file_name, MYF(0));
@@ -452,7 +452,7 @@ err:
/* free alarm structures */
end_thr_alarm(1);
#endif
- return rc;
+ return thread_registry.get_error_status() ? 1 : 0;
}
diff --git a/server-tools/instance-manager/thread_registry.cc b/server-tools/instance-manager/thread_registry.cc
index bdbdb9caf88..f3a67c5e127 100644
--- a/server-tools/instance-manager/thread_registry.cc
+++ b/server-tools/instance-manager/thread_registry.cc
@@ -52,6 +52,7 @@ void Thread_info::init(bool send_signal_on_shutdown_arg)
Thread_registry::Thread_registry() :
shutdown_in_progress(FALSE)
,sigwait_thread_pid(pthread_self())
+ ,error_status(FALSE)
{
pthread_mutex_init(&LOCK_thread_registry, 0);
pthread_cond_init(&COND_thread_registry_is_empty, 0);
@@ -391,3 +392,23 @@ bool Thread::join()
return pthread_join(id, NULL) != 0;
}
+
+
+int Thread_registry::get_error_status()
+{
+ int ret_error_status;
+
+ pthread_mutex_lock(&LOCK_thread_registry);
+ ret_error_status= error_status;
+ pthread_mutex_unlock(&LOCK_thread_registry);
+
+ return ret_error_status;
+}
+
+
+void Thread_registry::set_error_status()
+{
+ pthread_mutex_lock(&LOCK_thread_registry);
+ error_status= TRUE;
+ pthread_mutex_unlock(&LOCK_thread_registry);
+}
diff --git a/server-tools/instance-manager/thread_registry.h b/server-tools/instance-manager/thread_registry.h
index 17028f56fdb..d04c8442e44 100644
--- a/server-tools/instance-manager/thread_registry.h
+++ b/server-tools/instance-manager/thread_registry.h
@@ -143,6 +143,8 @@ public:
pthread_mutex_t *mutex);
int cond_timedwait(Thread_info *info, pthread_cond_t *cond,
pthread_mutex_t *mutex, struct timespec *wait_time);
+ int get_error_status();
+ void set_error_status();
private:
void interrupt_threads();
@@ -154,6 +156,7 @@ private:
pthread_mutex_t LOCK_thread_registry;
pthread_cond_t COND_thread_registry_is_empty;
pthread_t sigwait_thread_pid;
+ bool error_status;
private:
Thread_registry(const Thread_registry &);