mariadb/server-tools/instance-manager/manager.h

54 lines
1.8 KiB
C
Raw Normal View History

#ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_MANAGER_H
#define INCLUDES_MYSQL_INSTANCE_MANAGER_MANAGER_H
Intermediate commit - just to make new files visible to bk in the new tree server-tools/instance-manager/Makefile.am: Fixed IM linking to avoid using both mysys and libmysql as the define the same symbols and therefore conflict server-tools/instance-manager/listener.cc: Added ability to listen network ports server-tools/instance-manager/listener.h: Various additions to the Listener_thread_args server-tools/instance-manager/log.cc: merge server-tools/instance-manager/log.h: merge server-tools/instance-manager/manager.cc: Fixes and additions to enable guardian functionality server-tools/instance-manager/manager.h: Changed manager() signature server-tools/instance-manager/mysqlmanager.cc: Various fixes server-tools/instance-manager/options.cc: Added handling of default values for new options in the Options struct. (such as default_user, default_password, monitoring_interval e.t.c) server-tools/instance-manager/options.h: Added new options to the Options struct sql/net_serv.cc: Added MYSQL_INSTANCE_MANAGER defines to enable alarm handling in the IM server-tools/instance-manager/buffer.cc: Simple implementation of variable-length buffer server-tools/instance-manager/command.cc: Abstract command. All commands are derived from Command class server-tools/instance-manager/commands.h: Interfaces for all commands we have server-tools/instance-manager/factory.cc: Commands factory. This class hides command instantiation. The idea is to handle various protocols this way. (different commands for different protocols server-tools/instance-manager/guardian.cc: Guardian thread implementation (monitor and restart instances in case of a failure server-tools/instance-manager/guardian.h: Guardian_thread and Guardian_thread_args class interface. The Guardian_thread is responsible for monitoring and restarting instances server-tools/instance-manager/instance.cc: Instance class contains methods and data to manage a single instance server-tools/instance-manager/instance.h: This file contains class an instance class interface. The class is responsible for starting/stopping an instance server-tools/instance-manager/instance_map.cc: The instance repository. This class is also responsible for initialization of Instance class objects. server-tools/instance-manager/instance_options.cc: The Instance_options class contains all methods to get and handle options of an instance server-tools/instance-manager/mysql_connection.cc: The class responsible for handling MySQL client/server protocol connections server-tools/instance-manager/mysql_manager_error.h: The list of Instance Manger-specific errors server-tools/instance-manager/parse.cc: Simple query parser server-tools/instance-manager/parse.h: Parser interface server-tools/instance-manager/protocol.cc: Here implemented functions used to handle mysql client/server protocol server-tools/instance-manager/protocol.h: Interface for MySQL client/server protocol server-tools/instance-manager/thread_registry.cc: Thread registry stores information about every thread. It's main function is to provide graceful shutdown for all threads. server-tools/instance-manager/user_map.h: User map contains hash with user names and passwords
2004-10-23 09:32:52 +02:00
/* Copyright (C) 2003 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
Cleanup: manually port the polishing parts from Alik's changeset for BUG#22306: STOP INSTANCE can not be applied for instances in Crashed, Failed and Abandoned mysql-test/t/im_options.imtest: Update test for new framework. server-tools/instance-manager/IMService.cpp: Use Manager class instead of manager(). Reformat comments. server-tools/instance-manager/Makefile.am: Treat warnings as errors. server-tools/instance-manager/command.cc: Store references to Guardian_thread and Instance_map in Command attributes. server-tools/instance-manager/command.h: Store references to Guardian_thread and Instance_map in Command attributes. server-tools/instance-manager/commands.cc: Remove Instance_map argument from command constructors. server-tools/instance-manager/commands.h: Remove Instance_map argument from command constructors. server-tools/instance-manager/guardian.cc: Rename: Guardian_thread -> Guardian server-tools/instance-manager/guardian.h: Rename: Guardian_thread -> Guardian server-tools/instance-manager/instance_map.cc: Rename: Guardian_thread -> Guardian. server-tools/instance-manager/instance_map.h: Rename: Guardian_thread -> Guardian. server-tools/instance-manager/manager.cc: Use Manager class instead of manager() function. server-tools/instance-manager/manager.h: Transfer manager() function into Manager class (singleton). server-tools/instance-manager/mysql_connection.cc: Polishing. server-tools/instance-manager/mysqlmanager.cc: Use Manager class instead of manager() function. server-tools/instance-manager/parse.cc: Rename: Guardian_thread -> Guardian server-tools/instance-manager/parse.h: Rename: Guardian_thread -> Guardian server-tools/instance-manager/priv.cc: Move create_pid_file() out of manager.cc. server-tools/instance-manager/priv.h: Move create_pid_file() out of manager.cc. server-tools/instance-manager/thread_registry.h: Prevent copying. server-tools/instance-manager/user_map.cc: Fix alignment.
2006-11-16 21:36:20 +01:00
#if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE)
#pragma interface
#endif
Port cleanups, trivial refactoring and code rearrangements from Alik's patch for BUG#22306: STOP INSTANCE can not be applied for instances in Crashed, Failed and Abandoned" to ease review process. Evaluate global variable linuxthreads before starting threads to avoid a race. server-tools/instance-manager/buffer.cc: Fix spelling. server-tools/instance-manager/command.h: Fix spelling. server-tools/instance-manager/commands.cc: Fix spelling. server-tools/instance-manager/commands.h: Fix spelling, tidy up. server-tools/instance-manager/guardian.cc: Cleanup logging, options.get_shutdown_delay() is a method, tidy up. server-tools/instance-manager/instance.cc: Rearrange methods to be the same as in Alik's patch, fix spelling errors, clean up logging texts, port comments from Alik's patch, implement some basic renames from his patch. No real changes. server-tools/instance-manager/instance.h: Tidy up, renames. server-tools/instance-manager/instance_map.cc: Fix spellings, port some refactoring from Alik's patch. server-tools/instance-manager/instance_map.h: Cleanup. server-tools/instance-manager/instance_options.cc: Cleanup. Implement Instance_options::get_shutdown_delay() and Instance_options::get_mysqld_port(). server-tools/instance-manager/instance_options.h: Cleanup. server-tools/instance-manager/listener.cc: Cleanup. server-tools/instance-manager/log.cc: Fix spelling. server-tools/instance-manager/manager.cc: Cleanup. server-tools/instance-manager/manager.h: Add getters for Manager members. server-tools/instance-manager/mysqlmanager.cc: Evaluate linuxthreads before starting threads to avoid a race. server-tools/instance-manager/parse_output.cc: Fix spelling. server-tools/instance-manager/priv.cc: Cleanup. server-tools/instance-manager/priv.h: Cleanup. server-tools/instance-manager/user_management_commands.cc: Fix spelling. server-tools/instance-manager/user_management_commands.h: Fix spelling. server-tools/instance-manager/user_map.cc: Fix spelling.
2006-11-17 23:34:44 +01:00
#include <my_global.h>
Cleanup: manually port the polishing parts from Alik's changeset for BUG#22306: STOP INSTANCE can not be applied for instances in Crashed, Failed and Abandoned mysql-test/t/im_options.imtest: Update test for new framework. server-tools/instance-manager/IMService.cpp: Use Manager class instead of manager(). Reformat comments. server-tools/instance-manager/Makefile.am: Treat warnings as errors. server-tools/instance-manager/command.cc: Store references to Guardian_thread and Instance_map in Command attributes. server-tools/instance-manager/command.h: Store references to Guardian_thread and Instance_map in Command attributes. server-tools/instance-manager/commands.cc: Remove Instance_map argument from command constructors. server-tools/instance-manager/commands.h: Remove Instance_map argument from command constructors. server-tools/instance-manager/guardian.cc: Rename: Guardian_thread -> Guardian server-tools/instance-manager/guardian.h: Rename: Guardian_thread -> Guardian server-tools/instance-manager/instance_map.cc: Rename: Guardian_thread -> Guardian. server-tools/instance-manager/instance_map.h: Rename: Guardian_thread -> Guardian. server-tools/instance-manager/manager.cc: Use Manager class instead of manager() function. server-tools/instance-manager/manager.h: Transfer manager() function into Manager class (singleton). server-tools/instance-manager/mysql_connection.cc: Polishing. server-tools/instance-manager/mysqlmanager.cc: Use Manager class instead of manager() function. server-tools/instance-manager/parse.cc: Rename: Guardian_thread -> Guardian server-tools/instance-manager/parse.h: Rename: Guardian_thread -> Guardian server-tools/instance-manager/priv.cc: Move create_pid_file() out of manager.cc. server-tools/instance-manager/priv.h: Move create_pid_file() out of manager.cc. server-tools/instance-manager/thread_registry.h: Prevent copying. server-tools/instance-manager/user_map.cc: Fix alignment.
2006-11-16 21:36:20 +01:00
class Guardian;
class Instance_map;
Port cleanups, trivial refactoring and code rearrangements from Alik's patch for BUG#22306: STOP INSTANCE can not be applied for instances in Crashed, Failed and Abandoned" to ease review process. Evaluate global variable linuxthreads before starting threads to avoid a race. server-tools/instance-manager/buffer.cc: Fix spelling. server-tools/instance-manager/command.h: Fix spelling. server-tools/instance-manager/commands.cc: Fix spelling. server-tools/instance-manager/commands.h: Fix spelling, tidy up. server-tools/instance-manager/guardian.cc: Cleanup logging, options.get_shutdown_delay() is a method, tidy up. server-tools/instance-manager/instance.cc: Rearrange methods to be the same as in Alik's patch, fix spelling errors, clean up logging texts, port comments from Alik's patch, implement some basic renames from his patch. No real changes. server-tools/instance-manager/instance.h: Tidy up, renames. server-tools/instance-manager/instance_map.cc: Fix spellings, port some refactoring from Alik's patch. server-tools/instance-manager/instance_map.h: Cleanup. server-tools/instance-manager/instance_options.cc: Cleanup. Implement Instance_options::get_shutdown_delay() and Instance_options::get_mysqld_port(). server-tools/instance-manager/instance_options.h: Cleanup. server-tools/instance-manager/listener.cc: Cleanup. server-tools/instance-manager/log.cc: Fix spelling. server-tools/instance-manager/manager.cc: Cleanup. server-tools/instance-manager/manager.h: Add getters for Manager members. server-tools/instance-manager/mysqlmanager.cc: Evaluate linuxthreads before starting threads to avoid a race. server-tools/instance-manager/parse_output.cc: Fix spelling. server-tools/instance-manager/priv.cc: Cleanup. server-tools/instance-manager/priv.h: Cleanup. server-tools/instance-manager/user_management_commands.cc: Fix spelling. server-tools/instance-manager/user_management_commands.h: Fix spelling. server-tools/instance-manager/user_map.cc: Fix spelling.
2006-11-17 23:34:44 +01:00
class Thread_registry;
class User_map;
Cleanup: manually port the polishing parts from Alik's changeset for BUG#22306: STOP INSTANCE can not be applied for instances in Crashed, Failed and Abandoned mysql-test/t/im_options.imtest: Update test for new framework. server-tools/instance-manager/IMService.cpp: Use Manager class instead of manager(). Reformat comments. server-tools/instance-manager/Makefile.am: Treat warnings as errors. server-tools/instance-manager/command.cc: Store references to Guardian_thread and Instance_map in Command attributes. server-tools/instance-manager/command.h: Store references to Guardian_thread and Instance_map in Command attributes. server-tools/instance-manager/commands.cc: Remove Instance_map argument from command constructors. server-tools/instance-manager/commands.h: Remove Instance_map argument from command constructors. server-tools/instance-manager/guardian.cc: Rename: Guardian_thread -> Guardian server-tools/instance-manager/guardian.h: Rename: Guardian_thread -> Guardian server-tools/instance-manager/instance_map.cc: Rename: Guardian_thread -> Guardian. server-tools/instance-manager/instance_map.h: Rename: Guardian_thread -> Guardian. server-tools/instance-manager/manager.cc: Use Manager class instead of manager() function. server-tools/instance-manager/manager.h: Transfer manager() function into Manager class (singleton). server-tools/instance-manager/mysql_connection.cc: Polishing. server-tools/instance-manager/mysqlmanager.cc: Use Manager class instead of manager() function. server-tools/instance-manager/parse.cc: Rename: Guardian_thread -> Guardian server-tools/instance-manager/parse.h: Rename: Guardian_thread -> Guardian server-tools/instance-manager/priv.cc: Move create_pid_file() out of manager.cc. server-tools/instance-manager/priv.h: Move create_pid_file() out of manager.cc. server-tools/instance-manager/thread_registry.h: Prevent copying. server-tools/instance-manager/user_map.cc: Fix alignment.
2006-11-16 21:36:20 +01:00
class Manager
{
public:
static int main();
/**
These methods return a non-zero value only for the duration
of main().
*/
static Instance_map *get_instance_map() { return p_instance_map; }
static Guardian *get_guardian() { return p_guardian; }
Port cleanups, trivial refactoring and code rearrangements from Alik's patch for BUG#22306: STOP INSTANCE can not be applied for instances in Crashed, Failed and Abandoned" to ease review process. Evaluate global variable linuxthreads before starting threads to avoid a race. server-tools/instance-manager/buffer.cc: Fix spelling. server-tools/instance-manager/command.h: Fix spelling. server-tools/instance-manager/commands.cc: Fix spelling. server-tools/instance-manager/commands.h: Fix spelling, tidy up. server-tools/instance-manager/guardian.cc: Cleanup logging, options.get_shutdown_delay() is a method, tidy up. server-tools/instance-manager/instance.cc: Rearrange methods to be the same as in Alik's patch, fix spelling errors, clean up logging texts, port comments from Alik's patch, implement some basic renames from his patch. No real changes. server-tools/instance-manager/instance.h: Tidy up, renames. server-tools/instance-manager/instance_map.cc: Fix spellings, port some refactoring from Alik's patch. server-tools/instance-manager/instance_map.h: Cleanup. server-tools/instance-manager/instance_options.cc: Cleanup. Implement Instance_options::get_shutdown_delay() and Instance_options::get_mysqld_port(). server-tools/instance-manager/instance_options.h: Cleanup. server-tools/instance-manager/listener.cc: Cleanup. server-tools/instance-manager/log.cc: Fix spelling. server-tools/instance-manager/manager.cc: Cleanup. server-tools/instance-manager/manager.h: Add getters for Manager members. server-tools/instance-manager/mysqlmanager.cc: Evaluate linuxthreads before starting threads to avoid a race. server-tools/instance-manager/parse_output.cc: Fix spelling. server-tools/instance-manager/priv.cc: Cleanup. server-tools/instance-manager/priv.h: Cleanup. server-tools/instance-manager/user_management_commands.cc: Fix spelling. server-tools/instance-manager/user_management_commands.h: Fix spelling. server-tools/instance-manager/user_map.cc: Fix spelling.
2006-11-17 23:34:44 +01:00
static Thread_registry *get_thread_registry() { return p_thread_registry; }
static User_map *get_user_map() { return p_user_map; }
static pid_t get_manager_pid() { return manager_pid; }
Cleanup: manually port the polishing parts from Alik's changeset for BUG#22306: STOP INSTANCE can not be applied for instances in Crashed, Failed and Abandoned mysql-test/t/im_options.imtest: Update test for new framework. server-tools/instance-manager/IMService.cpp: Use Manager class instead of manager(). Reformat comments. server-tools/instance-manager/Makefile.am: Treat warnings as errors. server-tools/instance-manager/command.cc: Store references to Guardian_thread and Instance_map in Command attributes. server-tools/instance-manager/command.h: Store references to Guardian_thread and Instance_map in Command attributes. server-tools/instance-manager/commands.cc: Remove Instance_map argument from command constructors. server-tools/instance-manager/commands.h: Remove Instance_map argument from command constructors. server-tools/instance-manager/guardian.cc: Rename: Guardian_thread -> Guardian server-tools/instance-manager/guardian.h: Rename: Guardian_thread -> Guardian server-tools/instance-manager/instance_map.cc: Rename: Guardian_thread -> Guardian. server-tools/instance-manager/instance_map.h: Rename: Guardian_thread -> Guardian. server-tools/instance-manager/manager.cc: Use Manager class instead of manager() function. server-tools/instance-manager/manager.h: Transfer manager() function into Manager class (singleton). server-tools/instance-manager/mysql_connection.cc: Polishing. server-tools/instance-manager/mysqlmanager.cc: Use Manager class instead of manager() function. server-tools/instance-manager/parse.cc: Rename: Guardian_thread -> Guardian server-tools/instance-manager/parse.h: Rename: Guardian_thread -> Guardian server-tools/instance-manager/priv.cc: Move create_pid_file() out of manager.cc. server-tools/instance-manager/priv.h: Move create_pid_file() out of manager.cc. server-tools/instance-manager/thread_registry.h: Prevent copying. server-tools/instance-manager/user_map.cc: Fix alignment.
2006-11-16 21:36:20 +01:00
private:
Port cleanups, trivial refactoring and code rearrangements from Alik's patch for BUG#22306: STOP INSTANCE can not be applied for instances in Crashed, Failed and Abandoned" to ease review process. Evaluate global variable linuxthreads before starting threads to avoid a race. server-tools/instance-manager/buffer.cc: Fix spelling. server-tools/instance-manager/command.h: Fix spelling. server-tools/instance-manager/commands.cc: Fix spelling. server-tools/instance-manager/commands.h: Fix spelling, tidy up. server-tools/instance-manager/guardian.cc: Cleanup logging, options.get_shutdown_delay() is a method, tidy up. server-tools/instance-manager/instance.cc: Rearrange methods to be the same as in Alik's patch, fix spelling errors, clean up logging texts, port comments from Alik's patch, implement some basic renames from his patch. No real changes. server-tools/instance-manager/instance.h: Tidy up, renames. server-tools/instance-manager/instance_map.cc: Fix spellings, port some refactoring from Alik's patch. server-tools/instance-manager/instance_map.h: Cleanup. server-tools/instance-manager/instance_options.cc: Cleanup. Implement Instance_options::get_shutdown_delay() and Instance_options::get_mysqld_port(). server-tools/instance-manager/instance_options.h: Cleanup. server-tools/instance-manager/listener.cc: Cleanup. server-tools/instance-manager/log.cc: Fix spelling. server-tools/instance-manager/manager.cc: Cleanup. server-tools/instance-manager/manager.h: Add getters for Manager members. server-tools/instance-manager/mysqlmanager.cc: Evaluate linuxthreads before starting threads to avoid a race. server-tools/instance-manager/parse_output.cc: Fix spelling. server-tools/instance-manager/priv.cc: Cleanup. server-tools/instance-manager/priv.h: Cleanup. server-tools/instance-manager/user_management_commands.cc: Fix spelling. server-tools/instance-manager/user_management_commands.h: Fix spelling. server-tools/instance-manager/user_map.cc: Fix spelling.
2006-11-17 23:34:44 +01:00
static void stop_all_threads();
Cleanup: manually port the polishing parts from Alik's changeset for BUG#22306: STOP INSTANCE can not be applied for instances in Crashed, Failed and Abandoned mysql-test/t/im_options.imtest: Update test for new framework. server-tools/instance-manager/IMService.cpp: Use Manager class instead of manager(). Reformat comments. server-tools/instance-manager/Makefile.am: Treat warnings as errors. server-tools/instance-manager/command.cc: Store references to Guardian_thread and Instance_map in Command attributes. server-tools/instance-manager/command.h: Store references to Guardian_thread and Instance_map in Command attributes. server-tools/instance-manager/commands.cc: Remove Instance_map argument from command constructors. server-tools/instance-manager/commands.h: Remove Instance_map argument from command constructors. server-tools/instance-manager/guardian.cc: Rename: Guardian_thread -> Guardian server-tools/instance-manager/guardian.h: Rename: Guardian_thread -> Guardian server-tools/instance-manager/instance_map.cc: Rename: Guardian_thread -> Guardian. server-tools/instance-manager/instance_map.h: Rename: Guardian_thread -> Guardian. server-tools/instance-manager/manager.cc: Use Manager class instead of manager() function. server-tools/instance-manager/manager.h: Transfer manager() function into Manager class (singleton). server-tools/instance-manager/mysql_connection.cc: Polishing. server-tools/instance-manager/mysqlmanager.cc: Use Manager class instead of manager() function. server-tools/instance-manager/parse.cc: Rename: Guardian_thread -> Guardian server-tools/instance-manager/parse.h: Rename: Guardian_thread -> Guardian server-tools/instance-manager/priv.cc: Move create_pid_file() out of manager.cc. server-tools/instance-manager/priv.h: Move create_pid_file() out of manager.cc. server-tools/instance-manager/thread_registry.h: Prevent copying. server-tools/instance-manager/user_map.cc: Fix alignment.
2006-11-16 21:36:20 +01:00
private:
Port cleanups, trivial refactoring and code rearrangements from Alik's patch for BUG#22306: STOP INSTANCE can not be applied for instances in Crashed, Failed and Abandoned" to ease review process. Evaluate global variable linuxthreads before starting threads to avoid a race. server-tools/instance-manager/buffer.cc: Fix spelling. server-tools/instance-manager/command.h: Fix spelling. server-tools/instance-manager/commands.cc: Fix spelling. server-tools/instance-manager/commands.h: Fix spelling, tidy up. server-tools/instance-manager/guardian.cc: Cleanup logging, options.get_shutdown_delay() is a method, tidy up. server-tools/instance-manager/instance.cc: Rearrange methods to be the same as in Alik's patch, fix spelling errors, clean up logging texts, port comments from Alik's patch, implement some basic renames from his patch. No real changes. server-tools/instance-manager/instance.h: Tidy up, renames. server-tools/instance-manager/instance_map.cc: Fix spellings, port some refactoring from Alik's patch. server-tools/instance-manager/instance_map.h: Cleanup. server-tools/instance-manager/instance_options.cc: Cleanup. Implement Instance_options::get_shutdown_delay() and Instance_options::get_mysqld_port(). server-tools/instance-manager/instance_options.h: Cleanup. server-tools/instance-manager/listener.cc: Cleanup. server-tools/instance-manager/log.cc: Fix spelling. server-tools/instance-manager/manager.cc: Cleanup. server-tools/instance-manager/manager.h: Add getters for Manager members. server-tools/instance-manager/mysqlmanager.cc: Evaluate linuxthreads before starting threads to avoid a race. server-tools/instance-manager/parse_output.cc: Fix spelling. server-tools/instance-manager/priv.cc: Cleanup. server-tools/instance-manager/priv.h: Cleanup. server-tools/instance-manager/user_management_commands.cc: Fix spelling. server-tools/instance-manager/user_management_commands.h: Fix spelling. server-tools/instance-manager/user_map.cc: Fix spelling.
2006-11-17 23:34:44 +01:00
static pid_t manager_pid;
Cleanup: manually port the polishing parts from Alik's changeset for BUG#22306: STOP INSTANCE can not be applied for instances in Crashed, Failed and Abandoned mysql-test/t/im_options.imtest: Update test for new framework. server-tools/instance-manager/IMService.cpp: Use Manager class instead of manager(). Reformat comments. server-tools/instance-manager/Makefile.am: Treat warnings as errors. server-tools/instance-manager/command.cc: Store references to Guardian_thread and Instance_map in Command attributes. server-tools/instance-manager/command.h: Store references to Guardian_thread and Instance_map in Command attributes. server-tools/instance-manager/commands.cc: Remove Instance_map argument from command constructors. server-tools/instance-manager/commands.h: Remove Instance_map argument from command constructors. server-tools/instance-manager/guardian.cc: Rename: Guardian_thread -> Guardian server-tools/instance-manager/guardian.h: Rename: Guardian_thread -> Guardian server-tools/instance-manager/instance_map.cc: Rename: Guardian_thread -> Guardian. server-tools/instance-manager/instance_map.h: Rename: Guardian_thread -> Guardian. server-tools/instance-manager/manager.cc: Use Manager class instead of manager() function. server-tools/instance-manager/manager.h: Transfer manager() function into Manager class (singleton). server-tools/instance-manager/mysql_connection.cc: Polishing. server-tools/instance-manager/mysqlmanager.cc: Use Manager class instead of manager() function. server-tools/instance-manager/parse.cc: Rename: Guardian_thread -> Guardian server-tools/instance-manager/parse.h: Rename: Guardian_thread -> Guardian server-tools/instance-manager/priv.cc: Move create_pid_file() out of manager.cc. server-tools/instance-manager/priv.h: Move create_pid_file() out of manager.cc. server-tools/instance-manager/thread_registry.h: Prevent copying. server-tools/instance-manager/user_map.cc: Fix alignment.
2006-11-16 21:36:20 +01:00
static Guardian *p_guardian;
static Instance_map *p_instance_map;
Port cleanups, trivial refactoring and code rearrangements from Alik's patch for BUG#22306: STOP INSTANCE can not be applied for instances in Crashed, Failed and Abandoned" to ease review process. Evaluate global variable linuxthreads before starting threads to avoid a race. server-tools/instance-manager/buffer.cc: Fix spelling. server-tools/instance-manager/command.h: Fix spelling. server-tools/instance-manager/commands.cc: Fix spelling. server-tools/instance-manager/commands.h: Fix spelling, tidy up. server-tools/instance-manager/guardian.cc: Cleanup logging, options.get_shutdown_delay() is a method, tidy up. server-tools/instance-manager/instance.cc: Rearrange methods to be the same as in Alik's patch, fix spelling errors, clean up logging texts, port comments from Alik's patch, implement some basic renames from his patch. No real changes. server-tools/instance-manager/instance.h: Tidy up, renames. server-tools/instance-manager/instance_map.cc: Fix spellings, port some refactoring from Alik's patch. server-tools/instance-manager/instance_map.h: Cleanup. server-tools/instance-manager/instance_options.cc: Cleanup. Implement Instance_options::get_shutdown_delay() and Instance_options::get_mysqld_port(). server-tools/instance-manager/instance_options.h: Cleanup. server-tools/instance-manager/listener.cc: Cleanup. server-tools/instance-manager/log.cc: Fix spelling. server-tools/instance-manager/manager.cc: Cleanup. server-tools/instance-manager/manager.h: Add getters for Manager members. server-tools/instance-manager/mysqlmanager.cc: Evaluate linuxthreads before starting threads to avoid a race. server-tools/instance-manager/parse_output.cc: Fix spelling. server-tools/instance-manager/priv.cc: Cleanup. server-tools/instance-manager/priv.h: Cleanup. server-tools/instance-manager/user_management_commands.cc: Fix spelling. server-tools/instance-manager/user_management_commands.h: Fix spelling. server-tools/instance-manager/user_map.cc: Fix spelling.
2006-11-17 23:34:44 +01:00
static Thread_registry *p_thread_registry;
static User_map *p_user_map;
Cleanup: manually port the polishing parts from Alik's changeset for BUG#22306: STOP INSTANCE can not be applied for instances in Crashed, Failed and Abandoned mysql-test/t/im_options.imtest: Update test for new framework. server-tools/instance-manager/IMService.cpp: Use Manager class instead of manager(). Reformat comments. server-tools/instance-manager/Makefile.am: Treat warnings as errors. server-tools/instance-manager/command.cc: Store references to Guardian_thread and Instance_map in Command attributes. server-tools/instance-manager/command.h: Store references to Guardian_thread and Instance_map in Command attributes. server-tools/instance-manager/commands.cc: Remove Instance_map argument from command constructors. server-tools/instance-manager/commands.h: Remove Instance_map argument from command constructors. server-tools/instance-manager/guardian.cc: Rename: Guardian_thread -> Guardian server-tools/instance-manager/guardian.h: Rename: Guardian_thread -> Guardian server-tools/instance-manager/instance_map.cc: Rename: Guardian_thread -> Guardian. server-tools/instance-manager/instance_map.h: Rename: Guardian_thread -> Guardian. server-tools/instance-manager/manager.cc: Use Manager class instead of manager() function. server-tools/instance-manager/manager.h: Transfer manager() function into Manager class (singleton). server-tools/instance-manager/mysql_connection.cc: Polishing. server-tools/instance-manager/mysqlmanager.cc: Use Manager class instead of manager() function. server-tools/instance-manager/parse.cc: Rename: Guardian_thread -> Guardian server-tools/instance-manager/parse.h: Rename: Guardian_thread -> Guardian server-tools/instance-manager/priv.cc: Move create_pid_file() out of manager.cc. server-tools/instance-manager/priv.h: Move create_pid_file() out of manager.cc. server-tools/instance-manager/thread_registry.h: Prevent copying. server-tools/instance-manager/user_map.cc: Fix alignment.
2006-11-16 21:36:20 +01:00
};
Partial fix for BUG#14106: IM: im_life_cycle and im_utils tests fail on FreeBSD. The patch contains of the following: - make Instance Manager, running in the daemon mode, dump the pid of angel-process in the special file; - default value of angel-pid-file-name is 'mysqlmanager.angel.pid'; - if ordinary (IM) pid-file-name is specified in the configuration, angel-pid-file-name is updated according to the following rule: extension of the basename of pid-file-name is replaced by '.angel.pid. For example: - pid-file-name: /tmp/im.pid => angel-pid-file-name: /tmp/im.angel.pid - pid-file-name: /tmp/im.txt => angel-pid-file-name: /tmp/im.angel.pid - pid-file-name: /tmp/5.0/im => angel-pid-file-name: /tmp/5.0/im.angel.pid - add support for configuration option to customize angel pid file name; - fix test suite to use angel pid to kill Instance Manager by all means if something went wrong. Background ---------- The problem is that on some OSes (FreeBSD for one) Instance Manager does not get SIGTERM, so can not shutdown gracefully. Test suite wasn't able to cope with it, so this leads to the mess in test results. The problem should be split into two: - fix signal handling; - fix test suite. This patch fixes test suite so that it will be able to kill uncooperative Instance Manager. In order to achieve this, test suite needs to know PID of IM Angel process. mysql-test/lib/mtr_process.pl: Added a function to send a signal to a process. mysql-test/mysql-test-run.pl: Changed procedure of stopping Instance Manager. 1. Try to stop IM normally (by sending SIGTERM); 2. If one of IM-related processes is still alive, kill them all by SIGKILL and complain in the log. server-tools/instance-manager/manager.cc: Made create_pid_file() available for the whole project. server-tools/instance-manager/manager.h: Made create_pid_file() available for the whole project. server-tools/instance-manager/mysqlmanager.cc: Dump PID of angel process into file. server-tools/instance-manager/options.cc: Added an option to allow to customize angel pid file name. server-tools/instance-manager/options.h: Added an option to allow to customize angel pid file name.
2006-05-06 11:57:56 +02:00
#endif // INCLUDES_MYSQL_INSTANCE_MANAGER_MANAGER_H