diff options
author | unknown <anozdrin/alik@alik.opbmk> | 2007-02-22 21:59:43 +0300 |
---|---|---|
committer | unknown <anozdrin/alik@alik.opbmk> | 2007-02-22 21:59:43 +0300 |
commit | 1b0a3baab2be5b64a8e794bc6f4f199c966f9c95 (patch) | |
tree | b3d002cc0f4a2ccf559a023f074dace6f81c21c3 /server-tools | |
parent | ce00eac6d71bd5041d627d0324428033ba9373ed (diff) | |
parent | 4bb9efa61030c699e23791fe49f8db1961e3202c (diff) | |
download | mariadb-git-1b0a3baab2be5b64a8e794bc6f4f199c966f9c95.tar.gz |
Merge alik.opbmk:/mnt/raid/alik/MySQL/devel/5.0-rt
into alik.opbmk:/mnt/raid/alik/MySQL/devel/5.1-rt-merge
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_subselect.cc:
Auto merged
sql/item_subselect.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
mysql-test/t/disabled.def:
Merge: enabled im_daemon_life_cycle.imtest
mysql-test/t/view.test:
Manual merge.
server-tools/instance-manager/listener.cc:
Manual merge.
server-tools/instance-manager/manager.cc:
Manual merge.
server-tools/instance-manager/manager.h:
Manual merge.
server-tools/instance-manager/mysqlmanager.cc:
Manual merge.
server-tools/instance-manager/thread_registry.cc:
Manual merge.
server-tools/instance-manager/thread_registry.h:
Manual merge.
Diffstat (limited to 'server-tools')
-rw-r--r-- | server-tools/instance-manager/listener.cc | 3 | ||||
-rw-r--r-- | server-tools/instance-manager/manager.cc | 8 | ||||
-rw-r--r-- | server-tools/instance-manager/thread_registry.cc | 21 | ||||
-rw-r--r-- | server-tools/instance-manager/thread_registry.h | 3 |
4 files changed, 31 insertions, 4 deletions
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 &); |