List:Commits« Previous MessageNext Message »
From:msvensson Date:September 26 2006 2:30pm
Subject:bk commit into 5.1 tree (msvensson:1.2324)
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, 2006-09-26 16:30:50+02:00, msvensson@neptunus.(none) +1 -0
  Merge neptunus.(none):/home/msvensson/mysql/bug18969/my51-bug18969
  into  neptunus.(none):/home/msvensson/mysql/mysql-5.1-new-maint
  MERGE: 1.2300.55.2

  mysql-test/mysql-test-run.pl@stripped, 2006-09-26 16:30:45+02:00, msvensson@neptunus.(none) +0 -0
    Auto merged
    MERGE: 1.183.1.2

# 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:	neptunus.(none)
# Root:	/home/msvensson/mysql/mysql-5.1-new-maint/RESYNC

--- 1.184/mysql-test/mysql-test-run.pl	2006-09-26 16:30:55 +02:00
+++ 1.185/mysql-test/mysql-test-run.pl	2006-09-26 16:30:55 +02:00
@@ -256,7 +256,7 @@
 
 our $opt_skip;
 our $opt_skip_rpl;
-our $use_slaves;
+our $max_slave_num= 0;
 our $use_innodb;
 our $opt_skip_test;
 our $opt_skip_im;
@@ -427,7 +427,13 @@
     {
       $need_ndbcluster||= $test->{ndb_test};
       $need_im||= $test->{component_id} eq 'im';
-      $use_slaves||= $test->{slave_num};
+
+      # Count max number of slaves used by a test case
+      if ( $test->{slave_num} > $max_slave_num)
+      {
+	$max_slave_num= $test->{slave_num};
+	mtr_error("Too many slaves") if $max_slave_num > 3;
+      }
       $use_innodb||= $test->{'innodb_test'};
     }
     $opt_skip_ndbcluster= $opt_skip_ndbcluster_slave= 1
@@ -1122,11 +1128,9 @@
     $master->[0]->{'path_myddir'},
     $master->[1]->{'path_myddir'});
 
-  if ($use_slaves)
+  for (my $idx= 0; $idx < $max_slave_num; $idx++)
   {
-    push @data_dir_lst, ($slave->[0]->{'path_myddir'},
-                         $slave->[1]->{'path_myddir'},
-                         $slave->[2]->{'path_myddir'});
+    push(@data_dir_lst, $slave->[$idx]->{'path_myddir'});
   }
 
   unless ($opt_skip_im)
@@ -2260,11 +2264,10 @@
   # FIXME check if testcase really is using second master
   copy_install_db('master', $master->[1]->{'path_myddir'});
 
-  if ( $use_slaves )
+  # Install the number of slave databses needed
+  for (my $idx= 0; $idx < $max_slave_num; $idx++)
   {
-    install_db('slave1',  $slave->[0]->{'path_myddir'});
-    install_db('slave2',  $slave->[1]->{'path_myddir'});
-    install_db('slave3',  $slave->[2]->{'path_myddir'});
+    copy_install_db("slave".($idx+1), $slave->[$idx]->{'path_myddir'});
   }
 
   if ( ! $opt_skip_im )
@@ -2275,7 +2278,7 @@
   my $cluster_started_ok= 1; # Assume it can be started
 
   if (ndbcluster_start_install($clusters->[0]) ||
-      $use_slaves && ndbcluster_start_install($clusters->[1]))
+      $max_slave_num && ndbcluster_start_install($clusters->[1]))
   {
     mtr_warning("Failed to start install of cluster");
     $cluster_started_ok= 0;
@@ -2495,6 +2498,28 @@
   }
 }
 
+
+
+#
+# Restore snapshot of the installed slave databases
+# if the snapshot exists
+#
+sub restore_slave_databases ($) {
+  my ($num_slaves)= @_;
+
+  if ( -d $path_snapshot)
+  {
+    for (my $idx= 0; $idx < $num_slaves; $idx++)
+    {
+      my $data_dir= $slave->[$idx]->{'path_myddir'};
+      my $name= basename($data_dir);
+      rmtree($data_dir);
+      mtr_copy_dir("$path_snapshot/$name", $data_dir);
+    }
+  }
+}
+
+
 sub run_testcase_check_skip_test($)
 {
   my ($tinfo)= @_;
@@ -2602,7 +2627,6 @@
   {
     run_testcase_stop_servers($tinfo, $master_restart, $slave_restart);
   }
-
   my $died= mtr_record_dead_children();
   if ($died or $master_restart or $slave_restart)
   {
@@ -3628,6 +3652,8 @@
   if ( $tinfo->{'slave_num'} )
   {
     mtr_tofile($slave->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
+
+    restore_slave_databases($tinfo->{'slave_num'});
 
     do_before_start_slave($tname,$tinfo->{'slave_sh'});
 
Thread
bk commit into 5.1 tree (msvensson:1.2324)msvensson26 Sep