Commit c95482d4 authored by unknown's avatar unknown

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.
parent 08df0556
...@@ -27,7 +27,7 @@ const uint Buffer::MAX_BUFFER_SIZE= 16777216; ...@@ -27,7 +27,7 @@ const uint Buffer::MAX_BUFFER_SIZE= 16777216;
/* /*
Puts the given string to the buffer. Puts the given string to the buffer.
SYNOPSYS SYNOPSIS
append() append()
position start position in the buffer position start position in the buffer
string string to be put in the buffer string string to be put in the buffer
...@@ -59,7 +59,7 @@ int Buffer::append(uint position, const char *string, uint len_arg) ...@@ -59,7 +59,7 @@ int Buffer::append(uint position, const char *string, uint len_arg)
Checks whether the current buffer size is ok to put a string of the length Checks whether the current buffer size is ok to put a string of the length
"len_arg" starting from "position" and reallocs it if no. "len_arg" starting from "position" and reallocs it if no.
SYNOPSYS SYNOPSIS
reserve() reserve()
position the number starting byte on the buffer to store a buffer position the number starting byte on the buffer to store a buffer
len_arg the length of the string. len_arg the length of the string.
......
...@@ -43,7 +43,7 @@ class Command ...@@ -43,7 +43,7 @@ class Command
/* /*
This operation incapsulates behaviour of the command. This operation incapsulates behaviour of the command.
SYNOPSYS SYNOPSIS
net The network connection to the client. net The network connection to the client.
connection_id Client connection ID connection_id Client connection ID
......
...@@ -49,7 +49,7 @@ static const int modify_defaults_to_im_error[]= { 0, ER_OUT_OF_RESOURCES, ...@@ -49,7 +49,7 @@ static const int modify_defaults_to_im_error[]= { 0, ER_OUT_OF_RESOURCES,
/* /*
Add a string to a buffer. Add a string to a buffer.
SYNOPSYS SYNOPSIS
put_to_buff() put_to_buff()
buff buffer to add the string buff buffer to add the string
str string to add str string to add
...@@ -590,7 +590,7 @@ Create_instance::Create_instance(const LEX_STRING *instance_name_arg) ...@@ -590,7 +590,7 @@ Create_instance::Create_instance(const LEX_STRING *instance_name_arg)
/* /*
This operation initializes Create_instance object. This operation initializes Create_instance object.
SYNOPSYS SYNOPSIS
text [IN/OUT] a pointer to the text containing instance options. text [IN/OUT] a pointer to the text containing instance options.
RETURN RETURN
...@@ -607,7 +607,7 @@ bool Create_instance::init(const char **text) ...@@ -607,7 +607,7 @@ bool Create_instance::init(const char **text)
/* /*
This operation parses CREATE INSTANCE options. This operation parses CREATE INSTANCE options.
SYNOPSYS SYNOPSIS
text [IN/OUT] a pointer to the text containing instance options. text [IN/OUT] a pointer to the text containing instance options.
RETURN RETURN
...@@ -1255,7 +1255,7 @@ bool Abstract_option_cmd::init(const char **text) ...@@ -1255,7 +1255,7 @@ bool Abstract_option_cmd::init(const char **text)
Correct the option file. The "skip" option is used to remove the found Correct the option file. The "skip" option is used to remove the found
option. option.
SYNOPSYS SYNOPSIS
Abstract_option_cmd::correct_file() Abstract_option_cmd::correct_file()
skip Skip the option, being searched while writing the result file. skip Skip the option, being searched while writing the result file.
That is, to delete it. That is, to delete it.
...@@ -1395,7 +1395,7 @@ int Abstract_option_cmd::execute_impl(st_net *net, ulong connection_id) ...@@ -1395,7 +1395,7 @@ int Abstract_option_cmd::execute_impl(st_net *net, ulong connection_id)
/* /*
This operation parses SET options. This operation parses SET options.
SYNOPSYS SYNOPSIS
text [IN/OUT] a pointer to the text containing options. text [IN/OUT] a pointer to the text containing options.
RETURN RETURN
...@@ -1569,7 +1569,7 @@ int Set_option::process_option(Instance *instance, Named_value *option) ...@@ -1569,7 +1569,7 @@ int Set_option::process_option(Instance *instance, Named_value *option)
/* /*
This operation parses UNSET options. This operation parses UNSET options.
SYNOPSYS SYNOPSIS
text [IN/OUT] a pointer to the text containing options. text [IN/OUT] a pointer to the text containing options.
RETURN RETURN
......
...@@ -32,15 +32,11 @@ ...@@ -32,15 +32,11 @@
/* /*
Print all instances of this instance manager. Print all instances of this instance manager.
Grammar: SHOW ISTANCES Grammar: SHOW INSTANCES
*/ */
class Show_instances : public Command class Show_instances: public Command
{ {
public:
Show_instances()
{ }
public: public:
int execute(st_net *net, ulong connection_id); int execute(st_net *net, ulong connection_id);
...@@ -57,10 +53,6 @@ class Show_instances : public Command ...@@ -57,10 +53,6 @@ class Show_instances : public Command
class Flush_instances : public Command class Flush_instances : public Command
{ {
public:
Flush_instances()
{ }
public: public:
int execute(st_net *net, ulong connection_id); int execute(st_net *net, ulong connection_id);
}; };
...@@ -103,7 +95,7 @@ class Abstract_instance_cmd : public Command ...@@ -103,7 +95,7 @@ class Abstract_instance_cmd : public Command
/* /*
Print status of an instance. Print status of an instance.
Grammar: SHOW ISTANCE STATUS <instance_name> Grammar: SHOW INSTANCE STATUS <instance_name>
*/ */
class Show_instance_status : public Abstract_instance_cmd class Show_instance_status : public Abstract_instance_cmd
...@@ -319,10 +311,6 @@ class Abstract_option_cmd : public Command ...@@ -319,10 +311,6 @@ class Abstract_option_cmd : public Command
class Set_option : public Abstract_option_cmd class Set_option : public Abstract_option_cmd
{ {
public:
Set_option()
{ }
protected: protected:
virtual bool parse_args(const char **text); virtual bool parse_args(const char **text);
virtual int process_option(Instance *instance, Named_value *option); virtual int process_option(Instance *instance, Named_value *option);
...@@ -336,10 +324,6 @@ class Set_option : public Abstract_option_cmd ...@@ -336,10 +324,6 @@ class Set_option : public Abstract_option_cmd
class Unset_option: public Abstract_option_cmd class Unset_option: public Abstract_option_cmd
{ {
public:
Unset_option()
{ }
protected: protected:
virtual bool parse_args(const char **text); virtual bool parse_args(const char **text);
virtual int process_option(Instance *instance, Named_value *option); virtual int process_option(Instance *instance, Named_value *option);
...@@ -357,10 +341,6 @@ class Unset_option: public Abstract_option_cmd ...@@ -357,10 +341,6 @@ class Unset_option: public Abstract_option_cmd
class Syntax_error : public Command class Syntax_error : public Command
{ {
public:
Syntax_error()
{ }
public: public:
int execute(st_net *net, ulong connection_id); int execute(st_net *net, ulong connection_id);
}; };
......
...@@ -91,7 +91,7 @@ Guardian::~Guardian() ...@@ -91,7 +91,7 @@ Guardian::~Guardian()
void Guardian::request_shutdown() void Guardian::request_shutdown()
{ {
pthread_mutex_lock(&LOCK_guardian); pthread_mutex_lock(&LOCK_guardian);
/* stop instances or just clean up Guardian repository */ /* STOP Instances or just clean up Guardian repository */
stop_instances(); stop_instances();
shutdown_requested= TRUE; shutdown_requested= TRUE;
pthread_mutex_unlock(&LOCK_guardian); pthread_mutex_unlock(&LOCK_guardian);
...@@ -110,23 +110,14 @@ void Guardian::process_instance(Instance *instance, ...@@ -110,23 +110,14 @@ void Guardian::process_instance(Instance *instance,
if (current_node->state == STOPPING) if (current_node->state == STOPPING)
{ {
/* this branch is executed during shutdown */ waitchild= instance->options.get_shutdown_delay();
if (instance->options.shutdown_delay)
{
/*
NOTE: it is important to check shutdown_delay here, but use
shutdown_delay_val. The idea is that if the option is unset,
shutdown_delay will be NULL, but shutdown_delay_val will not be reset.
*/
waitchild= instance->options.shutdown_delay_val;
}
/* this returns TRUE if and only if an instance was stopped for sure */ /* this returns TRUE if and only if an instance was stopped for sure */
if (instance->is_crashed()) if (instance->is_crashed())
*guarded_instances= list_delete(*guarded_instances, node); *guarded_instances= list_delete(*guarded_instances, node);
else if ( (uint) (current_time - current_node->last_checked) > waitchild) else if ( (uint) (current_time - current_node->last_checked) > waitchild)
{ {
instance->kill_instance(SIGKILL); instance->kill_mysqld(SIGKILL);
/* /*
Later we do node= node->next. This is ok, as we are only removing Later we do node= node->next. This is ok, as we are only removing
the node from the list. The pointer to the next one is still valid. the node from the list. The pointer to the next one is still valid.
...@@ -137,20 +128,20 @@ void Guardian::process_instance(Instance *instance, ...@@ -137,20 +128,20 @@ void Guardian::process_instance(Instance *instance,
return; return;
} }
if (instance->is_running()) if (instance->is_mysqld_running())
{ {
/* The instance can be contacted on it's port */ /* The instance can be contacted on it's port */
/* If STARTING also check that pidfile has been created */ /* If STARTING also check that pidfile has been created */
if (current_node->state == STARTING && if (current_node->state == STARTING &&
current_node->instance->options.get_pid() == 0) current_node->instance->options.load_pid() == 0)
{ {
/* Pid file not created yet, don't go to STARTED state yet */ /* Pid file not created yet, don't go to STARTED state yet */
} }
else if (current_node->state != STARTED) else if (current_node->state != STARTED)
{ {
/* clear status fields */ /* clear status fields */
log_info("guardian: instance '%s' is running, set state to STARTED.", log_info("Guardian: '%s' is running, set state to STARTED.",
(const char *) instance->options.instance_name.str); (const char *) instance->options.instance_name.str);
current_node->restart_counter= 0; current_node->restart_counter= 0;
current_node->crash_moment= 0; current_node->crash_moment= 0;
...@@ -161,7 +152,7 @@ void Guardian::process_instance(Instance *instance, ...@@ -161,7 +152,7 @@ void Guardian::process_instance(Instance *instance,
{ {
switch (current_node->state) { switch (current_node->state) {
case NOT_STARTED: case NOT_STARTED:
log_info("guardian: starting instance '%s'...", log_info("Guardian: starting '%s'...",
(const char *) instance->options.instance_name.str); (const char *) instance->options.instance_name.str);
/* NOTE, set state to STARTING _before_ start() is called */ /* NOTE, set state to STARTING _before_ start() is called */
...@@ -186,7 +177,7 @@ void Guardian::process_instance(Instance *instance, ...@@ -186,7 +177,7 @@ void Guardian::process_instance(Instance *instance,
if (instance->is_crashed()) if (instance->is_crashed())
{ {
instance->start(); instance->start();
log_info("guardian: starting instance '%s'...", log_info("Guardian: starting '%s'...",
(const char *) instance->options.instance_name.str); (const char *) instance->options.instance_name.str);
} }
} }
...@@ -204,14 +195,15 @@ void Guardian::process_instance(Instance *instance, ...@@ -204,14 +195,15 @@ void Guardian::process_instance(Instance *instance,
instance->start(); instance->start();
current_node->last_checked= current_time; current_node->last_checked= current_time;
current_node->restart_counter++; current_node->restart_counter++;
log_info("guardian: restarting instance '%s'...", log_info("Guardian: restarting '%s'...",
(const char *) instance->options.instance_name.str); (const char *) instance->options.instance_name.str);
} }
} }
else else
{ {
log_info("guardian: cannot start instance %s. Abandoning attempts " log_info("Guardian: can not start '%s'. "
"to (re)start it", instance->options.instance_name.str); "Abandoning attempts to (re)start it",
(const char *) instance->options.instance_name.str);
current_node->state= CRASHED_AND_ABANDONED; current_node->state= CRASHED_AND_ABANDONED;
} }
} }
...@@ -226,13 +218,12 @@ void Guardian::process_instance(Instance *instance, ...@@ -226,13 +218,12 @@ void Guardian::process_instance(Instance *instance,
/* /*
Run guardian thread Main function of Guardian thread.
SYNOPSIS SYNOPSIS
run() run()
DESCRIPTION DESCRIPTION
Check for all guarded instances and restart them if needed. If everything Check for all guarded instances and restart them if needed. If everything
is fine go and sleep for some time. is fine go and sleep for some time.
*/ */
...@@ -436,7 +427,7 @@ int Guardian::stop_instances() ...@@ -436,7 +427,7 @@ int Guardian::stop_instances()
If instance is running or was running (and now probably hanging), If instance is running or was running (and now probably hanging),
request stop. request stop.
*/ */
if (current_node->instance->is_running() || if (current_node->instance->is_mysqld_running() ||
(current_node->state == STARTED)) (current_node->state == STARTED))
{ {
current_node->state= STOPPING; current_node->state= STOPPING;
...@@ -446,7 +437,7 @@ int Guardian::stop_instances() ...@@ -446,7 +437,7 @@ int Guardian::stop_instances()
/* otherwise remove it from the list */ /* otherwise remove it from the list */
guarded_instances= list_delete(guarded_instances, node); guarded_instances= list_delete(guarded_instances, node);
/* But try to kill it anyway. Just in case */ /* But try to kill it anyway. Just in case */
current_node->instance->kill_instance(SIGTERM); current_node->instance->kill_mysqld(SIGTERM);
node= node->next; node= node->next;
} }
return 0; return 0;
...@@ -499,5 +490,5 @@ bool Guardian::is_active(Instance *instance) ...@@ -499,5 +490,5 @@ bool Guardian::is_active(Instance *instance)
if (guarded) if (guarded)
return true; return true;
return instance->is_running(); return instance->is_mysqld_running();
} }
This diff is collapsed.
...@@ -88,21 +88,19 @@ class Instance ...@@ -88,21 +88,19 @@ class Instance
static bool is_mysqld_compatible_name(const LEX_STRING *name); static bool is_mysqld_compatible_name(const LEX_STRING *name);
public: public:
Instance(Thread_registry &thread_registry_arg); Instance();
~Instance(); ~Instance();
int init(const LEX_STRING *name_arg); bool init(const LEX_STRING *name_arg);
int complete_initialization(Instance_map *instance_map_arg, bool complete_initialization();
const char *mysqld_path);
bool is_running(); bool is_mysqld_running();
int start(); int start();
int stop(); int stop();
/* send a signal to the instance */ /* send a signal to the instance */
void kill_instance(int signo); void kill_mysqld(int signo);
bool is_crashed(); bool is_crashed();
void set_crash_flag_n_wake_all(); void set_crash_flag_n_wake_all();
Instance_map *get_map();
/* /*
The operation is intended to check if the instance is mysqld-compatible The operation is intended to check if the instance is mysqld-compatible
...@@ -121,7 +119,6 @@ class Instance ...@@ -121,7 +119,6 @@ class Instance
public: public:
enum { DEFAULT_SHUTDOWN_DELAY= 35 }; enum { DEFAULT_SHUTDOWN_DELAY= 35 };
Instance_options options; Instance_options options;
Thread_registry &thread_registry;
private: private:
/* This attributes is a flag, specifies if the instance has been crashed. */ /* This attributes is a flag, specifies if the instance has been crashed. */
...@@ -155,7 +152,6 @@ class Instance ...@@ -155,7 +152,6 @@ class Instance
stop in Instance::stop() stop in Instance::stop()
*/ */
pthread_cond_t COND_instance_stopped; pthread_cond_t COND_instance_stopped;
Instance_map *instance_map;
void remove_pid(); void remove_pid();
}; };
......
...@@ -63,7 +63,7 @@ static void delete_instance(void *u) ...@@ -63,7 +63,7 @@ static void delete_instance(void *u)
/* /*
The option handler to pass to the process_default_option_files finction. The option handler to pass to the process_default_option_files finction.
SYNOPSYS SYNOPSIS
process_option() process_option()
ctx Handler context. Here it is an instance_map structure. ctx Handler context. Here it is an instance_map structure.
group_name The name of the group the option belongs to. group_name The name of the group the option belongs to.
...@@ -169,7 +169,7 @@ int Instance_map::process_one_option(const LEX_STRING *group, ...@@ -169,7 +169,7 @@ int Instance_map::process_one_option(const LEX_STRING *group,
if (!(instance= (Instance *) hash_search(&hash, (byte *) group->str, if (!(instance= (Instance *) hash_search(&hash, (byte *) group->str,
group->length))) group->length)))
{ {
if (!(instance= new Instance(thread_registry))) if (!(instance= new Instance()))
return 1; return 1;
if (instance->init(group) || add_instance(instance)) if (instance->init(group) || add_instance(instance))
...@@ -213,16 +213,13 @@ int Instance_map::process_one_option(const LEX_STRING *group, ...@@ -213,16 +213,13 @@ int Instance_map::process_one_option(const LEX_STRING *group,
} }
Instance_map::Instance_map(const char *default_mysqld_path_arg, Instance_map::Instance_map()
Thread_registry &thread_registry_arg):
mysqld_path(default_mysqld_path_arg),
thread_registry(thread_registry_arg)
{ {
pthread_mutex_init(&LOCK_instance_map, 0); pthread_mutex_init(&LOCK_instance_map, 0);
} }
int Instance_map::init() bool Instance_map::init()
{ {
return hash_init(&hash, default_charset_info, START_HASH_SIZE, 0, 0, return hash_init(&hash, default_charset_info, START_HASH_SIZE, 0, 0,
get_instance_key, delete_instance, 0); get_instance_key, delete_instance, 0);
...@@ -310,7 +307,7 @@ bool Instance_map::is_there_active_instance() ...@@ -310,7 +307,7 @@ bool Instance_map::is_there_active_instance()
while ((instance= iterator.next())) while ((instance= iterator.next()))
{ {
if (guardian->find_instance_node(instance) != NULL || if (guardian->find_instance_node(instance) != NULL ||
instance->is_running()) instance->is_mysqld_running())
{ {
return TRUE; return TRUE;
} }
...@@ -335,18 +332,18 @@ int Instance_map::remove_instance(Instance *instance) ...@@ -335,18 +332,18 @@ int Instance_map::remove_instance(Instance *instance)
int Instance_map::create_instance(const LEX_STRING *instance_name, int Instance_map::create_instance(const LEX_STRING *instance_name,
const Named_value_arr *options) const Named_value_arr *options)
{ {
Instance *instance= new Instance(thread_registry); Instance *instance= new Instance();
if (!instance) if (!instance)
{ {
log_error("Error: can not initialize (name: '%s').", log_error("Error: can not allocate instance (name: '%s').",
(const char *) instance_name->str); (const char *) instance_name->str);
return ER_OUT_OF_RESOURCES; return ER_OUT_OF_RESOURCES;
} }
if (instance->init(instance_name)) if (instance->init(instance_name))
{ {
log_error("Error: can not initialize (name: '%s').", log_error("Error: can not initialize instance (name: '%s').",
(const char *) instance_name->str); (const char *) instance_name->str);
delete instance; delete instance;
return ER_OUT_OF_RESOURCES; return ER_OUT_OF_RESOURCES;
...@@ -374,7 +371,7 @@ int Instance_map::create_instance(const LEX_STRING *instance_name, ...@@ -374,7 +371,7 @@ int Instance_map::create_instance(const LEX_STRING *instance_name,
log_info("Warning: instance name '%s' is mysqld-compatible.", log_info("Warning: instance name '%s' is mysqld-compatible.",
(const char *) instance_name->str); (const char *) instance_name->str);
if (instance->complete_initialization(this, mysqld_path)) if (instance->complete_initialization())
{ {
log_error("Error: can not complete initialization of instance (name: '%s').", log_error("Error: can not complete initialization of instance (name: '%s').",
(const char *) instance_name->str); (const char *) instance_name->str);
...@@ -411,7 +408,7 @@ bool Instance_map::complete_initialization() ...@@ -411,7 +408,7 @@ bool Instance_map::complete_initialization()
{ {
Instance *instance= (Instance *) hash_element(&hash, i); Instance *instance= (Instance *) hash_element(&hash, i);
if (instance->complete_initialization(this, mysqld_path)) if (instance->complete_initialization())
return TRUE; return TRUE;
} }
...@@ -543,14 +540,14 @@ const char *Instance_map::get_instance_state_name(Instance *instance) ...@@ -543,14 +540,14 @@ const char *Instance_map::get_instance_state_name(Instance *instance)
/* The instance is not managed by Guardian: we can report status only. */ /* The instance is not managed by Guardian: we can report status only. */
return instance->is_running() ? "online" : "offline"; return instance->is_mysqld_running() ? "online" : "offline";
} }
/* /*
Create a new configuration section for mysqld-instance in the config file. Create a new configuration section for mysqld-instance in the config file.
SYNOPSYS SYNOPSIS
create_instance_in_file() create_instance_in_file()
instance_name mysqld-instance name instance_name mysqld-instance name
options options for the new mysqld-instance options options for the new mysqld-instance
......
...@@ -75,7 +75,7 @@ class Instance_map ...@@ -75,7 +75,7 @@ class Instance_map
void lock(); void lock();
void unlock(); void unlock();
int init(); bool init();
/* /*
Process a given option and assign it to appropricate instance. This is Process a given option and assign it to appropricate instance. This is
...@@ -105,8 +105,7 @@ class Instance_map ...@@ -105,8 +105,7 @@ class Instance_map
int create_instance(const LEX_STRING *instance_name, int create_instance(const LEX_STRING *instance_name,
const Named_value_arr *options); const Named_value_arr *options);
Instance_map(const char *default_mysqld_path_arg, Instance_map();
Thread_registry &thread_registry_arg);
~Instance_map(); ~Instance_map();
/* /*
...@@ -132,8 +131,6 @@ class Instance_map ...@@ -132,8 +131,6 @@ class Instance_map
enum { START_HASH_SIZE = 16 }; enum { START_HASH_SIZE = 16 };
pthread_mutex_t LOCK_instance_map; pthread_mutex_t LOCK_instance_map;
HASH hash; HASH hash;
Thread_registry &thread_registry;
}; };
#endif /* INCLUDES_MYSQL_INSTANCE_MANAGER_INSTANCE_MAP_H */ #endif /* INCLUDES_MYSQL_INSTANCE_MANAGER_INSTANCE_MAP_H */
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "buffer.h" #include "buffer.h"
#include "instance.h" #include "instance.h"
#include "log.h" #include "log.h"
#include "options.h"
#include "parse_output.h" #include "parse_output.h"
#include "priv.h" #include "priv.h"
...@@ -82,8 +83,12 @@ bool Instance_options::is_option_im_specific(const char *option_name) ...@@ -82,8 +83,12 @@ bool Instance_options::is_option_im_specific(const char *option_name)
Instance_options::Instance_options() Instance_options::Instance_options()
:mysqld_version(NULL), mysqld_socket(NULL), mysqld_datadir(NULL), :mysqld_version(NULL), mysqld_socket(NULL), mysqld_datadir(NULL),
mysqld_pid_file(NULL), mysqld_port(NULL), mysqld_port_val(0), mysqld_pid_file(NULL),
nonguarded(NULL), shutdown_delay(NULL), shutdown_delay_val(0), nonguarded(NULL),
mysqld_port(NULL),
mysqld_port_val(0),
shutdown_delay(NULL),
shutdown_delay_val(0),
filled_default_options(0) filled_default_options(0)
{ {
mysqld_path.str= NULL; mysqld_path.str= NULL;
...@@ -99,7 +104,7 @@ Instance_options::Instance_options() ...@@ -99,7 +104,7 @@ Instance_options::Instance_options()
/* /*
Get compiled-in value of default_option Get compiled-in value of default_option
SYNOPSYS SYNOPSIS
get_default_option() get_default_option()
result buffer to put found value result buffer to put found value
result_len buffer size result_len buffer size
...@@ -139,7 +144,7 @@ int Instance_options::get_default_option(char *result, size_t result_len, ...@@ -139,7 +144,7 @@ int Instance_options::get_default_option(char *result, size_t result_len,
/* /*
Fill mysqld_version option (used at initialization stage) Fill mysqld_version option (used at initialization stage)
SYNOPSYS SYNOPSIS
fill_instance_version() fill_instance_version()
DESCRIPTION DESCRIPTION
...@@ -182,7 +187,7 @@ int Instance_options::fill_instance_version() ...@@ -182,7 +187,7 @@ int Instance_options::fill_instance_version()
err: err:
if (rc) if (rc)
log_error("fill_instance_version: Failed to get version of '%s'", log_error("fill_instance_version: Failed to get version of '%s'",
mysqld_path.str); (const char *) mysqld_path.str);
return rc; return rc;
} }
...@@ -190,7 +195,7 @@ int Instance_options::fill_instance_version() ...@@ -190,7 +195,7 @@ int Instance_options::fill_instance_version()
/* /*
Fill mysqld_real_path Fill mysqld_real_path
SYNOPSYS SYNOPSIS
fill_mysqld_real_path() fill_mysqld_real_path()
DESCRIPTION DESCRIPTION
...@@ -242,7 +247,7 @@ int Instance_options::fill_mysqld_real_path() ...@@ -242,7 +247,7 @@ int Instance_options::fill_mysqld_real_path()
/* /*
Fill various log options Fill various log options
SYNOPSYS SYNOPSIS
fill_log_options() fill_log_options()
DESCRIPTION DESCRIPTION
...@@ -355,7 +360,7 @@ int Instance_options::fill_log_options() ...@@ -355,7 +360,7 @@ int Instance_options::fill_log_options()
/* /*
Get the full pid file name with path Get the full pid file name with path
SYNOPSYS SYNOPSIS
get_pid_filaname() get_pid_filaname()
result buffer to sotre the pidfile value result buffer to sotre the pidfile value
...@@ -396,7 +401,7 @@ int Instance_options::unlink_pidfile() ...@@ -396,7 +401,7 @@ int Instance_options::unlink_pidfile()
} }
pid_t Instance_options::get_pid() pid_t Instance_options::load_pid()
{ {
FILE *pid_file_stream; FILE *pid_file_stream;
...@@ -415,7 +420,7 @@ pid_t Instance_options::get_pid() ...@@ -415,7 +420,7 @@ pid_t Instance_options::get_pid()
} }
int Instance_options::complete_initialization(const char *default_path) bool Instance_options::complete_initialization()
{ {
int arg_idx; int arg_idx;
const char *tmp; const char *tmp;
...@@ -423,10 +428,14 @@ int Instance_options::complete_initialization(const char *default_path) ...@@ -423,10 +428,14 @@ int Instance_options::complete_initialization(const char *default_path)
if (!mysqld_path.str) if (!mysqld_path.str)
{ {
// Need one extra byte, as convert_dirname() adds a slash at the end. /* Need one extra byte, as convert_dirname() adds a slash at the end. */
if (!(mysqld_path.str= alloc_root(&alloc, strlen(default_path) + 2))) mysqld_path.str= alloc_root(&alloc,
goto err; strlen(Options::Main::default_mysqld_path) + 2);
strcpy(mysqld_path.str, default_path);
if (! mysqld_path.str)
return TRUE;
strcpy(mysqld_path.str, Options::Main::default_mysqld_path);
} }
// it's safe to cast this to char* since this is a buffer we are allocating // it's safe to cast this to char* since this is a buffer we are allocating
...@@ -442,7 +451,7 @@ int Instance_options::complete_initialization(const char *default_path) ...@@ -442,7 +451,7 @@ int Instance_options::complete_initialization(const char *default_path)
shutdown_delay_val= atoi(shutdown_delay); shutdown_delay_val= atoi(shutdown_delay);
if (!(tmp= strdup_root(&alloc, "--no-defaults"))) if (!(tmp= strdup_root(&alloc, "--no-defaults")))
goto err; return TRUE;
if (!mysqld_pid_file) if (!mysqld_pid_file)
{ {
...@@ -477,21 +486,21 @@ int Instance_options::complete_initialization(const char *default_path) ...@@ -477,21 +486,21 @@ int Instance_options::complete_initialization(const char *default_path)
} }
if (get_pid_filename(pid_file_with_path)) if (get_pid_filename(pid_file_with_path))
goto err; return TRUE;
/* we need to reserve space for the final zero + possible default options */ /* we need to reserve space for the final zero + possible default options */
if (!(argv= (char**) if (!(argv= (char**)
alloc_root(&alloc, (get_num_options() + 1 alloc_root(&alloc, (get_num_options() + 1
+ MAX_NUMBER_OF_DEFAULT_OPTIONS) * sizeof(char*)))) + MAX_NUMBER_OF_DEFAULT_OPTIONS) * sizeof(char*))))
goto err; return TRUE;
filled_default_options= 0; filled_default_options= 0;
/* the path must be first in the argv */ /* the path must be first in the argv */
if (add_to_argv(mysqld_path.str)) if (add_to_argv(mysqld_path.str))
goto err; return TRUE;
if (add_to_argv(tmp)) if (add_to_argv(tmp))
goto err; return TRUE;
arg_idx= filled_default_options; arg_idx= filled_default_options;
for (int opt_idx= 0; opt_idx < get_num_options(); ++opt_idx) for (int opt_idx= 0; opt_idx < get_num_options(); ++opt_idx)
...@@ -514,12 +523,9 @@ int Instance_options::complete_initialization(const char *default_path) ...@@ -514,12 +523,9 @@ int Instance_options::complete_initialization(const char *default_path)
argv[arg_idx]= 0; argv[arg_idx]= 0;
if (fill_log_options() || fill_mysqld_real_path() || fill_instance_version()) if (fill_log_options() || fill_mysqld_real_path() || fill_instance_version())
goto err; return TRUE;
return 0;
err: return FALSE;
return 1;
} }
...@@ -636,26 +642,26 @@ void Instance_options::print_argv() ...@@ -636,26 +642,26 @@ void Instance_options::print_argv()
/* /*
We execute this function to initialize some options. We execute this function to initialize some options.
Return value: 0 - ok. 1 - unable to allocate memory.
RETURN
FALSE - ok
TRUE - memory allocation error
*/ */
int Instance_options::init(const LEX_STRING *instance_name_arg) bool Instance_options::init(const LEX_STRING *instance_name_arg)
{ {
instance_name.length= instance_name_arg->length; instance_name.length= instance_name_arg->length;
init_alloc_root(&alloc, MEM_ROOT_BLOCK_SIZE, 0); init_alloc_root(&alloc, MEM_ROOT_BLOCK_SIZE, 0);
if (options.init()) if (options.init())
goto err; return TRUE;
if (!(instance_name.str= strmake_root(&alloc, instance_name_arg->str, if (!(instance_name.str= strmake_root(&alloc, instance_name_arg->str,
instance_name_arg->length))) instance_name_arg->length)))
goto err; return TRUE;
return 0;
err: return FALSE;
return 1;
} }
...@@ -663,3 +669,29 @@ Instance_options::~Instance_options() ...@@ -663,3 +669,29 @@ Instance_options::~Instance_options()
{ {
free_root(&alloc, MYF(0)); free_root(&alloc, MYF(0));
} }
uint Instance_options::get_shutdown_delay() const
{
static const uint DEFAULT_SHUTDOWN_DELAY= 35;
/*
NOTE: it is important to check shutdown_delay here, but use
shutdown_delay_val. The idea is that if the option is unset,
shutdown_delay will be NULL, but shutdown_delay_val will not be reset.
*/
return shutdown_delay ? shutdown_delay_val : DEFAULT_SHUTDOWN_DELAY;
}
int Instance_options::get_mysqld_port() const
{
/*
NOTE: it is important to check mysqld_port here, but use mysqld_port_val.
The idea is that if the option is unset, mysqld_port will be NULL, but
mysqld_port_val will not be reset.
*/
return mysqld_port ? mysqld_port_val : 0;
}
...@@ -45,8 +45,9 @@ class Instance_options ...@@ -45,8 +45,9 @@ class Instance_options
public: public:
Instance_options(); Instance_options();
~Instance_options(); ~Instance_options();
/* fills in argv */ /* fills in argv */
int complete_initialization(const char *default_path); bool complete_initialization();
bool set_option(Named_value *option); bool set_option(Named_value *option);
void unset_option(const char *option_name); void unset_option(const char *option_name);
...@@ -55,12 +56,15 @@ class Instance_options ...@@ -55,12 +56,15 @@ class Instance_options
inline Named_value get_option(int idx) const; inline Named_value get_option(int idx) const;
public: public:
int init(const LEX_STRING *instance_name_arg); bool init(const LEX_STRING *instance_name_arg);
pid_t get_pid(); pid_t load_pid();
int get_pid_filename(char *result); int get_pid_filename(char *result);
int unlink_pidfile(); int unlink_pidfile();
void print_argv(); void print_argv();
uint get_shutdown_delay() const;
int get_mysqld_port() const;
public: public:
/* /*
We need this value to be greater or equal then FN_REFLEN found in We need this value to be greater or equal then FN_REFLEN found in
...@@ -79,14 +83,10 @@ class Instance_options ...@@ -79,14 +83,10 @@ class Instance_options
const char *mysqld_socket; const char *mysqld_socket;
const char *mysqld_datadir; const char *mysqld_datadir;
const char *mysqld_pid_file; const char *mysqld_pid_file;
const char *mysqld_port;
uint mysqld_port_val;
LEX_STRING instance_name; LEX_STRING instance_name;
LEX_STRING mysqld_path; LEX_STRING mysqld_path;
LEX_STRING mysqld_real_path; LEX_STRING mysqld_real_path;
const char *nonguarded; const char *nonguarded;
const char *shutdown_delay;
uint shutdown_delay_val;
/* log enums are defined in parse.h */ /* log enums are defined in parse.h */
char *logs[3]; char *logs[3];
...@@ -102,6 +102,11 @@ class Instance_options ...@@ -102,6 +102,11 @@ class Instance_options
int find_option(const char *option_name); int find_option(const char *option_name);
private: private:
const char *mysqld_port;
uint mysqld_port_val;
const char *shutdown_delay;
uint shutdown_delay_val;
uint filled_default_options; uint filled_default_options;
MEM_ROOT alloc; MEM_ROOT alloc;
......
...@@ -85,14 +85,7 @@ void Listener::run() ...@@ -85,14 +85,7 @@ void Listener::run()
log_info("Listener: started."); log_info("Listener: started.");
#ifndef __WIN__ #ifndef __WIN__
/* we use this var to check whether we are running on LinuxThreads */
pid_t thread_pid;
thread_pid= getpid();
struct sockaddr_un unix_socket_address; struct sockaddr_un unix_socket_address;
/* set global variable */
linuxthreads= (thread_pid != manager_pid);
#endif #endif
thread_registry->register_thread(&thread_info); thread_registry->register_thread(&thread_info);
...@@ -151,10 +144,12 @@ void Listener::run() ...@@ -151,10 +144,12 @@ void Listener::run()
{ {
set_no_inherit(client_fd); set_no_inherit(client_fd);
Vio *vio= vio_new(client_fd, socket_index == 0 ? struct st_vio *vio=
VIO_TYPE_SOCKET : VIO_TYPE_TCPIP, vio_new(client_fd,
socket_index == 0 ? 1 : 0); socket_index == 0 ? VIO_TYPE_SOCKET : VIO_TYPE_TCPIP,
if (vio != 0) socket_index == 0 ? 1 : 0);
if (vio != NULL)
handle_new_mysql_connection(vio); handle_new_mysql_connection(vio);
else else
{ {
...@@ -318,12 +313,12 @@ create_unix_socket(struct sockaddr_un &unix_socket_address) ...@@ -318,12 +313,12 @@ create_unix_socket(struct sockaddr_un &unix_socket_address)
/* /*
Create new mysql connection. Created thread is responsible for deletion of Create new mysql connection. Created thread is responsible for deletion of
the Mysql_connection_thread_args and Vio instances passed to it. the Mysql_connection and Vio instances passed to it.
SYNOPSYS SYNOPSIS
handle_new_mysql_connection() handle_new_mysql_connection()
*/ */
void Listener::handle_new_mysql_connection(Vio *vio) void Listener::handle_new_mysql_connection(struct st_vio *vio)
{ {
Mysql_connection *mysql_connection= Mysql_connection *mysql_connection=
new Mysql_connection(thread_registry, user_map, new Mysql_connection(thread_registry, user_map,
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
/* /*
Format log entry and write it to the given stream. Format log entry and write it to the given stream.
SYNOPSYS SYNOPSIS
log() log()
*/ */
......
...@@ -93,17 +93,17 @@ int my_sigwait(const sigset_t *set, int *sig) ...@@ -93,17 +93,17 @@ int my_sigwait(const sigset_t *set, int *sig)
#endif #endif
void stop_all(Guardian *guardian, Thread_registry *registry) void Manager::stop_all_threads()
{ {
/* /*
Let guardian thread know that it should break it's processing cycle, Let guardian thread know that it should break it's processing cycle,
once it wakes up. once it wakes up.
*/ */
guardian->request_shutdown(); p_guardian->request_shutdown();
/* wake guardian */ /* wake guardian */
pthread_cond_signal(&guardian->COND_guardian); pthread_cond_signal(&p_guardian->COND_guardian);
/* stop all threads */ /* stop all threads */
registry->deliver_shutdown(); p_thread_registry->deliver_shutdown();
} }
/********************************************************************** /**********************************************************************
...@@ -112,6 +112,9 @@ void stop_all(Guardian *guardian, Thread_registry *registry) ...@@ -112,6 +112,9 @@ void stop_all(Guardian *guardian, Thread_registry *registry)
Guardian *Manager::p_guardian; Guardian *Manager::p_guardian;
Instance_map *Manager::p_instance_map; Instance_map *Manager::p_instance_map;
Thread_registry *Manager::p_thread_registry;
User_map *Manager::p_user_map;
pid_t Manager::manager_pid;
/* /*
manager - entry point to the main instance manager process: start manager - entry point to the main instance manager process: start
...@@ -137,8 +140,7 @@ int Manager::main() ...@@ -137,8 +140,7 @@ int Manager::main()
*/ */
User_map user_map; User_map user_map;
Instance_map instance_map(Options::Main::default_mysqld_path, Instance_map instance_map;
thread_registry);
Guardian guardian(&thread_registry, &instance_map, Guardian guardian(&thread_registry, &instance_map,
Options::Main::monitoring_interval); Options::Main::monitoring_interval);
...@@ -147,6 +149,8 @@ int Manager::main() ...@@ -147,6 +149,8 @@ int Manager::main()
manager_pid= getpid(); manager_pid= getpid();
p_instance_map= &instance_map; p_instance_map= &instance_map;
p_guardian= instance_map.guardian= &guardian; p_guardian= instance_map.guardian= &guardian;
p_thread_registry= &thread_registry;
p_user_map= &user_map;
/* Initialize instance map. */ /* Initialize instance map. */
...@@ -199,14 +203,11 @@ int Manager::main() ...@@ -199,14 +203,11 @@ int Manager::main()
NOTE: To work nicely with LinuxThreads, the signal thread is the first NOTE: To work nicely with LinuxThreads, the signal thread is the first
thread in the process. thread in the process.
NOTE: NOTE: After init_thr_alarm() call it's possible to call thr_alarm()
After init_thr_alarm() call it's possible to call thr_alarm() (from (from different threads), that results in sending ALARM signal to the
different threads), that results in sending ALARM signal to the alarm alarm thread (which can be the main thread). That signal can interrupt
thread (which can be the main thread). That signal can interrupt blocking calls. In other words, a blocking call can be interrupted in
blocking calls. the main thread after init_thr_alarm().
In other words, a blocking call can be interrupted in the main thread
after init_thr_alarm().
*/ */
sigset_t mask; sigset_t mask;
...@@ -230,11 +231,12 @@ int Manager::main() ...@@ -230,11 +231,12 @@ int Manager::main()
*/ */
if (guardian.start_detached()) if (guardian.start_detached())
{ {
log_error("manager(): Failed to create the guardian thread"); log_error("Error: can not start Guardian thread.");
goto err; goto err;
} }
/* Load instances. */ /* Load instances. */
{ {
instance_map.guardian->lock(); instance_map.guardian->lock();
instance_map.lock(); instance_map.lock();
...@@ -246,19 +248,18 @@ int Manager::main() ...@@ -246,19 +248,18 @@ int Manager::main()
if (flush_instances_status) if (flush_instances_status)
{ {
log_error("Cannot init instances repository. This might be caused by " log_error("Error: can not init instances repository.");
"the wrong config file options. For instance, missing mysqld " stop_all_threads();
"binary. Aborting.");
stop_all(&guardian, &thread_registry);
goto err; goto err;
} }
} }
/* start the listener */ /* Initialize the Listener. */
if (listener.start_detached()) if (listener.start_detached())
{ {
log_error("manager(): set_stacksize_n_create_thread(listener) failed"); log_error("Error: can not start Listener thread.");
stop_all(&guardian, &thread_registry); stop_all_threads();
goto err; goto err;
} }
...@@ -268,7 +269,9 @@ int Manager::main() ...@@ -268,7 +269,9 @@ int Manager::main()
*/ */
pthread_cond_signal(&guardian.COND_guardian); pthread_cond_signal(&guardian.COND_guardian);
log_info("Main loop: started."); /* Main loop. */
log_info("Manager: started.");
while (!shutdown_complete) while (!shutdown_complete)
{ {
...@@ -277,8 +280,8 @@ int Manager::main() ...@@ -277,8 +280,8 @@ int Manager::main()
if ((status= my_sigwait(&mask, &signo)) != 0) if ((status= my_sigwait(&mask, &signo)) != 0)
{ {
log_error("sigwait() failed"); log_error("Error: sigwait() failed");
stop_all(&guardian, &thread_registry); stop_all_threads();
goto err; goto err;
} }
...@@ -304,7 +307,7 @@ int Manager::main() ...@@ -304,7 +307,7 @@ int Manager::main()
Bug #14164 IM tests fail on MacOS X (powermacg5) Bug #14164 IM tests fail on MacOS X (powermacg5)
*/ */
#ifdef IGNORE_SIGHUP_SIGQUIT #ifdef IGNORE_SIGHUP_SIGQUIT
if ( SIGHUP == signo ) if (SIGHUP == signo)
continue; continue;
#endif #endif
if (THR_SERVER_ALARM == signo) if (THR_SERVER_ALARM == signo)
...@@ -312,7 +315,7 @@ int Manager::main() ...@@ -312,7 +315,7 @@ int Manager::main()
else else
#endif #endif
{ {
log_info("Main loop: got shutdown signal."); log_info("Manager: got shutdown signal.");
if (!guardian.is_stopped()) if (!guardian.is_stopped())
{ {
...@@ -327,7 +330,7 @@ int Manager::main() ...@@ -327,7 +330,7 @@ int Manager::main()
} }
} }
log_info("Main loop: finished."); log_info("Manager: finished.");
rc= 0; rc= 0;
......
...@@ -19,9 +19,12 @@ ...@@ -19,9 +19,12 @@
#if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE) #if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE)
#pragma interface #pragma interface
#endif #endif
#include <my_global.h>
class Guardian; class Guardian;
class Instance_map; class Instance_map;
class Thread_registry;
class User_map;
class Manager class Manager
{ {
...@@ -33,12 +36,18 @@ class Manager ...@@ -33,12 +36,18 @@ class Manager
*/ */
static Instance_map *get_instance_map() { return p_instance_map; } static Instance_map *get_instance_map() { return p_instance_map; }
static Guardian *get_guardian() { return p_guardian; } static Guardian *get_guardian() { return p_guardian; }
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; }
private: private:
static int manager_impl(); static void stop_all_threads();
private: private:
static pid_t manager_pid;
static Guardian *p_guardian; static Guardian *p_guardian;
static Instance_map *p_instance_map; static Instance_map *p_instance_map;
static Thread_registry *p_thread_registry;
static User_map *p_user_map;
}; };
#endif // INCLUDES_MYSQL_INSTANCE_MANAGER_MANAGER_H #endif // INCLUDES_MYSQL_INSTANCE_MANAGER_MANAGER_H
...@@ -71,6 +71,7 @@ static void daemonize(const char *log_file_name); ...@@ -71,6 +71,7 @@ static void daemonize(const char *log_file_name);
static void angel(); static void angel();
static struct passwd *check_user(const char *user); static struct passwd *check_user(const char *user);
static int set_user(const char *user, struct passwd *user_info); static int set_user(const char *user, struct passwd *user_info);
static bool check_if_linuxthreads();
#endif #endif
...@@ -110,6 +111,9 @@ int main(int argc, char *argv[]) ...@@ -110,6 +111,9 @@ int main(int argc, char *argv[])
} }
} }
if (check_if_linuxthreads())
goto main_end; /* out of resources */
if (Options::Daemon::run_as_service) if (Options::Daemon::run_as_service)
{ {
/* forks, and returns only in child */ /* forks, and returns only in child */
...@@ -232,7 +236,7 @@ static void init_environment(char *progname) ...@@ -232,7 +236,7 @@ static void init_environment(char *progname)
#ifndef __WIN__ #ifndef __WIN__
/* /*
Become a UNIX service Become a UNIX service
SYNOPSYS SYNOPSIS
daemonize() daemonize()
*/ */
...@@ -392,4 +396,27 @@ static void angel() ...@@ -392,4 +396,27 @@ static void angel()
} }
} }
extern "C" {
static void *check_if_linuxthreads_thread_func(void *arg)
{
pid_t main_pid= *(pid_t*) arg;
linuxthreads= getpid() != main_pid;
return NULL;
}
} /* extern "C" */
static bool check_if_linuxthreads()
{
pid_t pid= getpid();
pthread_t thread_id;
int rc;
rc= pthread_create(&thread_id, NULL, check_if_linuxthreads_thread_func,
(void*) &pid);
if (rc == 0)
rc= pthread_join(thread_id, NULL);
return test(rc);
}
#endif #endif
...@@ -43,7 +43,7 @@ void trim_space(const char **text, uint *word_len) ...@@ -43,7 +43,7 @@ void trim_space(const char **text, uint *word_len)
/* /*
Parse output of the given command Parse output of the given command
SYNOPSYS SYNOPSIS
parse_output_and_get_value() parse_output_and_get_value()
command the command to execue with popen. command the command to execue with popen.
......
...@@ -22,14 +22,13 @@ ...@@ -22,14 +22,13 @@
#include "log.h" #include "log.h"
/* the pid of the manager process (of the signal thread on the LinuxThreads) */ #ifndef __WIN__
pid_t manager_pid;
/* /*
This flag is set if mysqlmanager has detected that it is running on the This flag is set if mysqlmanager has detected that it is running on the
system using LinuxThreads system using LinuxThreads
*/ */
bool linuxthreads; bool linuxthreads;
#endif
/* /*
The following string must be less then 80 characters, as The following string must be less then 80 characters, as
......
...@@ -50,9 +50,6 @@ const int MAX_VERSION_LENGTH= 160; ...@@ -50,9 +50,6 @@ const int MAX_VERSION_LENGTH= 160;
const int MAX_INSTANCE_NAME_SIZE= FN_REFLEN; const int MAX_INSTANCE_NAME_SIZE= FN_REFLEN;
/* the pid of the manager process (of the signal thread on the LinuxThreads) */
extern pid_t manager_pid;
#ifndef __WIN__ #ifndef __WIN__
/* /*
This flag is set if mysqlmanager has detected that it is running on the This flag is set if mysqlmanager has detected that it is running on the
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
This function must not be used in user-management command implementations. This function must not be used in user-management command implementations.
Use get_user_name() instead. Use get_user_name() instead.
SYNOPSYS SYNOPSIS
get_user_name_impl() get_user_name_impl()
RETURN RETURN
...@@ -58,7 +58,7 @@ static char *get_user_name_impl() ...@@ -58,7 +58,7 @@ static char *get_user_name_impl()
(not empty, not exceeds USERNAME_LENGTH). Report to stderr if something is (not empty, not exceeds USERNAME_LENGTH). Report to stderr if something is
wrong. wrong.
SYNOPSYS SYNOPSIS
get_user_name() get_user_name()
user_name [OUT] on success contains user name user_name [OUT] on success contains user name
...@@ -102,7 +102,7 @@ static bool get_user_name(LEX_STRING *user_name) ...@@ -102,7 +102,7 @@ static bool get_user_name(LEX_STRING *user_name)
The password is retrieved from command-line options (if specified) or from The password is retrieved from command-line options (if specified) or from
console. console.
SYNOPSYS SYNOPSIS
get_password() get_password()
RETURN RETURN
...@@ -131,7 +131,7 @@ static const char *get_password() ...@@ -131,7 +131,7 @@ static const char *get_password()
/* /*
Load password file into user map. Load password file into user map.
SYNOPSYS SYNOPSIS
load_password_file() load_password_file()
user_map target user map user_map target user map
...@@ -160,7 +160,7 @@ static int load_password_file(User_map *user_map) ...@@ -160,7 +160,7 @@ static int load_password_file(User_map *user_map)
/* /*
Save user map into password file. Save user map into password file.
SYNOPSYS SYNOPSIS
save_password_file() save_password_file()
user_map user map user_map user map
......
...@@ -49,7 +49,7 @@ class User_management_cmd ...@@ -49,7 +49,7 @@ class User_management_cmd
/* /*
Executes user-management command. Executes user-management command.
SYNOPSYS SYNOPSIS
execute() execute()
RETURN RETURN
......
...@@ -159,7 +159,7 @@ User_map::~User_map() ...@@ -159,7 +159,7 @@ User_map::~User_map()
/* /*
Load password database. Load password database.
SYNOPSYS SYNOPSIS
load() load()
password_file_name [IN] password file path password_file_name [IN] password file path
err_msg [OUT] error message err_msg [OUT] error message
......
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