List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:January 17 2011 2:23pm
Subject:bzr commit into mysql-5.5-mtr branch (magnus.blaudd:3149)
View as plain text  
#At file:///home/msvensson/mysql/5.5-mtr/ based on revid:magnus.blaudd@stripped

 3149 Magnus Blåudd	2011-01-17
      mtr.pl fixes for ndb
        - Support for graceful shutdown of cluster by using "ndb_mgm -e 'shutdown'"

    modified:
      mysql-test/mysql-test-run.pl
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2011-01-17 14:20:49 +0000
+++ b/mysql-test/mysql-test-run.pl	2011-01-17 14:23:37 +0000
@@ -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");
 

Attachment: [text/bzr-bundle] bzr/magnus.blaudd@oracle.com-20110117142337-9bkwmxmety35vnew.bundle
Thread
bzr commit into mysql-5.5-mtr branch (magnus.blaudd:3149) Magnus Blåudd17 Jan