Commit ab432d6c authored by unknown's avatar unknown
Browse files

Various fixes (cleanups, valgrind, makefiles, ...)


server-tools/instance-manager/Makefile.am:
  increased default_monitoring interval
server-tools/instance-manager/guardian.cc:
  some fixes for proper shutdown
server-tools/instance-manager/guardian.h:
  removed init() prototype, as it was never used
server-tools/instance-manager/instance.cc:
  cleanup() function removed
server-tools/instance-manager/instance.h:
  cleanup() prototype removed
server-tools/instance-manager/instance_map.cc:
  Instance_map::cleanup() removed, as instances have nothing to clean up
server-tools/instance-manager/instance_map.h:
  Instance_map::cleanup() prototype removed
server-tools/instance-manager/instance_options.cc:
  added print_argv() function for debug purposes
server-tools/instance-manager/instance_options.h:
  declared print_argv()
server-tools/instance-manager/listener.cc:
  some fixed in listener for proper shutdown
server-tools/instance-manager/log.cc:
  cleanup
server-tools/instance-manager/log.h:
  cleanup
server-tools/instance-manager/manager.cc:
  some comments added
server-tools/instance-manager/mysqlmanager.cc:
  we need to free memory in the very end
server-tools/instance-manager/options.cc:
  fixed default options handling (as they were not working properly), added new method to cleanup Options
server-tools/instance-manager/options.h:
  cleanup() declared
server-tools/instance-manager/thread_registry.cc:
  cleanup
server-tools/instance-manager/user_map.cc:
  missing password file is not a critical error anymore, as IM should be able to work as mysqld_safe only
parent 92a52ccc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ liboptions_a_CPPFLAGS= $(CPPFLAGS) \
	-DDEFAULT_MYSQLD_PATH="$(bindir)/mysqld$(EXEEXT)" \
	-DDEFAULT_USER="root" \
	-DDEFAULT_PASSWORD="" \
	-DDEFAULT_MONITORING_INTERVAL="5" \
	-DDEFAULT_MONITORING_INTERVAL="20" \
	-DDEFAULT_PORT="2273" \
	-DPROTOCOL_VERSION=@PROTOCOL_VERSION@

@@ -59,7 +59,7 @@ client_settings.h: Makefile
	rm -f $(srcdir)/client_settings.h
	@LN_CP_F@ $(top_srcdir)/sql/client_settings.h $(srcdir)/client_settings.h

bin_PROGRAMS= mysqlmanager
libexec_PROGRAMS= mysqlmanager

mysqlmanager_SOURCES=	command.cc command.h mysqlmanager.cc \
			manager.h manager.cc log.h log.cc \
+5 −3
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ Guardian_thread::Guardian_thread(Thread_registry &thread_registry_arg,
  pthread_cond_init(&COND_guardian, 0);
  shutdown_guardian= FALSE;
  is_stopped= FALSE;
  thread_registry.register_thread(&thread_info);
  init_alloc_root(&alloc, MEM_ROOT_BLOCK_SIZE, 0);
  guarded_instances= NULL;
  starting_instances= NULL;
@@ -60,7 +59,6 @@ Guardian_thread::~Guardian_thread()
  /* delay guardian destruction to the moment when no one needs it */
  pthread_mutex_lock(&LOCK_guardian);
  free_root(&alloc, MYF(0));
  thread_registry.unregister_thread(&thread_info);
  pthread_mutex_unlock(&LOCK_guardian);
  pthread_mutex_destroy(&LOCK_guardian);
  pthread_cond_destroy(&COND_guardian);
@@ -102,6 +100,8 @@ void Guardian_thread::run()
  LIST *loop;
  struct timespec timeout;

  thread_registry.register_thread(&thread_info);

  my_thread_init();
  pthread_mutex_lock(&LOCK_guardian);

@@ -110,6 +110,7 @@ void Guardian_thread::run()
  {
    int status= 0;
    loop= guarded_instances;

    while (loop != NULL)
    {
      instance= ((GUARD_NODE *) loop->data)->instance;
@@ -167,6 +168,7 @@ void Guardian_thread::run()
    stop_instances();
  is_stopped= TRUE;
  /* now, when the Guardian is stopped we can stop the IM */
  thread_registry.unregister_thread(&thread_info);
  thread_registry.request_shutdown();
  my_thread_end();
}
@@ -181,7 +183,7 @@ int Guardian_thread::start()
  while ((instance= iterator.next()))
  {
    if ((instance->options.nonguarded == NULL))
      if (guard(instance))
      if (add_instance_to_list(instance, &guarded_instances))
        return 1;
  }
  instance_map->unlock();
+0 −1
Original line number Diff line number Diff line
@@ -73,7 +73,6 @@ class Guardian_thread: public Guardian_thread_args
                  uint monitoring_interval_arg);
  ~Guardian_thread();
  void run();
  int init();
  int start();
  void shutdown();
  void request_stop_instances();
+1 −6
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ int Instance::start()
    switch (pid= fork()) {
    case 0:
      execv(options.mysqld_path, options.argv);
      /* exec never returns */
      exit(1);
    case -1:
      return ER_CANNOT_START_INSTANCE;
@@ -69,12 +70,6 @@ int Instance::start()
}


int Instance::cleanup()
{
  return 0;
}


Instance::~Instance()
{
  pthread_mutex_destroy(&LOCK_instance);
+0 −1
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ class Instance
  bool is_running();
  int start();
  int stop();
  int cleanup();

public:
  enum { DEFAULT_SHUTDOWN_DELAY= 35 };
Loading