Below is the list of changes that have just been committed into a local
5.1 repository of alik. When alik does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-10-12 16:15:04+04:00, anozdrin@booka. +5 -0
Instance Manager polishing.
BitKeeper/etc/collapsed@stripped, 2006-10-12 15:43:53+04:00, anozdrin@booka. +1 -0
server-tools/instance-manager/guardian.cc@stripped, 2006-10-12 16:15:00+04:00,
anozdrin@booka. +29 -42
1. Removed unused stop_instances_arg from request_shutdown() and
stop_instances() methods.
2. Changed log-output statements so that instance name is passed
correctly (char *, not LEX_STRING)
server-tools/instance-manager/guardian.h@stripped, 2006-10-12 16:15:00+04:00,
anozdrin@booka. +2 -2
Removed unused stop_instances_arg from request_shutdown() and
stop_instances() methods.
server-tools/instance-manager/instance.cc@stripped, 2006-10-12 16:15:00+04:00,
anozdrin@booka. +9 -9
Removed unused stop_instances_arg from request_shutdown() and
stop_instances() methods.
server-tools/instance-manager/manager.cc@stripped, 2006-10-12 16:15:00+04:00,
anozdrin@booka. +1 -2
Removed unused stop_instances argument.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: anozdrin
# Host: booka.
# Root: /home/alik/MySQL/devel/5.1-rt-bug17486
--- 1.8/BitKeeper/etc/collapsed 2006-10-12 16:15:13 +04:00
+++ 1.9/BitKeeper/etc/collapsed 2006-10-12 16:15:13 +04:00
@@ -7,3 +7,4 @@
4513d8e4Af4dQWuk13sArwofRgFDQw
4519a6c5BVUxEHTf5iJnjZkixMBs8g
451ab499rgdjXyOnUDqHu-wBDoS-OQ
+452e259b-vTaer9xCThAiMN4cNsDDw
--- 1.35/server-tools/instance-manager/manager.cc 2006-10-12 16:15:13 +04:00
+++ 1.36/server-tools/instance-manager/manager.cc 2006-10-12 16:15:13 +04:00
@@ -323,8 +323,7 @@ void manager()
{
if (!guardian_thread.is_stopped())
{
- bool stop_instances= TRUE;
- guardian_thread.request_shutdown(stop_instances);
+ guardian_thread.request_shutdown();
pthread_cond_signal(&guardian_thread.COND_guardian);
}
else
--- 1.25/server-tools/instance-manager/guardian.cc 2006-10-12 16:15:13 +04:00
+++ 1.26/server-tools/instance-manager/guardian.cc 2006-10-12 16:15:13 +04:00
@@ -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(I
{
/* 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.str);
current_node->restart_counter= 0;
current_node->crash_moment= 0;
current_node->state= STARTED;
@@ -168,8 +168,8 @@ void Guardian_thread::process_instance(I
{
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.str);
/* NOTE, set state to STARTING _before_ start() is called */
current_node->state= STARTING;
@@ -193,8 +193,8 @@ void Guardian_thread::process_instance(I
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.str);
}
}
else
@@ -211,14 +211,15 @@ void Guardian_thread::process_instance(I
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.str);
}
}
else
{
- log_info("guardian: cannot start instance %s. Abandoning attempts "
- "to (re)start it", instance->options.instance_name);
+ log_info("guardian: cannot start instance '%s'. "
+ "Abandoning attempts to (re)start it",
+ (const char *) instance->options.instance_name.str);
current_node->state= CRASHED_AND_ABANDONED;
}
}
@@ -414,7 +415,6 @@ int Guardian_thread::stop_guard(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.
@@ -429,42 +429,29 @@ int Guardian_thread::stop_guard(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;
}
--- 1.13/server-tools/instance-manager/guardian.h 2006-10-12 16:15:13 +04:00
+++ 1.14/server-tools/instance-manager/guardian.h 2006-10-12 16:15:13 +04:00
@@ -91,7 +91,7 @@ public:
/* Initialize or refresh the list of guarded instances */
int init();
/* Request guardian shutdown. Stop instances if needed */
- void request_shutdown(bool stop_instances);
+ void request_shutdown();
/* Start instance protection */
int guard(Instance *instance, bool nolock= FALSE);
/* Stop instance protection */
@@ -123,7 +123,7 @@ public:
private:
/* Prepares Guardian shutdown. Stops instances is needed */
- int stop_instances(bool stop_instances_arg);
+ int stop_instances();
/* check instance state and act accordingly */
void process_instance(Instance *instance, GUARD_NODE *current_node,
LIST **guarded_instances, LIST *elem);
--- 1.38/server-tools/instance-manager/instance.cc 2006-10-12 16:15:13 +04:00
+++ 1.39/server-tools/instance-manager/instance.cc 2006-10-12 16:15:13 +04:00
@@ -165,8 +165,8 @@ static int start_process(Instance_option
/* exec never returns */
exit(1);
case -1:
- log_info("cannot create a new process to start instance %s",
- instance_options->instance_name);
+ log_info("cannot create a new process to start instance '%s'",
+ (const char *) instance_options->instance_name.str);
return 1;
}
return 0;
@@ -256,7 +256,7 @@ static void start_and_monitor_instance(I
are using is destroyed. (E.g. by "FLUSH INSTANCES")
*/
- log_info("starting instance %s", (const char *) instance_name.get_c_str());
+ log_info("starting instance '%s'", (const char *) instance_name.get_c_str());
if (start_process(old_instance_options, &process_info))
{
@@ -311,9 +311,9 @@ void Instance::remove_pid()
int pid;
if ((pid= options.get_pid()) != 0) /* check the pidfile */
if (options.unlink_pidfile()) /* remove stalled pidfile */
- log_error("cannot remove pidfile for instance %i, this might be \
- since IM lacks permmissions or hasn't found the pidifle",
- options.instance_name);
+ log_error("cannot remove pidfile for instance '%s', this might be "
+ "since IM lacks permmissions or hasn't found the pidifle",
+ (const char *) options.instance_name.str);
}
@@ -616,10 +616,10 @@ void Instance::kill_instance(int signum)
/* Kill suceeded */
if (signum == SIGKILL) /* really killed instance with SIGKILL */
{
- log_error("The instance %s is being stopped forcibly. Normally" \
- "it should not happen. Probably the instance has been" \
+ log_error("The instance '%s' is being stopped forcibly. Normally"
+ "it should not happen. Probably the instance has been"
"hanging. You should also check your IM setup",
- options.instance_name);
+ (const char *) options.instance_name.str);
/* After sucessful hard kill the pidfile need to be removed */
options.unlink_pidfile();
}
| Thread |
|---|
| • bk commit into 5.1 tree (anozdrin:1.2349) | Alexander Nozdrin | 12 Oct |