Commit 29156afc authored by unknown's avatar unknown

Support --debug/-# in instance manager.


mysql-test/mysql-test-run.pl:
  Support tracing the instance manager
server-tools/instance-manager/options.cc:
  Handle --debug/-#
server-tools/instance-manager/options.h:
  Handle --debug/-#
parent 2116b5a6
...@@ -2940,6 +2940,12 @@ sub im_start($$) { ...@@ -2940,6 +2940,12 @@ sub im_start($$) {
mtr_add_arg($args, "--defaults-file=%s", mtr_add_arg($args, "--defaults-file=%s",
$instance_manager->{'defaults_file'}); $instance_manager->{'defaults_file'});
if ( $opt_debug )
{
mtr_add_arg($args, "--debug=d:t:i:A,%s/log/im.trace",
$opt_vardir_trace);
}
foreach my $opt (@{$opts}) foreach my $opt (@{$opts})
{ {
mtr_add_arg($args, $opt); mtr_add_arg($args, $opt);
......
...@@ -57,6 +57,9 @@ uint Options::port_number= DEFAULT_PORT; ...@@ -57,6 +57,9 @@ uint Options::port_number= DEFAULT_PORT;
char **Options::saved_argv= NULL; char **Options::saved_argv= NULL;
/* Remember if the config file was forced */ /* Remember if the config file was forced */
bool Options::is_forced_default_file= 0; bool Options::is_forced_default_file= 0;
#ifndef DBUG_OFF
const char *Options::default_dbug_option= "d:t:i:O,im.trace";
#endif
/* /*
List of options, accepted by the instance manager. List of options, accepted by the instance manager.
...@@ -88,6 +91,12 @@ static struct my_option my_long_options[] = ...@@ -88,6 +91,12 @@ static struct my_option my_long_options[] =
{ "help", '?', "Display this help and exit.", { "help", '?', "Display this help and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 },
#ifndef DBUG_OFF
{"debug", '#', "Debug log.",
(gptr*) &Options::default_dbug_option, (gptr*) &Options::default_dbug_option,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{ "log", OPT_LOG, "Path to log file. Used only with --run-as-service.", { "log", OPT_LOG, "Path to log file. Used only with --run-as-service.",
(gptr *) &Options::log_file_name, (gptr *) &Options::log_file_name, (gptr *) &Options::log_file_name, (gptr *) &Options::log_file_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
...@@ -226,7 +235,7 @@ C_MODE_START ...@@ -226,7 +235,7 @@ C_MODE_START
static my_bool static my_bool
get_one_option(int optid, get_one_option(int optid,
const struct my_option *opt __attribute__((unused)), const struct my_option *opt __attribute__((unused)),
char *argument __attribute__((unused))) char *argument)
{ {
switch(optid) { switch(optid) {
case 'V': case 'V':
...@@ -238,6 +247,12 @@ get_one_option(int optid, ...@@ -238,6 +247,12 @@ get_one_option(int optid,
case '?': case '?':
usage(); usage();
exit(0); exit(0);
case '#':
#ifndef DBUG_OFF
DBUG_SET(argument ? argument : Options::default_dbug_option);
DBUG_SET_INITIAL(argument ? argument : Options::default_dbug_option);
#endif
break;
} }
return 0; return 0;
} }
......
...@@ -51,6 +51,10 @@ struct Options ...@@ -51,6 +51,10 @@ struct Options
/* argv pointer returned by load_defaults() to be used by free_defaults() */ /* argv pointer returned by load_defaults() to be used by free_defaults() */
static char **saved_argv; static char **saved_argv;
#ifndef DBUG_OFF
static const char *default_dbug_option;
#endif
int load(int argc, char **argv); int load(int argc, char **argv);
void cleanup(); void cleanup();
#ifdef __WIN__ #ifdef __WIN__
......
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