Commit b5536bb9 authored by unknown's avatar unknown

Some minor IM fixes


server-tools/instance-manager/Makefile.am:
  Makefile.am cleanup
server-tools/instance-manager/commands.cc:
  cleanup
server-tools/instance-manager/instance_map.cc:
  fix the problem caused thread deadlock (as load ends up in the find()
  call which now also locks an instance map mutex)
server-tools/instance-manager/listener.cc:
  portability fix
server-tools/instance-manager/manager.cc:
  Ignore SIGPIPE
server-tools/instance-manager/mysqlmanager.cc:
  cleanup
server-tools/instance-manager/options.cc:
  options renamed
parent 0157ffa5
...@@ -42,25 +42,19 @@ liboptions_a_SOURCES= options.h options.cc priv.h priv.cc ...@@ -42,25 +42,19 @@ liboptions_a_SOURCES= options.h options.cc priv.h priv.cc
# MySQL sometimes uses symlinks to reuse code # MySQL sometimes uses symlinks to reuse code
# All symlinked files are grouped in libnet.a # All symlinked files are grouped in libnet.a
nodist_libnet_a_SOURCES= net_serv.cc client_settings.h client.c errmsg.c nodist_libnet_a_SOURCES= net_serv.cc client_settings.h
libnet_a_LIBADD= $(top_builddir)/sql/password.$(OBJEXT) \ libnet_a_LIBADD= $(top_builddir)/sql/password.$(OBJEXT) \
$(top_builddir)/sql/pack.$(OBJEXT) \ $(top_builddir)/sql/pack.$(OBJEXT) \
$(top_builddir)/sql/sql_state.$(OBJEXT) $(top_builddir)/sql/sql_state.$(OBJEXT) \
$(top_builddir)/sql/mini_client_errors.$(OBJEXT)\
$(top_builddir)/sql/client.$(OBJEXT)
CLEANFILES= net_serv.cc client.c client_settings.h errmsg.c CLEANFILES= net_serv.cc client_settings.h
net_serv.cc: Makefile net_serv.cc: Makefile
rm -f $(srcdir)/net_serv.cc rm -f $(srcdir)/net_serv.cc
@LN_CP_F@ $(top_srcdir)/sql/net_serv.cc $(srcdir)/net_serv.cc @LN_CP_F@ $(top_srcdir)/sql/net_serv.cc $(srcdir)/net_serv.cc
client.c: Makefile
rm -f $(srcdir)/client.c
@LN_CP_F@ $(top_srcdir)/sql-common/client.c $(srcdir)/client.c
errmsg.c: Makefile
rm -f $(srcdir)/errmsg.c
@LN_CP_F@ $(top_srcdir)/libmysql/errmsg.c $(srcdir)/errmsg.c
client_settings.h: Makefile client_settings.h: Makefile
rm -f $(srcdir)/client_settings.h rm -f $(srcdir)/client_settings.h
@LN_CP_F@ $(top_srcdir)/sql/client_settings.h $(srcdir)/client_settings.h @LN_CP_F@ $(top_srcdir)/sql/client_settings.h $(srcdir)/client_settings.h
...@@ -74,7 +68,6 @@ mysqlmanager_SOURCES= command.cc command.h mysqlmanager.cc \ ...@@ -74,7 +68,6 @@ mysqlmanager_SOURCES= command.cc command.h mysqlmanager.cc \
mysql_connection.h mysql_connection.cc \ mysql_connection.h mysql_connection.cc \
user_map.h user_map.cc \ user_map.h user_map.cc \
messages.h messages.cc \ messages.h messages.cc \
$(top_srcdir)/sql/sql_string.cc \
commands.h commands.cc \ commands.h commands.cc \
factory.h factory.cc \ factory.h factory.cc \
instance.h instance.cc \ instance.h instance.cc \
......
...@@ -408,7 +408,7 @@ int Stop_instance::execute(struct st_net *net, ulong connection_id) ...@@ -408,7 +408,7 @@ int Stop_instance::execute(struct st_net *net, ulong connection_id)
stop_guard(instance); stop_guard(instance);
if (err_code= instance->stop()) if (err_code= instance->stop())
return err_code; return err_code;
printf("instance was stopped\n");
net_send_ok(net, connection_id); net_send_ok(net, connection_id);
return 0; return 0;
} }
......
...@@ -158,8 +158,8 @@ int Instance_map::flush_instances() ...@@ -158,8 +158,8 @@ int Instance_map::flush_instances()
hash_free(&hash); hash_free(&hash);
hash_init(&hash, default_charset_info, START_HASH_SIZE, 0, 0, hash_init(&hash, default_charset_info, START_HASH_SIZE, 0, 0,
get_instance_key, delete_instance, 0); get_instance_key, delete_instance, 0);
rc= load();
pthread_mutex_unlock(&LOCK_instance_map); pthread_mutex_unlock(&LOCK_instance_map);
rc= load();
return rc; return rc;
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <mysql.h> #include <mysql.h>
#include <violite.h> #include <violite.h>
#include <sys/un.h> #include <sys/un.h>
#include <sys/stat.h>
#include "thread_registry.h" #include "thread_registry.h"
#include "options.h" #include "options.h"
......
...@@ -90,6 +90,7 @@ void manager(const Options &options) ...@@ -90,6 +90,7 @@ void manager(const Options &options)
sigemptyset(&mask); sigemptyset(&mask);
sigaddset(&mask, SIGINT); sigaddset(&mask, SIGINT);
sigaddset(&mask, SIGTERM); sigaddset(&mask, SIGTERM);
sigaddset(&mask, SIGPIPE);
sigaddset(&mask, SIGHUP); sigaddset(&mask, SIGHUP);
/* /*
We want this signal to be blocked in all theads but the signal We want this signal to be blocked in all theads but the signal
...@@ -159,6 +160,8 @@ void manager(const Options &options) ...@@ -159,6 +160,8 @@ void manager(const Options &options)
*/ */
guardian_thread.start(); guardian_thread.start();
signal(SIGPIPE, SIG_IGN);
while (!shutdown_complete) while (!shutdown_complete)
{ {
sigwait(&mask, &signo); sigwait(&mask, &signo);
......
...@@ -179,7 +179,7 @@ static volatile sig_atomic_t is_terminated= 0; ...@@ -179,7 +179,7 @@ static volatile sig_atomic_t is_terminated= 0;
void terminate(int signo) void terminate(int signo)
{ {
is_terminated= signo; is_terminated= signo;
} }
......
...@@ -79,7 +79,7 @@ static struct my_option my_long_options[] = ...@@ -79,7 +79,7 @@ static struct my_option my_long_options[] =
(gptr *) &Options::socket_file_name, (gptr *) &Options::socket_file_name, (gptr *) &Options::socket_file_name, (gptr *) &Options::socket_file_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "bind_address", OPT_BIND_ADDRESS, "Bind address to use for connection.", { "bind-address", OPT_BIND_ADDRESS, "Bind address to use for connection.",
(gptr *) &Options::bind_address, (gptr *) &Options::bind_address, (gptr *) &Options::bind_address, (gptr *) &Options::bind_address,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
...@@ -93,24 +93,24 @@ static struct my_option my_long_options[] = ...@@ -93,24 +93,24 @@ static struct my_option my_long_options[] =
(gptr *) &Options::password_file_name, (gptr *) &Options::password_file_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "default_mysqld_path", OPT_MYSQLD_PATH, "Where to look for MySQL" { "default-mysqld-path", OPT_MYSQLD_PATH, "Where to look for MySQL"
" Server binary.", " Server binary.",
(gptr *) &Options::default_mysqld_path, (gptr *) &Options::default_mysqld_path, (gptr *) &Options::default_mysqld_path, (gptr *) &Options::default_mysqld_path,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "default_admin_user", OPT_DEFAULT_ADMIN_USER, "Username to shutdown MySQL" { "default-admin-user", OPT_DEFAULT_ADMIN_USER, "Username to shutdown MySQL"
" instances.", " instances.",
(gptr *) &Options::default_admin_user, (gptr *) &Options::default_admin_user,
(gptr *) &Options::default_admin_user, (gptr *) &Options::default_admin_user,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "default_admin_password", OPT_DEFAULT_ADMIN_PASSWORD, "Password to" { "default-admin-password", OPT_DEFAULT_ADMIN_PASSWORD, "Password to"
"shutdown MySQL instances.", "shutdown MySQL instances.",
(gptr *) &Options::default_admin_password, (gptr *) &Options::default_admin_password,
(gptr *) &Options::default_admin_password, (gptr *) &Options::default_admin_password,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "monitoring_interval", OPT_MONITORING_INTERVAL, "Interval to monitor instances" { "monitoring-interval", OPT_MONITORING_INTERVAL, "Interval to monitor instances"
" in seconds.", " in seconds.",
(gptr *) &Options::monitoring_interval, (gptr *) &Options::monitoring_interval,
(gptr *) &Options::monitoring_interval, (gptr *) &Options::monitoring_interval,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment