mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
mtr.pl fixes for ndb
- Support for graceful shutdown of cluster by using "ndb_mgm -e 'shutdown'"
This commit is contained in:
parent
abed4d1683
commit
d30ba619eb
1 changed files with 34 additions and 0 deletions
|
@ -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");
|
||||
|
||||
|
|
Loading…
Reference in a new issue