Commit 4e55c9a1 authored by mats@kindahl-laptop.dnsalias.net's avatar mats@kindahl-laptop.dnsalias.net
Browse files

Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl

into  kindahl-laptop.dnsalias.net:/home/bkroot/mysql-5.1-rpl
parents f5106b3f 3f7bf588
Loading
Loading
Loading
Loading
+67 −2
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
########### Clean up ################
--disable_warnings
--disable_query_log
DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17;
DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t14a,t15,t16,t17;
--enable_query_log
--enable_warnings

@@ -662,6 +662,68 @@ sync_slave_with_master;
--replace_column 7 CURRENT_TIMESTAMP
SELECT * FROM t14 ORDER BY c1;

####################################################
# - Alter Master drop column at end of table      #
#   Expect: column dropped                        #
####################################################

--echo *** Create t14a on slave  ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t14a (c1 INT KEY, c4 BLOB, c5 CHAR(5),
                      c6 INT DEFAULT '1',
                      c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
                      )ENGINE=$engine_type;

--echo *** Create t14a on Master ***
connection master;
eval CREATE TABLE t14a (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
                       ) ENGINE=$engine_type;
RESET MASTER;

--echo *** Start Slave ***
connection slave;
START SLAVE;

--echo *** Master Data Insert ***
connection master;
set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t14a () VALUES(1,@b1,'Kyle'),
                        (2,@b1,'JOE'),
                        (3,@b1,'QA');

SELECT * FROM t14a ORDER BY c1;
--echo *** Select on Slave ****
sync_slave_with_master;
--replace_column 5 CURRENT_TIMESTAMP
SELECT * FROM t14a ORDER BY c1;
STOP SLAVE;
RESET SLAVE;

--echo *** Master Drop c5 ***
connection master;
ALTER TABLE t14a DROP COLUMN c5;
RESET MASTER;

--echo *** Start Slave ***
connection slave;
START SLAVE;

--echo *** Master Data Insert ***
connection master;
set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);

INSERT INTO t14a () VALUES(4,@b1),
                        (5,@b1),
                        (6,@b1);
SELECT * FROM t14a ORDER BY c1;

--echo *** Select on Slave ****
sync_slave_with_master;
--replace_column 5 CURRENT_TIMESTAMP
SELECT * FROM t14a ORDER BY c1;

####################################################
# - Alter Master Dropping columns from the middle. #
@@ -858,7 +920,10 @@ sync_slave_with_master;
#### Clean Up ####
--disable_warnings
--disable_query_log
DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17;
connection master;
DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t14a,t15,t16,t17;
sync_slave_with_master;
connection master;
--enable_query_log
--enable_warnings

+8 −6
Original line number Diff line number Diff line

--disable_query_log
--disable_warnings
connection slave;
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
connection master;
--disable_warnings
DROP TABLE IF EXISTS t1;
RESET MASTER;
--enable_warnings
connection slave;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
RESET SLAVE;
START SLAVE;
--enable_warnings
--enable_query_log

--echo **** On Master ****
connection master;
@@ -38,3 +37,6 @@ connection master;
DROP TABLE t1;
let $SERVER_VERSION=`select version()`;
source include/show_binlog_events.inc;

connection master;
RESET MASTER;
+99 −0
Original line number Diff line number Diff line
@@ -214,17 +214,44 @@ sub collect_one_suite($$)

  mtr_verbose("Collecting: $suite");

  my $combination_file=  "combinations";
  my $combinations = [];

  my $suitedir= "$::glob_mysql_test_dir"; # Default
  my $combination_file= "$::glob_mysql_test_dir/$combination_file";
  if ( $suite ne "main" )
  {
    $suitedir= mtr_path_exists("$suitedir/suite/$suite",
			       "$suitedir/$suite");
    mtr_verbose("suitedir: $suitedir");
    $combination_file= "$suitedir/$combination_file";
  }

  my $testdir= "$suitedir/t";
  my $resdir=  "$suitedir/r";

  if (!@::opt_combination) 
  {
    # Read combinations file
    if ( open(COMB,$combination_file) )
    {
      while (<COMB>)
      {
        chomp;
        s/\ +/ /g;
        push (@$combinations, $_) unless ($_ eq '');
      }
      close COMB;
    }
  }
  else
  {
    # take the combination from command-line
    @$combinations = @::opt_combination;
  }
  # Remember last element position
  my $begin_index = $#{@$cases} + 1;

  # ----------------------------------------------------------------------
  # Build a hash of disabled testcases for this suite
  # ----------------------------------------------------------------------
