MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:msvensson Date:June 1 2007 12:32pm
Subject:bk commit into 5.1 tree (msvensson:1.2517) BUG#24168
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-06-01 14:32:26+02:00, msvensson@pilot.(none) +2 -0
  Bug #24168 mysql-test-run not functioning in autotest (cannot use external cluster)
   - Removed the global variable(s) glob_use_running_cluster/slave
     and put a property on each "cluster" called "use_running" which
     is set to 1 if user passed either ndb_connectstring or 
     ndb_connectstring_slave. Thus mtr.pl should not start/stop the
     cluster.

  mysql-test/lib/mtr_process.pl@stripped, 2007-06-01 14:32:25+02:00, msvensson@pilot.(none) +4 -2
    Removed the global variable(s) glob_use_running_cluster/slave
    and put a property on each "cluster" called "use_running" which
    is set to 1 if user passed either ndb_connectstring or 
    ndb_connectstring_slave. Thus mtr.pl should not start/stop the
    cluster

  mysql-test/mysql-test-run.pl@stripped, 2007-06-01 14:32:25+02:00, msvensson@pilot.(none) +75 -64
    Removed the global variable(s) glob_use_running_cluster/slave
    and put a property on each "cluster" called "use_running" which
    is set to 1 if user passed either ndb_connectstring or 
    ndb_connectstring_slave. Thus mtr.pl should not start/stop the
    cluster

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	msvensson
# Host:	pilot.(none)
# Root:	/data/msvensson/mysql/my51-m-bug24168

