Commit e9843a85 authored by Magnus Blåudd's avatar Magnus Blåudd

mtr.pl fixes for ndb

  - Support for graceful shutdown of cluster by using "ndb_mgm -e 'shutdown'"
parent 79173ada
......@@ -294,6 +294,7 @@ my $exe_ndbd;
my $exe_ndbmtd;
my $exe_ndb_mgmd;
my $exe_ndb_waiter;
my $exe_ndb_mgm;
our $debug_compiled_binaries;
......@@ -1839,6 +1840,11 @@ sub executable_setup () {
["storage/ndb/src/mgmsrv", "libexec", "sbin", "bin"],
"ndb_mgmd");
$exe_ndb_mgm=
my_find_bin($bindir,
["storage/ndb/src/mgmclient", "bin"],
"ndb_mgm");
$exe_ndb_waiter=
my_find_bin($bindir,
["storage/ndb/tools/", "bin"],
......@@ -2644,6 +2650,27 @@ sub ndb_mgmd_wait_started($) {
return 1;
}
sub ndb_mgmd_stop{
my $ndb_mgmd= shift or die "usage: ndb_mgmd_stop(<ndb_mgmd>)";
my $host=$ndb_mgmd->value('HostName');
my $port=$ndb_mgmd->value('PortNumber');
mtr_verbose("Stopping cluster '$host:$port'");
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--ndb-connectstring=%s:%s", $host,$port);
mtr_add_arg($args, "-e");
mtr_add_arg($args, "shutdown");
My::SafeProcess->run
(
name => "ndb_mgm shutdown $host:$port",
path => $exe_ndb_mgm,
args => \$args,
output => "/dev/null",
);
}
sub ndb_mgmd_start ($$) {
my ($cluster, $ndb_mgmd)= @_;
......@@ -2671,6 +2698,7 @@ sub ndb_mgmd_start ($$) {
error => $path_ndb_mgmd_log,
append => 1,
verbose => $opt_verbose,
shutdown => sub { ndb_mgmd_stop($ndb_mgmd) },
);
mtr_verbose("Started $ndb_mgmd->{proc}");
......@@ -2686,6 +2714,11 @@ sub ndb_mgmd_start ($$) {
return 0;
}
sub ndbd_stop {
# Intentionally left empty, ndbd nodes will be shutdown
# by sending "shutdown" to ndb_mgmd
}
my $exe_ndbmtd_counter= 0;
sub ndbd_start {
......@@ -2721,6 +2754,7 @@ sub ndbd_start {
error => $path_ndbd_log,
append => 1,
verbose => $opt_verbose,
shutdown => sub { ndbd_stop($ndbd) },
);
mtr_verbose("Started $proc");
......
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