31
31
sub mtr_wait_blocking ($);
32
32
sub mtr_record_dead_children ();
33
33
sub mtr_ndbmgm_start($$);
34
sub mtr_mysqladmin_start($$$);
36
35
sub sleep_until_file_created ($$$);
37
36
sub mtr_kill_processes ($);
360
359
"socket: '$srv->{path_sock}'; ".
361
360
"port: $srv->{port})");
363
my $pid= mtr_mysqladmin_start($srv, "shutdown", 20);
362
my $pid= mtr_server_shutdown($srv);
365
# Save the pid of the mysqladmin process
364
# Save the pid of the drizzle client process
366
365
$admin_pids{$pid}= 1;
368
367
push(@kill_pids,{
374
373
$srv->{'pid'}= 0; # Assume we are done with it
377
if ( ! $::opt_skip_ndbcluster )
380
foreach my $cluster (@{$::clusters})
383
# Don't shut down a "running" cluster
384
next if $cluster->{'use_running'};
386
mtr_debug(" - cluster " .
387
"(pid: $cluster->{pid}; " .
388
"pid file: '$cluster->{path_pid})");
390
my $pid= mtr_ndbmgm_start($cluster, "shutdown");
392
# Save the pid of the ndb_mgm process
393
$admin_pids{$pid}= 1;
396
pid => $cluster->{'pid'},
397
pidfile => $cluster->{'path_pid'}
400
$cluster->{'pid'}= 0; # Assume we are done with it
402
foreach my $ndbd (@{$cluster->{'ndbds'}})
404
mtr_debug(" - ndbd " .
405
"(pid: $ndbd->{pid}; " .
406
"pid file: '$ndbd->{path_pid})");
409
pid => $ndbd->{'pid'},
410
pidfile => $ndbd->{'path_pid'},
412
$ndbd->{'pid'}= 0; # Assume we are done with it
417
376
# Wait for all the admin processes to complete
418
377
mtr_wait_blocking(\%admin_pids);
563
522
# many process's will exit sucessfully.
564
523
# This is the normal case.
565
524
# ----------------------------------------------------------------------
566
my $wait_counter= 50; # Max number of times to redo the loop
525
my $wait_counter= 100; # Max number of times to redo the loop
567
526
foreach my $srv ( @$spec )
569
528
my $pid= $srv->{'pid'};
716
# Start "mysqladmin <command>" for a specific mysqld
717
sub mtr_mysqladmin_start($$$) {
675
sub mtr_server_shutdown($) {
720
my $adm_shutdown_tmo= shift;
723
679
mtr_init_args(\$args);
725
mtr_add_arg($args, "--no-defaults");
680
mtr_add_arg($args, "--shutdown");
726
681
mtr_add_arg($args, "--user=%s", $::opt_user);
727
682
mtr_add_arg($args, "--password=");
728
683
mtr_add_arg($args, "--silent");
729
685
if ( -e $srv->{'path_sock'} )
731
687
mtr_add_arg($args, "--socket=%s", $srv->{'path_sock'});
733
690
if ( $srv->{'port'} )
735
692
mtr_add_arg($args, "--port=%s", $srv->{'port'});
737
695
mtr_add_arg($args, "--connect_timeout=5");
739
# Shutdown time must be high as slave may be in reconnect
740
mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo");
741
mtr_add_arg($args, "$command");
742
my $pid= mtr_spawn($::exe_drizzleadmin, $args,
744
{ append_log_file => 1 });
745
mtr_verbose("mtr_mysqladmin_start, pid: $pid");
697
my $pid= mtr_spawn($::exe_drizzle, $args,
698
"", "", "", "", { append_log_file => 1 });
699
mtr_verbose("mtr_server_shutdown, pid: $pid");
750
703
# Start "ndb_mgm shutdown" for a specific cluster, it will