--- 1.73/mysql-test/lib/mtr_process.pl	2007-04-23 13:28:06 +02:00
+++ 1.74/mysql-test/lib/mtr_process.pl	2007-06-01 14:32:25 +02:00
@@ -385,11 +385,13 @@ sub mtr_kill_leftovers () {
 
   if ( ! $::opt_skip_ndbcluster )
   {
-    # Start shutdown of clusters.
-    mtr_debug("Shutting down cluster...");
 
     foreach my $cluster (@{$::clusters})
     {
+
+      # Don't shut down a "running" cluster
+      next if $cluster->{'use_running'};
+
       mtr_debug("  - cluster " .
 		"(pid: $cluster->{pid}; " .
 		"pid file: '$cluster->{path_pid})");

--- 1.307/mysql-test/mysql-test-run.pl	2007-05-29 13:02:17 +02:00
+++ 1.308/mysql-test/mysql-test-run.pl	2007-06-01 14:32:25 +02:00
@@ -104,8 +104,6 @@ our $glob_mysql_bench_dir=        undef;
 our $glob_hostname=               undef;
 our $glob_scriptname=             undef;
 our $glob_timers=                 undef;
-our $glob_use_running_ndbcluster= 0;
-our $glob_use_running_ndbcluster_slave= 0;
 our $glob_use_embedded_server=    0;
 our @glob_test_mode;
 
@@ -930,40 +928,6 @@ sub command_line_setup () {
   }
 
   # --------------------------------------------------------------------------
-  # Ndb cluster flags
-  # --------------------------------------------------------------------------
-
-  if ( $opt_ndbconnectstring )
-  {
-    $glob_use_running_ndbcluster= 1;
-    mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster")
-      if $opt_skip_ndbcluster;
-    mtr_error("Can't specify --ndb-connectstring and --ndbcluster-port")
-      if $opt_ndbcluster_port;
-  }
-  else
-  {
-    # Set default connect string
-    $opt_ndbconnectstring= "host=localhost:$opt_ndbcluster_port";
-  }
-
-  if ( $opt_ndbconnectstring_slave )
-  {
-      $glob_use_running_ndbcluster_slave= 1;
-      mtr_error("Can't specify ndb-connectstring_slave and " .
-		"--skip-ndbcluster-slave")
-	if $opt_skip_ndbcluster;
-      mtr_error("Can't specify --ndb-connectstring-slave and " .
-		"--ndbcluster-port-slave")
-	if $opt_ndbcluster_port_slave;
-  }
-  else
-  {
-    # Set default connect string
-    $opt_ndbconnectstring_slave= "host=localhost:$opt_ndbcluster_port_slave";
-  }
-
-  # --------------------------------------------------------------------------
   # Bench flags
   # --------------------------------------------------------------------------
   if ( $opt_small_bench )
@@ -1206,7 +1170,7 @@ sub command_line_setup () {
    nodes           => 2,
    port            => "$opt_ndbcluster_port",
    data_dir        => "$data_dir",
-   connect_string  => "$opt_ndbconnectstring",
+   connect_string  => "host=localhost:$opt_ndbcluster_port",
    path_pid        => "$data_dir/ndb_3.pid", # Nodes + 1
    pid             => 0, # pid of ndb_mgmd
    installed_ok    => 0,
@@ -1219,7 +1183,7 @@ sub command_line_setup () {
    nodes           => 1,
    port            => "$opt_ndbcluster_port_slave",
    data_dir        => "$data_dir",
-   connect_string  => "$opt_ndbconnectstring_slave",
+   connect_string  => "host=localhost:$opt_ndbcluster_port_slave",
    path_pid        => "$data_dir/ndb_2.pid", # Nodes + 1
    pid             => 0, # pid of ndb_mgmd
    installed_ok    => 0,
@@ -1241,6 +1205,9 @@ sub command_line_setup () {
     }
   }
 
+  # --------------------------------------------------------------------------
+  # extern
+  # --------------------------------------------------------------------------
   if ( $opt_extern )
   {
     # Turn off features not supported when running with extern server
@@ -1257,6 +1224,38 @@ sub command_line_setup () {
       if $opt_socket;
   }
 
+
+  # --------------------------------------------------------------------------
+  # ndbconnectstring and ndbconnectstring_slave
+  # --------------------------------------------------------------------------
+  if ( $opt_ndbconnectstring )
+  {
+    # ndbconnectstring was supplied by user, the tests shoudl be run
+    # against an already started cluster, change settings
+    my $cluster= $clusters->[0]; # Master cluster
+    $cluster->{'connect_string'}= $opt_ndbconnectstring;
+    $cluster->{'use_running'}= 1;
+
+    mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster")
+      if $opt_skip_ndbcluster;
+  }
+  $ENV{'NDB_CONNECTSTRING'}= $clusters->[0]->{'connect_string'};
+
+
+  if ( $opt_ndbconnectstring_slave )
+  {
+    # ndbconnectstring-slave was supplied by user, the tests should be run
+    # agains an already started slave cluster, change settings
+    my $cluster= $clusters->[1]; # Slave cluster
+    $cluster->{'connect_string'}= $opt_ndbconnectstring_slave;
+    $cluster->{'use_running'}= 1;
+
+    mtr_error("Can't specify ndb-connectstring_slave and " .
+	      "--skip-ndbcluster-slave")
+      if $opt_skip_ndbcluster_slave;
+  }
+
+
   $path_timefile=  "$opt_vardir/log/mysqltest-time";
   $path_mysqltest_log=  "$opt_vardir/log/mysqltest.log";
   $path_current_test_log= "$opt_vardir/log/current_test";
@@ -1860,7 +1859,6 @@ sub environment_setup () {
     $ENV{'NDB_DATA_DIR'}=             $clusters->[0]->{'data_dir'};
     $ENV{'NDB_TOOLS_DIR'}=            $path_ndb_tools_dir;
     $ENV{'NDB_TOOLS_OUTPUT'}=         $path_ndb_testrun_log;
-    $ENV{'NDB_CONNECTSTRING'}=        $opt_ndbconnectstring;
 
     if ( $mysql_version_id >= 50000 )
     {
@@ -2688,7 +2686,7 @@ sub ndbcluster_start ($$) {
 
   mtr_verbose("ndbcluster_start '$cluster->{'name'}'");
 
-  if ( $glob_use_running_ndbcluster )
+  if ( $cluster->{'use_running'} )
   {
     return 0;
   }
@@ -2905,30 +2903,34 @@ sub mysql_install_db () {
 
   my $cluster_started_ok= 1; # Assume it can be started
 
-  if ($opt_skip_ndbcluster || $glob_use_running_ndbcluster ||
-      $clusters->[0]->{executable_setup_failed})
+  my $cluster= $clusters->[0]; # Master cluster
+  if ($opt_skip_ndbcluster ||
+      $cluster->{'use_running'} ||
+      $cluster->{executable_setup_failed})
   {
     # Don't install master cluster
   }
-  elsif (ndbcluster_start_install($clusters->[0]))
+  elsif (ndbcluster_start_install($cluster))
   {
-    mtr_warning("Failed to start install of $clusters->[0]->{name}");
+    mtr_warning("Failed to start install of $cluster->{name}");
     $cluster_started_ok= 0;
   }
 
+  $cluster= $clusters->[1]; # Slave cluster
   if ($max_slave_num == 0 ||
-      $opt_skip_ndbcluster_slave || $glob_use_running_ndbcluster_slave ||
-      $clusters->[1]->{executable_setup_failed})
+      $opt_skip_ndbcluster_slave ||
+      $cluster->{'use_running'} ||
+      $cluster->{executable_setup_failed})
   {
     # Don't install slave cluster
   }
-  elsif (ndbcluster_start_install($clusters->[1]))
+  elsif (ndbcluster_start_install($cluster))
   {
-    mtr_warning("Failed to start install of $clusters->[1]->{name}");
+    mtr_warning("Failed to start install of $cluster->{name}");
     $cluster_started_ok= 0;
   }
 
-  foreach my $cluster (@{$clusters})
+  foreach $cluster (@{$clusters})
   {
 
     next if !$cluster->{'pid'};
@@ -3203,9 +3205,16 @@ sub run_testcase_check_skip_test($)
   {
     foreach my $cluster (@{$clusters})
     {
+      # Slave cluster is skipped and thus not
+      # installed, no need to perform checks
       last if ($opt_skip_ndbcluster_slave and
 	       $cluster->{'name'} eq 'Slave');
 
+      # Using running cluster - no need
+      # to check if test should be skipped
+      # will be done by test itself
+      last if ($cluster->{'use_running'});
+
       # If test needs this cluster, check binaries was found ok
       if ( $cluster->{'executable_setup_failed'} )
       {
@@ -3819,12 +3828,8 @@ sub mysqld_arguments ($$$$) {
     }
 
     my $cluster= $clusters->[$mysqld->{'cluster'}];
-    if ( $opt_skip_ndbcluster ||
-	 !$cluster->{'pid'})
-    {
-      mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
-    }
-    else
+    if ( $cluster->{'pid'} ||           # Cluster is started
+	 $cluster->{'use_running'} )    # Using running cluster
     {
       mtr_add_arg($args, "%s--ndbcluster", $prefix);
       mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
@@ -3834,6 +3839,10 @@ sub mysqld_arguments ($$$$) {
 	mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
       }
     }
+    else
+    {
+      mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
+    }
 
       mtr_add_arg($args, "%s--plugin_dir=%s", $prefix,
 		  dirname($lib_example_plugin));
@@ -3892,23 +3901,24 @@ sub mysqld_arguments ($$$$) {
       mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank);
     }
 
-    if ( $opt_skip_ndbcluster_slave ||
-         $mysqld->{'cluster'} == -1 ||
-	 !$clusters->[$mysqld->{'cluster'}]->{'pid'} )
-    {
-      mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
-    }
-    else
+    my $cluster= $clusters->[$mysqld->{'cluster'}];
+    if ( $cluster->{'pid'} ||         # Slave cluster is started
+	 $cluster->{'use_running'} )  # Using running slave cluster
     {
       mtr_add_arg($args, "%s--ndbcluster", $prefix);
       mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
-		  $clusters->[$mysqld->{'cluster'}]->{'connect_string'});
+		  $cluster->{'connect_string'});
 
       if ( $mysql_version_id >= 50100 )
       {
 	mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
       }
     }
+    else
+    {
+      mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
+    }
+
   } # end slave
 
   if ( $opt_debug )
@@ -4457,7 +4467,8 @@ sub run_testcase_start_servers($) {
 
     }
 
-    if ( $clusters->[0]->{'pid'} and ! $master->[1]->{'pid'} and
+    if ( $clusters->[0]->{'pid'} || $clusters->[0]->{'use_running'}
+	 and ! $master->[1]->{'pid'} and
 	 $tinfo->{'master_num'} > 1 )
     {
       # Test needs cluster, start an extra mysqld connected to cluster
Thread
bk commit into 5.1 tree (msvensson:1.2517) BUG#24168msvensson1 Jun