mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge bodhi.local:/opt/local/work/mysql-5.0-runtime
into bodhi.local:/opt/local/work/mysql-5.1-runtime-merge mysql-test/r/im_daemon_life_cycle.result: Auto merged mysql-test/r/ps.result: Auto merged mysql-test/r/rpl_insert_id.result: Auto merged mysql-test/r/sp-vars.result: Auto merged mysql-test/r/trigger.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/t/func_gconcat.test: Auto merged mysql-test/t/im_daemon_life_cycle.imtest: Auto merged mysql-test/t/ps.test: Auto merged mysql-test/t/rpl_insert_id.test: Auto merged mysql-test/t/sp.test: Auto merged mysql-test/t/trigger.test: Auto merged server-tools/instance-manager/guardian.cc: Auto merged server-tools/instance-manager/guardian.h: Auto merged server-tools/instance-manager/instance_map.cc: Auto merged server-tools/instance-manager/listener.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/sp_head.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_trigger.cc: Auto merged sql/sql_view.cc: Auto merged sql/sql_yacc.yy: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/r/sp-error.result: Use local mysql-test/r/sp.result: Use local (will overwrite) mysql-test/t/view.test: Use local. mysql-test/mysql-test-run.pl: Manual merge. mysql-test/t/sp-error.test: Manual merge. server-tools/instance-manager/instance.cc: Manual merge. server-tools/instance-manager/manager.cc: Manual merge. server-tools/instance-manager/options.cc: Manual merge. server-tools/instance-manager/options.h: Manual merge. sql/log_event.cc: Manual merge. sql/set_var.cc: Manual merge. sql/sql_class.h: Manual merge. sql/sql_insert.cc: Manual merge. sql/sql_load.cc: Manual merge. sql/sql_select.cc: Manual merge. sql/sql_update.cc: Manual merge.
This commit is contained in:
@ -95,11 +95,11 @@ Guardian_thread::~Guardian_thread()
|
||||
}
|
||||
|
||||
|
||||
void Guardian_thread::request_shutdown(bool stop_instances_arg)
|
||||
void Guardian_thread::request_shutdown()
|
||||
{
|
||||
pthread_mutex_lock(&LOCK_guardian);
|
||||
/* stop instances or just clean up Guardian repository */
|
||||
stop_instances(stop_instances_arg);
|
||||
stop_instances();
|
||||
shutdown_requested= TRUE;
|
||||
pthread_mutex_unlock(&LOCK_guardian);
|
||||
}
|
||||
@ -154,11 +154,11 @@ void Guardian_thread::process_instance(Instance *instance,
|
||||
{
|
||||
/* Pid file not created yet, don't go to STARTED state yet */
|
||||
}
|
||||
else
|
||||
else if (current_node->state != STARTED)
|
||||
{
|
||||
/* clear status fields */
|
||||
log_info("guardian: instance %s is running, set state to STARTED",
|
||||
instance->options.instance_name);
|
||||
log_info("guardian: instance '%s' is running, set state to STARTED.",
|
||||
(const char *) instance->options.instance_name);
|
||||
current_node->restart_counter= 0;
|
||||
current_node->crash_moment= 0;
|
||||
current_node->state= STARTED;
|
||||
@ -168,8 +168,8 @@ void Guardian_thread::process_instance(Instance *instance,
|
||||
{
|
||||
switch (current_node->state) {
|
||||
case NOT_STARTED:
|
||||
log_info("guardian: starting instance %s",
|
||||
instance->options.instance_name);
|
||||
log_info("guardian: starting instance '%s'...",
|
||||
(const char *) instance->options.instance_name);
|
||||
|
||||
/* NOTE, set state to STARTING _before_ start() is called */
|
||||
current_node->state= STARTING;
|
||||
@ -193,8 +193,8 @@ void Guardian_thread::process_instance(Instance *instance,
|
||||
if (instance->is_crashed())
|
||||
{
|
||||
instance->start();
|
||||
log_info("guardian: starting instance %s",
|
||||
instance->options.instance_name);
|
||||
log_info("guardian: starting instance '%s'...",
|
||||
(const char *) instance->options.instance_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -211,8 +211,8 @@ void Guardian_thread::process_instance(Instance *instance,
|
||||
instance->start();
|
||||
current_node->last_checked= current_time;
|
||||
current_node->restart_counter++;
|
||||
log_info("guardian: restarting instance %s",
|
||||
instance->options.instance_name);
|
||||
log_info("guardian: restarting instance '%s'...",
|
||||
(const char *) instance->options.instance_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -414,12 +414,11 @@ int Guardian_thread::stop_guard(Instance *instance)
|
||||
|
||||
SYNOPSYS
|
||||
stop_instances()
|
||||
stop_instances_arg whether we should stop instances at shutdown
|
||||
|
||||
DESCRIPTION
|
||||
Loops through the guarded_instances list and prepares them for shutdown.
|
||||
If stop_instances was requested, we need to issue a stop command and change
|
||||
the state accordingly. Otherwise we simply delete an entry.
|
||||
For each instance we issue a stop command and change the state
|
||||
accordingly.
|
||||
|
||||
NOTE
|
||||
Guardian object should be locked by the calling function.
|
||||
@ -429,42 +428,29 @@ int Guardian_thread::stop_guard(Instance *instance)
|
||||
1 - error occured
|
||||
*/
|
||||
|
||||
int Guardian_thread::stop_instances(bool stop_instances_arg)
|
||||
int Guardian_thread::stop_instances()
|
||||
{
|
||||
LIST *node;
|
||||
node= guarded_instances;
|
||||
while (node != NULL)
|
||||
{
|
||||
if (!stop_instances_arg)
|
||||
GUARD_NODE *current_node= (GUARD_NODE *) node->data;
|
||||
/*
|
||||
If instance is running or was running (and now probably hanging),
|
||||
request stop.
|
||||
*/
|
||||
if (current_node->instance->is_running() ||
|
||||
(current_node->state == STARTED))
|
||||
{
|
||||
/* just forget about an instance */
|
||||
guarded_instances= list_delete(guarded_instances, node);
|
||||
/*
|
||||
This should still work fine, as we have only removed the
|
||||
node from the list. The pointer to the next one is still valid
|
||||
*/
|
||||
node= node->next;
|
||||
current_node->state= STOPPING;
|
||||
current_node->last_checked= time(NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUARD_NODE *current_node= (GUARD_NODE *) node->data;
|
||||
/*
|
||||
If instance is running or was running (and now probably hanging),
|
||||
request stop.
|
||||
*/
|
||||
if (current_node->instance->is_running() ||
|
||||
(current_node->state == STARTED))
|
||||
{
|
||||
current_node->state= STOPPING;
|
||||
current_node->last_checked= time(NULL);
|
||||
}
|
||||
else
|
||||
/* otherwise remove it from the list */
|
||||
guarded_instances= list_delete(guarded_instances, node);
|
||||
/* But try to kill it anyway. Just in case */
|
||||
current_node->instance->kill_instance(SIGTERM);
|
||||
node= node->next;
|
||||
}
|
||||
/* otherwise remove it from the list */
|
||||
guarded_instances= list_delete(guarded_instances, node);
|
||||
/* But try to kill it anyway. Just in case */
|
||||
current_node->instance->kill_instance(SIGTERM);
|
||||
node= node->next;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user