@@ -335,6 +362,78 @@ sub collect_one_suite($$)
    closedir TESTDIR;
  }

  # ----------------------------------------------------------------------
  # Proccess combinations only if new tests were added
  # ----------------------------------------------------------------------
  if ($combinations && $begin_index <= $#{@$cases}) 
  { 
    my $end_index = $#{@$cases};
    my $is_copy;
    # Keep original master/slave options
    my @orig_opts;
    for (my $idx = $begin_index; $idx <= $end_index; $idx++) 
    {
      foreach my $param (('master_opt','slave_opt','slave_mi')) 
      {
        @{$orig_opts[$idx]{$param}} = @{$cases->[$idx]->{$param}};        
      }
    }
    my $comb_index = 1;
    # Copy original test cases 
    foreach my $comb_set (@$combinations)
    {  
      for (my $idx = $begin_index; $idx <= $end_index; $idx++) 
      {
        my $test = $cases->[$idx];
        my $copied_test = {};
        foreach my $param (keys %{$test}) 
        {
          # Scalar. Copy as is.
          $copied_test->{$param} = $test->{$param};
          # Array. Copy reference instead itself
          if ($param =~ /(master_opt|slave_opt|slave_mi)/) 
          {
            my $new_arr = [];
            @$new_arr = @{$orig_opts[$idx]{$param}};
            $copied_test->{$param} = $new_arr;
          }
          elsif ($param =~ /(comment|combinations)/) 
          {
            $copied_test->{$param} = '';
          }
        }
        if ($is_copy) 
        {
          push(@$cases, $copied_test);
          $test = $cases->[$#{@$cases}];
        }
        foreach my $comb_opt (split(/ /,$comb_set)) 
        {
          push(@{$test->{'master_opt'}},$comb_opt);
          push(@{$test->{'slave_opt'}},$comb_opt);
          # Enable rpl if added option is --binlog-format and test case supports that
          if ($comb_opt =~ /^--binlog-format=.+$/) 
          {
            my @opt_pairs = split(/=/, $comb_opt);
            if ($test->{'binlog_format'} =~ /^$opt_pairs[1]$/ || $test->{'binlog_format'} eq '') 
            {
              $test->{'skip'} = 0;
              $test->{'comment'} = '';
            }
            else
            {
              $test->{'skip'} = 1;
              $test->{'comment'} = "Requiring binlog format '$test->{'binlog_format'}'";;
            } 
          }
        }
        $test->{'combination'} = $comb_set;
      } 
      $is_copy = 1;
      $comb_index++;
    }    
  }

  return $cases;
}

+5 −0
Original line number Diff line number Diff line
@@ -164,6 +164,8 @@ our $opt_bench= 0;
our $opt_small_bench= 0;
our $opt_big_test= 0;

our @opt_combination;

our @opt_extra_mysqld_opt;

our $opt_compress;
@@ -529,6 +531,7 @@ sub command_line_setup () {
             'skip-im'                  => \$opt_skip_im,
             'skip-test=s'              => \$opt_skip_test,
             'big-test'                 => \$opt_big_test,
             'combination=s'            => \@opt_combination,

             # Specify ports
             'master_port=i'            => \$opt_master_myport,
@@ -5134,6 +5137,8 @@ Options to control what test suites or cases to run
  skip-im               Don't start IM, and skip the IM test cases
  big-test              Set the environment variable BIG_TEST, which can be
                        checked from test cases.
  combination="ARG1 .. ARG2" Specify a set of "mysqld" arguments for one 
                        combination. 

Options that specify ports

+32 −23
Original line number Diff line number Diff line
@@ -17,8 +17,7 @@ update t1 set b=11 where a=2;
update t1 set b=b+10;
kill query ID;
rollback;
ERROR 70100: Query execution was interrupted
select * from t1 /* must be the same as before (1,1),(2,2) */;
select * from t1  order by a /* must be the same as before (1,1),(2,2) */;
a	b
1	1
2	2
@@ -27,8 +26,7 @@ delete from t1 where a=2;
delete from t1 where a=2;
kill query ID;
rollback;
ERROR 70100: Query execution was interrupted
select * from t1 /* must be the same as before (1,1),(2,2) */;
select * from t1 order by a /* must be the same as before (1,1),(2,2) */;
a	b
1	1
2	2
@@ -41,39 +39,45 @@ begin;
insert into t1 select * from t4 for update;
kill query ID;
rollback;
ERROR 70100: Query execution was interrupted
rollback;
select * from t1 /* must be the same as before (1,1),(2,2) */;
a	b
1	1
2	2
drop table t4;
create table t4 (a int, b int) ENGINE=MyISAM /* for killing update and delete */;
create function bug27563(n int) 
RETURNS int(11)
DETERMINISTIC
begin
if n > 1 then
if @b > 0 then
select get_lock("a", 10)  into @a;
else 
set @b= 1;
end if;
return n;
end|
delete from t2;
insert into t2 values (1,1), (2,2);
delete from t4;
insert into t4 values (1,1), (1,1);
reset master;
select get_lock("a", 20);
get_lock("a", 20)
1
update t2 set b=b + bug27563(b) order by a;
set @b= 0;
update t4 set b=b + bug27563(b);
kill query ID;
ERROR 70100: Query execution was interrupted
select * from t2 /* must be (1,2), (2,2) */;
select * from t4 order by b /* must be (1,1), (1,2) */;
a	b
1	1
1	2
2	2
must have the update event more to FD
select @b  /* must be 1 at the end of a stmt calling bug27563() */;
@b
1
must have the update query event more to FD
show binlog events from <binlog_start>;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000001	#	Query	#	#	use `test`; update t2 set b=b + bug27563(b) order by a
master-bin.000001	#	User var	#	#	@`b`=0
master-bin.000001	#	Query	#	#	use `test`; update t4 set b=b + bug27563(b)
select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
is not null;
@@ -86,22 +90,26 @@ select 0 /* must return 0 to mean the killed query is in */;
select RELEASE_LOCK("a");
RELEASE_LOCK("a")
1
delete from t2;
insert into t2 values (1,1), (2,2);
delete from t4;
insert into t4 values (1,1), (2,2);
reset master;
select get_lock("a", 20);
get_lock("a", 20)
1
delete from t2 where a=1 or a=bug27563(2) order by a;
set @b= 0;
delete from t4 where b=bug27563(1) or b=bug27563(2);
kill query ID;
ERROR 70100: Query execution was interrupted
select * from t2 /* must be (1,2), (2,2) */;
a	b
1	1
2	2
must have the update event more to FD
select count(*) from t4 /* must be 1 */;
count(*)
1
select @b  /* must be 1 at the end of a stmt calling bug27563() */;
@b
1
must have the delete query event more to FD
show binlog events from <binlog_start>;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000001	#	User var	#	#	@`b`=0
master-bin.000001	#	Query	#	#	use `test`; delete from t4 where b=bug27563(1) or b=bug27563(2)
select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
is not null;
@@ -114,6 +122,7 @@ select 0 /* must return 0 to mean the killed query is in */;
select RELEASE_LOCK("a");
RELEASE_LOCK("a")
1
drop table t4;
drop function bug27563;
drop table t1,t2,t3;
end of the tests
Loading