diff options
Diffstat (limited to 'mysql-test/suite/rpl')
75 files changed, 2165 insertions, 85 deletions
diff --git a/mysql-test/suite/rpl/extension/README.checksum b/mysql-test/suite/rpl/extension/README.checksum new file mode 100644 index 00000000000..1adcaff49ca --- /dev/null +++ b/mysql-test/suite/rpl/extension/README.checksum @@ -0,0 +1,23 @@ +Binlog checksum testing +======================= + +1. How it works. +The script copies a <suite> to directory <suite>_checksum, +collects test case names for t/ directory (except tests from +disabled def), randomly choose 90% of tests and add them +to disabled.def. +It means that mtr will run only 10% of random tests from each +suite. +At end the script run mtr: +./mysql-test-run.pl --suite=aaa_checksum,bbb_checksum \ + --mysqld=--binlog-checksum=CRC32 arg1 ... argN + +aaa,bbb - suite names from --suite option +arg1,argN - other command-line arguments of checksum.pl + +2. The options: + +--suite=suite1,suite2. Mandatory option. The list of suites for + binlog checksum testing. + +--percent=N, where N is 1..99. Percent of running tests. diff --git a/mysql-test/suite/rpl/extension/checksum.pl b/mysql-test/suite/rpl/extension/checksum.pl new file mode 100644 index 00000000000..60dca18c8f8 --- /dev/null +++ b/mysql-test/suite/rpl/extension/checksum.pl @@ -0,0 +1,164 @@ +#!/usr/bin/perl + +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +use File::Basename; +use File::Copy qw(copy); +use File::Spec qw(catdir); +use File::Path; +use IO::File; +use strict; + +# Constants and variables with default values +my $suites; +my $suffix = "_checksum"; +my $percent_random_test = 10; +my $mtr_script; +my @mtr_argv; +my @mtr_suites; + +# Check some arguments +foreach my $arg ( @ARGV ) +{ + if ($arg =~ m/\-\-suite\=(.+)/i) + { + $suites = $1; + } + elsif ($arg =~ m/\-\-percent\=(\d{1,2})/i) + { + $percent_random_test= $1; + } + else + { + push(@mtr_argv, $arg); + } + +} +if (! defined( $suites ) ) +{ + die("The script requires --suite argument"); +} + +print "#################################################################\n"; +print "# Binlog checksum testing\n"; +print "# Run randomly $percent_random_test\% of tests from following suites: $suites\n"; +print "#################################################################\n"; + +# Set extension directory +my $ext_dir= dirname(File::Spec->rel2abs($0)); +# Set mysql-test directory +my $mysql_test_dir= $ext_dir; +$mysql_test_dir =~ s/(\/|\\)suite(\/|\\)rpl(\/|\\)extension$//; + +# Main loop +foreach my $src_suite (split(",", $suites)) +{ + $src_suite=~ s/ //g; + my $dest_suite= $src_suite . $suffix; + push( @mtr_suites, $dest_suite); + print "Creating suite $dest_suite\n"; + # *** Set platform-independent pathes *** + # Set source directory of suite + my $src_suite_dir = File::Spec->catdir($mysql_test_dir, "suite", $src_suite); + # Set destination directory of suite + my $dest_suite_dir = File::Spec->catdir($mysql_test_dir, "suite", $dest_suite); + print "Copying files\n\tfrom '$src_suite_dir'\n\tto '$dest_suite_dir'\n"; + dircopy($src_suite_dir, $dest_suite_dir); + my $test_case_dir= File::Spec->catdir($dest_suite_dir, "t"); + # Read disabled.def + my %disabled = (); + print "Read disabled.def\n"; + my $fh = new IO::File File::Spec->catdir($test_case_dir, "disabled.def"), "r"; + if ( defined $fh ) + { + my @lines = <$fh>; + undef $fh; + foreach my $line ( @lines ) + { + if ($line =~ m/^([a-zA-Z0-9_]+).+\:.+/i) + { + $disabled{$1}= 1; + } + } + } + # Read test case list + my %tests = (); + print "Generate test case list\n"; + opendir my ($dh), $test_case_dir or die "Could not open dir '$test_case_dir': $!"; + for my $entry (readdir $dh) + { + if ( $entry =~ m/^([a-zA-Z0-9_]+)\.test$/i ) + { + my $test= $1; + if ( ! defined( $disabled{$test}) ) + { + $tests{$test}= 1; + } + } + } + closedir($dh); + # + my @excluded = (); + my $excluded_test= int((((100 - $percent_random_test)/100) * scalar( keys %tests ))); + while ( $excluded_test > 0 ) + { + my @cases = keys %tests; + my $test = $cases[int(rand(scalar(@cases)))]; + push ( @excluded, $test . "\t\t: Excluded for $dest_suite\n" ); + delete $tests{$test}; + $excluded_test--; + } + my $fh = new IO::File File::Spec->catdir($test_case_dir, "disabled.def"), O_WRONLY|O_APPEND; + if (defined $fh) { + print $fh join ("", sort @excluded); + undef $fh; + } + print "\t" . join("\n\t", sort keys %tests) . "\n"; + +} + +# Set path to mtr with arguments +my $mtr_script = "perl " . File::Spec->catdir($mysql_test_dir, "mysql-test-run.pl") . + " --suite=" . join(",", @mtr_suites) . " " . + " --mysqld=--binlog-checksum=CRC32 " . + join (" ", @mtr_argv); + +print "Run $mtr_script\n"; +system( $mtr_script ); + +sub dircopy +{ + my ($from_dir, $to_dir)= @_; + mkdir $to_dir if (! -e $to_dir); + opendir my($dh), $from_dir or die "Could not open dir '$from_dir': $!"; + for my $entry (readdir $dh) + { + next if $entry =~ /^(\.|\.\.)$/; + my $source = File::Spec->catdir($from_dir, $entry); + my $destination = File::Spec->catdir($to_dir, $entry); + if (-d $source) + { + mkdir $destination or die "mkdir '$destination' failed: $!" if not -e $destination; + dircopy($source, $destination); + } + else + { + copy($source, $destination) or die "copy '$source' to '$destination' failed: $!"; + } + } + closedir $dh; + return; +} diff --git a/mysql-test/suite/rpl/include/hrtime.inc b/mysql-test/suite/rpl/include/hrtime.inc new file mode 100644 index 00000000000..b49bf0c7792 --- /dev/null +++ b/mysql-test/suite/rpl/include/hrtime.inc @@ -0,0 +1,27 @@ +--source include/master-slave.inc + +set time_zone='+03:00'; +set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456; + +create table t1 (a timestamp(4), b varchar(100), c datetime(2)); + +insert t1 (b,c) values (now(6), now(6)); + +insert t1 values ('2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010'); + +set timestamp=unix_timestamp('2022-02-02 02:02:02') + 0.654321; +insert t1 (b,c) values (now(), now()); +insert t1 (b,c) values (0,0); +insert t1 (a,b,c) values (0,0,now(6)); + +select * from t1; + +sync_slave_with_master; +connection slave; +set time_zone='+03:00'; +select * from t1; +connection master; +drop table t1; + +--source include/rpl_end.inc + diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment.result b/mysql-test/suite/rpl/r/rpl_auto_increment.result index a0478947c72..8b41a01cb6e 100644 --- a/mysql-test/suite/rpl/r/rpl_auto_increment.result +++ b/mysql-test/suite/rpl/r/rpl_auto_increment.result @@ -303,6 +303,36 @@ include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1; DROP TABLE t2; SET SQL_MODE=''; +CREATE TABLE t1(s VARCHAR(10)) ENGINE=myisam; +CREATE TABLE t_ignored1(id INT AUTO_INCREMENT PRIMARY KEY) ENGINE=myisam; +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column"); +CREATE TABLE test.slave_only(id INT AUTO_INCREMENT PRIMARY KEY) ENGINE=myisam; +INSERT INTO slave_only VALUES(NULL); +CREATE TRIGGER t1_update AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO slave_only VALUES(NULL); +INSERT INTO t_ignored1 VALUES(NULL); +INSERT INTO t1 VALUES('s'); +UPDATE t1 SET s='s1'; +SELECT * FROM t1; +s +s1 +CREATE TABLE t_ignored2(id INT AUTO_INCREMENT PRIMARY KEY) ENGINE=myisam; +STOP SLAVE; +SET GLOBAL sql_slave_skip_counter = 2; +START SLAVE; +INSERT INTO t_ignored2 VALUES(NULL); +UPDATE t1 SET s='s2'; +SELECT * FROM t1; +s +s2 +SHOW TABLES LIKE 't\_ignored_'; +Tables_in_test (t\_ignored_) +t_ignored2 +SELECT * FROM t_ignored2; +id +DROP TABLE slave_only; +DROP TABLE t1; +DROP TABLE t_ignored1; +DROP TABLE t_ignored2; CREATE TABLE t1 (id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, data INT) ENGINE=innodb; BEGIN; # Set sql_mode with NO_AUTO_VALUE_ON_ZERO for allowing diff --git a/mysql-test/suite/rpl/r/rpl_bug38694.result b/mysql-test/suite/rpl/r/rpl_bug38694.result index b666d9a9155..84180af0870 100644 --- a/mysql-test/suite/rpl/r/rpl_bug38694.result +++ b/mysql-test/suite/rpl/r/rpl_bug38694.result @@ -1,3 +1,4 @@ include/master-slave.inc [connection master] +call mtr.add_suppression("Aborted connection"); include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_change_master.result b/mysql-test/suite/rpl/r/rpl_change_master.result index 6674ab168ef..1b1f040b726 100644 --- a/mysql-test/suite/rpl/r/rpl_change_master.result +++ b/mysql-test/suite/rpl/r/rpl_change_master.result @@ -1,5 +1,6 @@ include/master-slave.inc [connection master] +call mtr.add_suppression("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum"); create table t1(n int); select * from t1; n diff --git a/mysql-test/suite/rpl/r/rpl_checksum.result b/mysql-test/suite/rpl/r/rpl_checksum.result new file mode 100644 index 00000000000..7b483c7a9e9 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_checksum.result @@ -0,0 +1,135 @@ +include/master-slave.inc +[connection master] +call mtr.add_suppression('Slave can not handle replication events with the checksum that master is configured to log'); +call mtr.add_suppression('Replication event checksum verification failed'); +call mtr.add_suppression('Relay log write failure: could not queue event from master'); +call mtr.add_suppression('Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process them'); +set @master_save_binlog_checksum= @@global.binlog_checksum; +set @save_master_verify_checksum = @@global.master_verify_checksum; +select @@global.binlog_checksum as 'must be CRC32 because of the command line option'; +must be CRC32 because of the command line option +CRC32 +select @@session.binlog_checksum as 'no session var'; +ERROR HY000: Variable 'binlog_checksum' is a GLOBAL variable +select @@global.master_verify_checksum as 'must be zero because of default'; +must be zero because of default +0 +select @@session.master_verify_checksum as 'no session var'; +ERROR HY000: Variable 'master_verify_checksum' is a GLOBAL variable +set @slave_save_binlog_checksum= @@global.binlog_checksum; +set @save_slave_sql_verify_checksum = @@global.slave_sql_verify_checksum; +select @@global.slave_sql_verify_checksum as 'must be one because of default'; +must be one because of default +1 +select @@session.slave_sql_verify_checksum as 'no session var'; +ERROR HY000: Variable 'slave_sql_verify_checksum' is a GLOBAL variable +show binary logs; +Log_name File_size +master-bin.000001 # +set @@global.binlog_checksum = NONE; +select @@global.binlog_checksum; +@@global.binlog_checksum +NONE +*** must be rotations seen *** +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +set @@global.binlog_checksum = default; +select @@global.binlog_checksum; +@@global.binlog_checksum +NONE +set @@global.binlog_checksum = CRC32; +select @@global.binlog_checksum; +@@global.binlog_checksum +CRC32 +set @@global.binlog_checksum = CRC32; +set @@global.master_verify_checksum = 0; +set @@global.master_verify_checksum = default; +set @@global.binlog_checksum = ADLER32; +ERROR 42000: Variable 'binlog_checksum' can't be set to the value of 'ADLER32' +set @@global.master_verify_checksum = 2; +ERROR 42000: Variable 'master_verify_checksum' can't be set to the value of '2' +set @@global.slave_sql_verify_checksum = 0; +set @@global.slave_sql_verify_checksum = default; +set @@global.slave_sql_verify_checksum = 2; +ERROR 42000: Variable 'slave_sql_verify_checksum' can't be set to the value of '2' +set @@global.binlog_checksum = NONE; +create table t1 (a int); +flush logs; +flush logs; +flush logs; +flush logs; +flush logs; +flush logs; +select count(*) as zero from t1; +zero +0 +include/stop_slave.inc +set @@global.binlog_checksum = CRC32; +insert into t1 values (1) /* will not be applied on slave due to simulation */; +set @@global.debug='d,simulate_slave_unaware_checksum'; +start slave; +include/wait_for_slave_io_error.inc [errno=1236] +Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log'' +select count(*) as zero from t1; +zero +0 +set @@global.debug=''; +include/start_slave.inc +set @@global.master_verify_checksum = 1; +set @@session.debug='d,simulate_checksum_test_failure'; +show binlog events; +ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error +set @@session.debug=''; +set @@global.master_verify_checksum = default; +include/stop_slave.inc +create table t2 (a int); +set @@global.debug='d,simulate_checksum_test_failure'; +start slave io_thread; +include/wait_for_slave_io_error.inc [errno=1595] +Last_IO_Error = 'Relay log write failure: could not queue event from master' +set @@global.debug=''; +start slave io_thread; +include/wait_for_slave_param.inc [Read_Master_Log_Pos] +set @@global.slave_sql_verify_checksum = 1; +set @@global.debug='d,simulate_checksum_test_failure'; +start slave sql_thread; +include/wait_for_slave_sql_error.inc [errno=1593] +Last_SQL_Error = 'Error initializing relay log position: I/O error reading event at position 4' +set @@global.debug=''; +include/start_slave.inc +select count(*) as 'must be zero' from t2; +must be zero +0 +stop slave; +reset slave; +set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); +flush logs; +set @@global.binlog_checksum= CRC32; +reset master; +flush logs; +create table t3 (a int, b char(5)); +include/start_slave.inc +select count(*) as 'must be zero' from t3; +must be zero +0 +include/stop_slave.inc +change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; +flush logs; +reset master; +insert into t3 value (1, @@global.binlog_checksum); +include/start_slave.inc +flush logs; +select count(*) as 'must be one' from t3; +must be one +1 +set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); +insert into t3 value (1, @@global.binlog_checksum); +drop table t1, t2, t3; +set @@global.binlog_checksum = @master_save_binlog_checksum; +set @@global.master_verify_checksum = @save_master_verify_checksum; +set @@global.binlog_checksum = @slave_save_binlog_checksum; +set @@global.slave_sql_verify_checksum = @save_slave_sql_verify_checksum; +End of tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_checksum_cache.result b/mysql-test/suite/rpl/r/rpl_checksum_cache.result new file mode 100644 index 00000000000..9508e94e7f2 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_checksum_cache.result @@ -0,0 +1,119 @@ +include/master-slave.inc +[connection master] +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t2 set data=repeat.*'a', @act_size.*"); +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t1 values.* NAME_CONST.*'n',.*, @data .*"); +set @save_binlog_cache_size = @@global.binlog_cache_size; +set @save_binlog_checksum = @@global.binlog_checksum; +set @save_master_verify_checksum = @@global.master_verify_checksum; +set @@global.binlog_cache_size = 4096; +set @@global.binlog_checksum = CRC32; +set @@global.master_verify_checksum = 1; +include/stop_slave.inc +include/start_slave.inc +flush status; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 0 +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 0 +drop table if exists t1; +create table t1 (a int PRIMARY KEY, b CHAR(32)) engine=innodb; +create procedure test.p_init (n int, size int) +begin +while n > 0 do +select round(RAND() * size) into @act_size; +set @data = repeat('a', @act_size); +insert into t1 values(n, @data ); +set n= n-1; +end while; +end| +begin; +call test.p_init(4000, 32); +commit; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 1 +*** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 1 +include/diff_tables.inc [master:test.t1, slave:test.t1] +begin; +delete from t1; +commit; +flush status; +create table t2(a int auto_increment primary key, data VARCHAR(12288)) ENGINE=Innodb; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 1 +*** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 1 +include/diff_tables.inc [master:test.t2, slave:test.t2] +begin; +delete from t2; +commit; +flush status; +create table t3(a int auto_increment primary key, data VARCHAR(8192)) engine=innodb; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 1 +*** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 1 +include/diff_tables.inc [master:test.t3, slave:test.t3] +begin; +delete from t3; +commit; +flush status; +create procedure test.p1 (n int) +begin +while n > 0 do +case (select (round(rand()*100) % 3) + 1) +when 1 then +select round(RAND() * 32) into @act_size; +set @data = repeat('a', @act_size); +insert into t1 values(n, @data); +when 2 then +begin +select round(8192 + RAND() * 4096) into @act_size; +insert into t2 set data=repeat('a', @act_size); +end; +when 3 then +begin +select round(3686.4000 + RAND() * 819.2000) into @act_size; +insert into t3 set data= repeat('a', @act_size); +end; +end case; +set n= n-1; +end while; +end| +set autocommit= 0; +begin; +call test.p1(1000); +commit; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 1 +*** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 1 +include/diff_tables.inc [master:test.t1, slave:test.t1] +include/diff_tables.inc [master:test.t2, slave:test.t2] +include/diff_tables.inc [master:test.t3, slave:test.t3] +begin; +delete from t1; +delete from t2; +delete from t3; +commit; +drop table t1, t2, t3; +set @@global.binlog_cache_size = @save_binlog_cache_size; +set @@global.binlog_checksum = @save_binlog_checksum; +set @@global.master_verify_checksum = @save_master_verify_checksum; +drop procedure test.p_init; +drop procedure test.p1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_corruption.result b/mysql-test/suite/rpl/r/rpl_corruption.result new file mode 100644 index 00000000000..a35bfbad92c --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_corruption.result @@ -0,0 +1,51 @@ +include/master-slave.inc +[connection master] +call mtr.add_suppression('Found invalid event in binary log'); +call mtr.add_suppression('Slave I/O: Relay log write failure: could not queue event from master'); +call mtr.add_suppression('event read from binlog did not pass crc check'); +call mtr.add_suppression('Replication event checksum verification failed'); +call mtr.add_suppression('Event crc check failed! Most likely there is event corruption'); +call mtr.add_suppression('Slave SQL: Error initializing relay log position: I/O error reading event at position .*, Error_code: 1593'); +SET @old_master_verify_checksum = @@master_verify_checksum; +# 1. Creating test table/data and set corruption position for testing +* insert/update/delete rows in table t1 * +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100)); +include/stop_slave.inc +# 2. Corruption in master binlog and SHOW BINLOG EVENTS +SET GLOBAL debug="+d,corrupt_read_log_event_char"; +SHOW BINLOG EVENTS; +ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error +SET GLOBAL debug="-d,corrupt_read_log_event_char"; +# 3. Master read a corrupted event from binlog and send the error to slave +SET GLOBAL debug="+d,corrupt_read_log_event2"; +START SLAVE IO_THREAD; +include/wait_for_slave_io_error.inc [errno=1236] +SET GLOBAL debug="-d,corrupt_read_log_event2"; +# 4. Master read a corrupted event from binlog and send it to slave +SET GLOBAL master_verify_checksum=0; +SET GLOBAL debug="+d,corrupt_read_log_event2"; +START SLAVE IO_THREAD; +include/wait_for_slave_io_error.inc [errno=1595,1722] +SET GLOBAL debug="-d,corrupt_read_log_event2"; +SET GLOBAL debug= ""; +SET GLOBAL master_verify_checksum=1; +# 5. Slave. Corruption in network +SET GLOBAL debug="+d,corrupt_queue_event"; +START SLAVE IO_THREAD; +include/wait_for_slave_io_error.inc [errno=1595,1722] +SET GLOBAL debug="-d,corrupt_queue_event"; +# 6. Slave. Corruption in relay log +SET GLOBAL debug="+d,corrupt_read_log_event_char"; +START SLAVE SQL_THREAD; +include/wait_for_slave_sql_error.inc [errno=1593] +SET GLOBAL debug="-d,corrupt_read_log_event_char"; +SET GLOBAL debug= ""; +# 7. Seek diff for tables on master and slave +include/start_slave.inc +include/diff_tables.inc [master:test.t1, slave:test.t1] +# 8. Clean up +SET GLOBAL debug= ""; +SET GLOBAL master_verify_checksum = @old_master_verify_checksum; +DROP TABLE t1; +SET GLOBAL debug= ""; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result b/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result index d12f3ff1360..2490f692375 100644 --- a/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result +++ b/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result @@ -74,7 +74,7 @@ CREATE TABLE t2 (id int); INSERT INTO t1 VALUES (1), (1); INSERT INTO t2 VALUES (2), (2); CREATE VIEW v1 AS SELECT id FROM t2; -CREATE TABLE IF NOT EXISTS v1(a int, b int) SELECT id, id FROM t1; +CREATE TABLE IF NOT EXISTS v1(a int, b int) SELECT id, id as di FROM t1; Warnings: Note 1050 Table 'v1' already exists show binlog events from <binlog_start>; diff --git a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result index c399b408d5c..37d209bbcf6 100644 --- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result @@ -51,7 +51,7 @@ include/check_slave_is_running.inc *** Test lock wait timeout *** include/stop_slave.inc DELETE FROM t2; -CHANGE MASTER TO MASTER_LOG_POS=MASTER_POS_BEGIN; +CHANGE MASTER TO MASTER_LOG_POS=<master_pos_begin>; BEGIN; SELECT * FROM t1 FOR UPDATE; a @@ -78,7 +78,7 @@ SET @my_max_relay_log_size= @@global.max_relay_log_size; SET global max_relay_log_size=0; include/stop_slave.inc DELETE FROM t2; -CHANGE MASTER TO MASTER_LOG_POS=MASTER_POS_BEGIN; +CHANGE MASTER TO MASTER_LOG_POS=<master_pos_begin>; BEGIN; SELECT * FROM t1 FOR UPDATE; a diff --git a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result index 931335fb95c..7b93a221953 100644 --- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result +++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result @@ -1,8 +1,8 @@ include/rpl_init.inc [topology=1->2->1] show variables like 'relay_log%'; Variable_name Value -relay_log -relay_log_index +relay_log master-relay-bin +relay_log_index master-relay-bin.index relay_log_info_file relay-log.info relay_log_purge ON relay_log_recovery OFF @@ -12,5 +12,5 @@ INSERT INTO t1 VALUE(1); FLUSH LOGS; INSERT INTO t1 VALUE(2); include/check_slave_is_running.inc -Relay_Log_File = 'mysqld-relay-bin.000003' +Relay_Log_File = 'master-relay-bin.000003' include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_hrtime.result b/mysql-test/suite/rpl/r/rpl_hrtime.result new file mode 100644 index 00000000000..e4a825591bf --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_hrtime.result @@ -0,0 +1,97 @@ +include/master-slave.inc +[connection master] +set time_zone='+03:00'; +set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456; +create table t1 (a timestamp(4), b varchar(100), c datetime(2)); +insert t1 (b,c) values (now(6), now(6)); +insert t1 values ('2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010'); +set timestamp=unix_timestamp('2022-02-02 02:02:02') + 0.654321; +insert t1 (b,c) values (now(), now()); +insert t1 (b,c) values (0,0); +insert t1 (a,b,c) values (0,0,now(6)); +select * from t1; +a b c +2011-01-01 01:01:01.1234 2011-01-01 01:01:01.123456 2011-01-01 01:01:01.12 +2010-10-10 10:10:10.1010 2010-10-10 10:10:10.101010 2010-10-10 10:10:10.10 +2022-02-02 02:02:02.6543 2022-02-02 02:02:02 2022-02-02 02:02:02.00 +2022-02-02 02:02:02.6543 0 0000-00-00 00:00:00.00 +0000-00-00 00:00:00.0000 0 2022-02-02 02:02:02.65 +set time_zone='+03:00'; +select * from t1; +a b c +2011-01-01 01:01:01.1234 2011-01-01 01:01:01.123456 2011-01-01 01:01:01.12 +2010-10-10 10:10:10.1010 2010-10-10 10:10:10.101010 2010-10-10 10:10:10.10 +2022-02-02 02:02:02.6543 2022-02-02 02:02:02 2022-02-02 02:02:02.00 +2022-02-02 02:02:02.6543 0 0000-00-00 00:00:00.00 +0000-00-00 00:00:00.0000 0 2022-02-02 02:02:02.65 +drop table t1; +include/rpl_end.inc +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1293832861/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; +SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +create table t1 (a timestamp(4), b varchar(100), c datetime(2)) +/*!*/; +SET TIMESTAMP=1293832861.123456/*!*/; +SET @@session.time_zone='+03:00'/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=1293832861.123456/*!*/; +insert t1 (b,c) values (now(6), now(6)) +/*!*/; +SET TIMESTAMP=1293832861.123456/*!*/; +COMMIT +/*!*/; +SET TIMESTAMP=1293832861/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=1293832861/*!*/; +insert t1 values ('2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010') +/*!*/; +SET TIMESTAMP=1293832861/*!*/; +COMMIT +/*!*/; +SET TIMESTAMP=1643756522.654321/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=1643756522.654321/*!*/; +insert t1 (b,c) values (now(), now()) +/*!*/; +SET TIMESTAMP=1643756522.654321/*!*/; +COMMIT +/*!*/; +SET TIMESTAMP=1643756522.654321/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=1643756522.654321/*!*/; +insert t1 (b,c) values (0,0) +/*!*/; +SET TIMESTAMP=1643756522.654321/*!*/; +COMMIT +/*!*/; +SET TIMESTAMP=1643756522.654321/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=1643756522.654321/*!*/; +insert t1 (a,b,c) values (0,0,now(6)) +/*!*/; +SET TIMESTAMP=1643756522.654321/*!*/; +COMMIT +/*!*/; +SET TIMESTAMP=1643756522/*!*/; +DROP TABLE `t1` /* generated by server */ +/*!*/; +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; diff --git a/mysql-test/suite/rpl/r/rpl_hrtime_row.result b/mysql-test/suite/rpl/r/rpl_hrtime_row.result new file mode 100644 index 00000000000..aaf8b1c2466 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_hrtime_row.result @@ -0,0 +1,28 @@ +include/master-slave.inc +[connection master] +set time_zone='+03:00'; +set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456; +create table t1 (a timestamp(4), b varchar(100), c datetime(2)); +insert t1 (b,c) values (now(6), now(6)); +insert t1 values ('2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010'); +set timestamp=unix_timestamp('2022-02-02 02:02:02') + 0.654321; +insert t1 (b,c) values (now(), now()); +insert t1 (b,c) values (0,0); +insert t1 (a,b,c) values (0,0,now(6)); +select * from t1; +a b c +2011-01-01 01:01:01.1234 2011-01-01 01:01:01.123456 2011-01-01 01:01:01.12 +2010-10-10 10:10:10.1010 2010-10-10 10:10:10.101010 2010-10-10 10:10:10.10 +2022-02-02 02:02:02.6543 2022-02-02 02:02:02 2022-02-02 02:02:02.00 +2022-02-02 02:02:02.6543 0 0000-00-00 00:00:00.00 +0000-00-00 00:00:00.0000 0 2022-02-02 02:02:02.65 +set time_zone='+03:00'; +select * from t1; +a b c +2011-01-01 01:01:01.1234 2011-01-01 01:01:01.123456 2011-01-01 01:01:01.12 +2010-10-10 10:10:10.1010 2010-10-10 10:10:10.101010 2010-10-10 10:10:10.10 +2022-02-02 02:02:02.6543 2022-02-02 02:02:02 2022-02-02 02:02:02.00 +2022-02-02 02:02:02.6543 0 0000-00-00 00:00:00.00 +0000-00-00 00:00:00.0000 0 2022-02-02 02:02:02.65 +drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table.result b/mysql-test/suite/rpl/r/rpl_ignore_table.result index c06e4361098..7bd30766d32 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_table.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_table.result @@ -1,5 +1,8 @@ include/master-slave.inc [connection master] +call mtr.add_suppression("Can't find record in 't.'"); +call mtr.add_suppression("Can't find record in 'user'"); +call mtr.add_suppression("Can't find record in 'tables_priv'"); **** Test case for BUG#16487 **** **** Master **** CREATE TABLE test.t4 (a int); diff --git a/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result b/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result index f8734b48295..b02164ac61b 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result @@ -90,13 +90,19 @@ DELETE FROM test.byrange_tbl WHERE id = del_count; SET del_count = del_count - 2; END WHILE; END| +begin; CALL test.proc_norm(); +commit; SELECT count(*) as "Master regular" FROM test.regular_tbl; Master regular 500 +begin; CALL test.proc_bykey(); +commit; SELECT count(*) as "Master bykey" FROM test.bykey_tbl; Master bykey 500 +begin; CALL test.proc_byrange(); +commit; SELECT count(*) as "Master byrange" FROM test.byrange_tbl; Master byrange 500 show create table test.byrange_tbl; diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result index 4106dc93198..ff56fb1f68c 100644 --- a/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result @@ -505,8 +505,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_3) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_3) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -516,8 +514,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_3) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_3) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -529,8 +525,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_4) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_4) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -540,8 +534,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_4) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_4) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -555,8 +547,6 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_5) master-bin.000001 # Table_map # # table_id: # (test.nt_6) master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_5) master-bin.000001 # Table_map # # table_id: # (test.tt_6) master-bin.000001 # Write_rows # # table_id: # @@ -572,8 +562,6 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_5) master-bin.000001 # Table_map # # table_id: # (test.nt_6) master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_5) master-bin.000001 # Table_map # # table_id: # (test.tt_6) master-bin.000001 # Write_rows # # table_id: # @@ -589,8 +577,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_4) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_4) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -600,8 +586,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_4) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_4) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -613,8 +597,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_3) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_3) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -624,8 +606,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_3) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_3) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -641,8 +621,6 @@ master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_5) master-bin.000001 # Table_map # # table_id: # (test.tt_6) master-bin.000001 # Write_rows # # table_id: # @@ -658,8 +636,6 @@ master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_5) master-bin.000001 # Table_map # # table_id: # (test.tt_6) master-bin.000001 # Write_rows # # table_id: # diff --git a/mysql-test/suite/rpl/r/rpl_rewrt_db.result b/mysql-test/suite/rpl/r/rpl_rewrt_db.result index 12071faecfd..6cbd107fdcf 100644 --- a/mysql-test/suite/rpl/r/rpl_rewrt_db.result +++ b/mysql-test/suite/rpl/r/rpl_rewrt_db.result @@ -25,8 +25,8 @@ Warnings: Warning 1265 Data truncated for column 'a' at row 1 Warning 1265 Data truncated for column 'c' at row 1 Warning 1265 Data truncated for column 'd' at row 1 -Warning 1265 Data truncated for column 'a' at row 2 -Warning 1265 Data truncated for column 'b' at row 2 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'b' at row 2 Warning 1265 Data truncated for column 'd' at row 2 load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES; select * from rewrite.t1; @@ -40,7 +40,7 @@ load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated Warnings: Warning 1265 Data truncated for column 'c' at row 1 Warning 1265 Data truncated for column 'd' at row 1 -Warning 1265 Data truncated for column 'b' at row 2 +Warning 1264 Out of range value for column 'b' at row 2 Warning 1265 Data truncated for column 'd' at row 2 select * from rewrite.t1; a b c d diff --git a/mysql-test/suite/rpl/r/rpl_rotate_logs.result b/mysql-test/suite/rpl/r/rpl_rotate_logs.result index 9144d3c0e72..d235331391b 100644 --- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result +++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result @@ -71,7 +71,7 @@ insert into temp_table values ("testing temporary tables part 2"); create table t3 (n int); select count(*) from t3 where n >= 4; count(*) -100 +91 create table t4 select * from temp_table; show binary logs; Log_name File_size @@ -94,7 +94,7 @@ include/check_slave_is_running.inc lock tables t3 read; select count(*) from t3 where n >= 4; count(*) -100 +91 unlock tables; drop table if exists t1,t2,t3,t4; End of 4.1 tests diff --git a/mysql-test/suite/rpl/r/rpl_row_annotate_do.result b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result new file mode 100644 index 00000000000..0ece93e7aa5 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result @@ -0,0 +1,141 @@ +include/master-slave.inc +[connection master] +######################################################################## +# TABLES ON MASTER +######################################################################## +SELECT * FROM t1 ORDER BY a; +a b +0 1 +SELECT * FROM t2 ORDER BY a; +a b +SELECT * FROM t3 ORDER BY a; +a b +1 1 +2 2 +3 3 +SELECT * FROM t5 ORDER BY a; +a b +1 foo +2 bar +3 baz +4 gås +5 gås +######################################################################## +# TABLES ON SLAVE: should be the same as on master +######################################################################## +SELECT * FROM t1 ORDER BY a; +a b +0 1 +SELECT * FROM t2 ORDER BY a; +a b +SELECT * FROM t3 ORDER BY a; +a b +1 1 +2 2 +3 3 +SELECT * FROM t5 ORDER BY a; +a b +1 foo +2 bar +3 baz +4 gås +5 gås +######################################################################## +# EVENTS ON SLAVE +# The following Annotate_rows events should appear below: +# - UPDATE t1 SET b = b + 1; +# - REPLACE t1 VALUES (1,1), (2,2), (3,3); +# - INSERT INTO t2 VALUES (1,1), (2,2), (3,3) +# - INSERT INTO t3 VALUES (1,1), (2,2), (3,3) +# - DELETE t1, t2 FROM <...> +# - INSERT INTO t2 VALUES (1,1), (2,2), (3,3) +# - DELETE xt1, t2 FROM <...> +# - INSERT INTO t5(b) VALUES <...> (3 instances) +######################################################################## +FLUSH LOGS; +show binlog events in 'slave-bin.000001' from <start_pos>; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1 +slave-bin.000001 # Query 1 # CREATE DATABASE test1 +slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t1(a int primary key, b int) +slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t2(a int, b int) +slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t3(a int, b int) +slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t4(a int, b int) +slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t5 ( +a INT PRIMARY KEY AUTO_INCREMENT, +b VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin +) +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Annotate_rows 1 # UPDATE t1 SET b = b + 1 +slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) +slave-bin.000001 # Update_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Annotate_rows 1 # REPLACE t1 VALUES (1,1), (2,2), (3,3) +slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) +slave-bin.000001 # Update_rows 1 # table_id: # +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Annotate_rows 1 # INSERT INTO t2 VALUES (1,1), (2,2), (3,3) +slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Annotate_rows 1 # INSERT INTO t3 VALUES (1,1), (2,2), (3,3) +slave-bin.000001 # Table_map 1 # table_id: # (test1.t3) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Annotate_rows 1 # DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.a=t2.a AND t2.a=t3.a +slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) +slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) +slave-bin.000001 # Delete_rows 1 # table_id: # +slave-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Annotate_rows 1 # INSERT INTO t2 VALUES (1,1), (2,2), (3,3) +slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Annotate_rows 1 # DELETE xt1, t2 FROM xt1 INNER JOIN t2 INNER JOIN t3 WHERE xt1.a=t2.a AND t2.a=t3.a +slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) +slave-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5(b) VALUES ('foo'), ('bar'), ('baz') +slave-bin.000001 # Table_map 1 # table_id: # (test1.t5) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5(b) VALUES ('gås') +slave-bin.000001 # Table_map 1 # table_id: # (test1.t5) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5(b) VALUES ('gÃ¥s') +slave-bin.000001 # Table_map 1 # table_id: # (test1.t5) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4 +# +######################################################################## +# INSERTs DELAYED ON MASTERs +######################################################################## +SET SESSION binlog_annotate_rows_events = ON; +INSERT DELAYED INTO test1.t4 VALUES (1,1); +FLUSH TABLES; +SELECT * FROM test1.t4 ORDER BY a; +a b +1 1 +######################################################################## +# ON SLAVE +# No Annotate_rows events should appear below +######################################################################## +FLUSH LOGS; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result new file mode 100644 index 00000000000..8463256d5db --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result @@ -0,0 +1,123 @@ +include/master-slave.inc +[connection master] +######################################################################## +# TABLES ON MASTER +######################################################################## +SELECT * FROM t1 ORDER BY a; +a b +0 1 +SELECT * FROM t2 ORDER BY a; +a b +SELECT * FROM t3 ORDER BY a; +a b +1 1 +2 2 +3 3 +SELECT * FROM t5 ORDER BY a; +a b +1 foo +2 bar +3 baz +4 gås +5 gås +######################################################################## +# TABLES ON SLAVE: should be the same as on master +######################################################################## +SELECT * FROM t1 ORDER BY a; +a b +0 1 +SELECT * FROM t2 ORDER BY a; +a b +SELECT * FROM t3 ORDER BY a; +a b +1 1 +2 2 +3 3 +SELECT * FROM t5 ORDER BY a; +a b +1 foo +2 bar +3 baz +4 gås +5 gås +######################################################################## +# EVENTS ON SLAVE +# No Annotate_rows events should appear below +######################################################################## +FLUSH LOGS; +show binlog events in 'slave-bin.000001' from <start_pos>; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1 +slave-bin.000001 # Query 1 # CREATE DATABASE test1 +slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t1(a int primary key, b int) +slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t2(a int, b int) +slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t3(a int, b int) +slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t4(a int, b int) +slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t5 ( +a INT PRIMARY KEY AUTO_INCREMENT, +b VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin +) +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) +slave-bin.000001 # Update_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) +slave-bin.000001 # Update_rows 1 # table_id: # +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Table_map 1 # table_id: # (test1.t3) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) +slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) +slave-bin.000001 # Delete_rows 1 # table_id: # +slave-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) +slave-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Table_map 1 # table_id: # (test1.t5) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Table_map 1 # table_id: # (test1.t5) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Query 1 # BEGIN +slave-bin.000001 # Table_map 1 # table_id: # (test1.t5) +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 1 # COMMIT +slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4 +# +######################################################################## +# INSERTs DELAYED ON MASTERs +######################################################################## +SET SESSION binlog_annotate_rows_events = ON; +INSERT DELAYED INTO test1.t4 VALUES (1,1); +FLUSH TABLES; +SELECT * FROM test1.t4 ORDER BY a; +a b +1 1 +######################################################################## +# ON SLAVE +# No Annotate_rows events should appear below +######################################################################## +FLUSH LOGS; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result index 9f973bbe80e..1d04271129c 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result @@ -1,5 +1,6 @@ include/master-slave.inc [connection master] +call mtr.add_suppression("Can't find record in 't.'"); CREATE DATABASE test_ignore; **** On Master **** SHOW DATABASES; @@ -24,6 +25,10 @@ t2 INSERT INTO t2 VALUES (3,3), (4,4); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (mtr.test_suppressions) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b INT) master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) diff --git a/mysql-test/suite/rpl/r/rpl_row_conflicts.result b/mysql-test/suite/rpl/r/rpl_row_conflicts.result index b42ff0c3b17..b9a570fea33 100644 --- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result +++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result @@ -1,6 +1,7 @@ include/master-slave.inc [connection master] call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: .*"); +call mtr.add_suppression("Can't find record in 't.'"); [on slave] SET @old_slave_exec_mode= @@global.slave_exec_mode; ######## Run with slave_exec_mode=STRICT ######## diff --git a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result index 6b8d8b9407e..96d2a337e7c 100644 --- a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result +++ b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result @@ -1,6 +1,6 @@ include/master-slave.inc [connection master] -create table t1 (a int); +create table t1 (a int) ENGINE=MyISAM; insert into t1 values (10); create table t2 (a int) ENGINE=MyISAM; create table t3 (a int) engine=merge union(t1); diff --git a/mysql-test/suite/rpl/r/rpl_row_index_choice.result b/mysql-test/suite/rpl/r/rpl_row_index_choice.result new file mode 100644 index 00000000000..2d955299e6e --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_index_choice.result @@ -0,0 +1,140 @@ +include/master-slave.inc +[connection master] +CREATE TABLE t1 (a int, b varchar(100), fulltext(b)) engine=MyISAM; +INSERT INTO t1 VALUES (1,"a"), (2,"b"); +UPDATE t1 SET b='A' WHERE a=1; +DELETE FROM t1 WHERE a=2; +SELECT * FROM t1 ORDER BY a; +a b +1 A +DROP TABLE t1; +CREATE TABLE t1 (d INT PRIMARY KEY) ENGINE=myisam; +INSERT INTO t1 VALUES (0); +INSERT INTO t1 SELECT d+1 FROM t1; +INSERT INTO t1 SELECT d+2 FROM t1; +INSERT INTO t1 SELECT d+4 FROM t1; +INSERT INTO t1 SELECT d+8 FROM t1; +INSERT INTO t1 SELECT d+16 FROM t1; +INSERT INTO t1 SELECT d+32 FROM t1; +INSERT INTO t1 SELECT d+64 FROM t1; +INSERT INTO t1 SELECT d+128 FROM t1; +INSERT INTO t1 SELECT d+256 FROM t1; +INSERT INTO t1 SELECT d+512 FROM t1; +CREATE TABLE t2 (a INT, b INT, c INT, d INT, +KEY wrong_key(a), +KEY expected_key(b,c), +KEY wrong_key2(c)) ENGINE=myisam; +INSERT INTO t2 SELECT d DIV 10, d MOD 41, d MOD 37, d FROM t1; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status OK +# Slave will crash if using the wrong or no index +SET GLOBAL debug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan"; +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; +SET GLOBAL debug=""; +SELECT * FROM t2 WHERE d IN (10042,53); +a b c d +4 1 5 10042 +DROP TABLE t2; +CREATE TABLE t2 (a INT, b INT, c INT, d INT NOT NULL, e INT, +UNIQUE wrong_key3(a,e), +KEY wrong_key4(b,c), +UNIQUE expected_key(d)) ENGINE=myisam; +INSERT INTO t2 SELECT d DIV 10, d MOD 41, d MOD 37, d, NULL FROM t1; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status OK +# Slave will crash if using the wrong or no index +SET GLOBAL debug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan"; +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; +SET GLOBAL debug=""; +SELECT * FROM t2 WHERE d IN (10042,53); +a b c d e +4 1 5 10042 NULL +DROP TABLE t2; +CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT NOT NULL, +KEY wrong_key5(b), +UNIQUE expected_key(d), +KEY wrong_key6(c)) ENGINE=myisam; +INSERT INTO t2 SELECT d DIV 10, d MOD 41, d MOD 37, d FROM t1; +# Slave will crash if using the wrong or no index +SET GLOBAL debug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan"; +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; +SET GLOBAL debug=""; +SELECT * FROM t2 WHERE d IN (10042,53); +a b c d +4 1 5 10042 +DROP TABLE t2; +CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT NOT NULL, +KEY expected_key(b), +KEY wrong_key7(d), +KEY wrong_key8(c)) ENGINE=myisam; +INSERT INTO t2 SELECT d DIV 10, d MOD 41, d MOD 37, d FROM t1; +# Slave will crash if using the wrong or no index +SET GLOBAL debug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan"; +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; +SET GLOBAL debug=""; +SELECT * FROM t2 WHERE d IN (10042,53); +a b c d +4 1 5 10042 +DROP TABLE t2; +CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT, +UNIQUE wrong_key9(d), +KEY wrong_key10(a), +PRIMARY KEY expected_key(c,b)) ENGINE=innodb; +INSERT INTO t2 SELECT d DIV 10, d MOD 41, d MOD 37, d FROM t1; +# Slave will crash if using the wrong or no index +SET GLOBAL debug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan,slave_crash_if_index_scan"; +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; +SET GLOBAL debug=""; +SELECT * FROM t2 WHERE d IN (10042,53); +a b c d +4 1 5 10042 +DROP TABLE t2; +CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT, e INT, +UNIQUE wrong_key11(e), +KEY wrong_key12(a), +KEY expected_key(c,b)) ENGINE=innodb; +INSERT INTO t2 SELECT d DIV 10, d MOD 41, d MOD 37, d, IF(d<10, d, NULL) FROM t1; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status OK +# Slave will crash if using the wrong or no index +SET GLOBAL debug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan"; +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; +SET GLOBAL debug=""; +SELECT * FROM t2 WHERE d IN (10042,53); +a b c d e +4 1 5 10042 NULL +DROP TABLE t2; +CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT, e INT, +KEY wrong_key13(a), +UNIQUE expected_key(e), +KEY wrong_key14(c,b)) ENGINE=innodb; +INSERT INTO t2 SELECT d DIV 10, d MOD 41, d MOD 37, d, IF(d<10, d, NULL) FROM t1; +# Slave will crash if using the wrong or no index +SET GLOBAL debug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan"; +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; +SET GLOBAL debug=""; +SELECT * FROM t2 WHERE d IN (10042,53); +a b c d e +4 1 5 10042 NULL +DROP TABLE t2; +CREATE TABLE t2 (a INT NOT NULL, d INT) ENGINE=innodb; +INSERT INTO t2 SELECT d DIV 10, d FROM t1; +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; +SELECT * FROM t2 WHERE d IN (10042,53); +a d +4 10042 +DROP TABLE t2; +DROP TABLE t1; +SET GLOBAL debug=""; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_loaddata_concurrent.result b/mysql-test/suite/rpl/r/rpl_row_loaddata_concurrent.result index 988be2b84d0..b73d15ab8bf 100644 --- a/mysql-test/suite/rpl/r/rpl_row_loaddata_concurrent.result +++ b/mysql-test/suite/rpl/r/rpl_row_loaddata_concurrent.result @@ -42,6 +42,8 @@ drop table t3; create table t1(a int, b int, unique(b)); insert into t1 values(1,10); load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1; +call mtr.add_suppression("Slave SQL.*Error .Duplicate entry .10. for key .b.. on query.* Error_code: 1062"); +call mtr.add_suppression("Slave SQL.*Query caused different errors on master and slave.*Error on master:.*error code=1062.*Error on slave:.*Error_code: 0"); include/wait_for_slave_sql_error_and_skip.inc [errno=1062] include/check_slave_no_error.inc set sql_log_bin=0; diff --git a/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result index 4106dc93198..ff56fb1f68c 100644 --- a/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result @@ -505,8 +505,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_3) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_3) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -516,8 +514,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_3) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_3) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -529,8 +525,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_4) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_4) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -540,8 +534,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_4) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_4) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -555,8 +547,6 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_5) master-bin.000001 # Table_map # # table_id: # (test.nt_6) master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_5) master-bin.000001 # Table_map # # table_id: # (test.tt_6) master-bin.000001 # Write_rows # # table_id: # @@ -572,8 +562,6 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_5) master-bin.000001 # Table_map # # table_id: # (test.nt_6) master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_5) master-bin.000001 # Table_map # # table_id: # (test.tt_6) master-bin.000001 # Write_rows # # table_id: # @@ -589,8 +577,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_4) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_4) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -600,8 +586,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_4) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_4) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -613,8 +597,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_3) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_3) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -624,8 +606,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.nt_3) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_3) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -641,8 +621,6 @@ master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_5) master-bin.000001 # Table_map # # table_id: # (test.tt_6) master-bin.000001 # Write_rows # # table_id: # @@ -658,8 +636,6 @@ master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_5) master-bin.000001 # Table_map # # table_id: # (test.tt_6) master-bin.000001 # Write_rows # # table_id: # diff --git a/mysql-test/suite/rpl/r/rpl_spec_variables.result b/mysql-test/suite/rpl/r/rpl_spec_variables.result index 785913134a7..96f63a50ea9 100644 --- a/mysql-test/suite/rpl/r/rpl_spec_variables.result +++ b/mysql-test/suite/rpl/r/rpl_spec_variables.result @@ -169,7 +169,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( diff --git a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result index 6b8d8b9407e..96d2a337e7c 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result +++ b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result @@ -1,6 +1,6 @@ include/master-slave.inc [connection master] -create table t1 (a int); +create table t1 (a int) ENGINE=MyISAM; insert into t1 values (10); create table t2 (a int) ENGINE=MyISAM; create table t3 (a int) engine=merge union(t1); diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result index ed1d9a6f226..9047825d565 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_until.result +++ b/mysql-test/suite/rpl/r/rpl_stm_until.result @@ -1,5 +1,6 @@ include/master-slave.inc [connection master] +include/rpl_reset.inc [on slave] include/stop_slave.inc ==== Create some events on master ==== @@ -33,7 +34,7 @@ n 3 4 include/check_slave_param.inc [Exec_Master_Log_Pos] -start slave until relay_log_file='slave-relay-bin.000003', relay_log_pos=RELAY_LOG_POS; +start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=RELAY_LOG_POS; include/wait_for_slave_io_to_start.inc include/wait_for_slave_sql_to_stop.inc select * from t2; @@ -95,6 +96,7 @@ drop table t1; start slave; include/rpl_reset.inc flush logs; +drop table if exists t1; stop slave; flush logs; flush logs; diff --git a/mysql-test/suite/rpl/r/rpl_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stop_slave.result index 588d9bbabf5..4a802432234 100644 --- a/mysql-test/suite/rpl/r/rpl_stop_slave.result +++ b/mysql-test/suite/rpl/r/rpl_stop_slave.result @@ -34,6 +34,7 @@ STOP SLAVE SQL_THREAD; [ On Slave1 ] # To resume slave SQL thread SET DEBUG_SYNC= 'now SIGNAL signal.continue'; +SET DEBUG_SYNC= 'now WAIT_FOR signal.continued'; SET DEBUG_SYNC= 'RESET'; [ On Slave ] @@ -62,6 +63,7 @@ STOP SLAVE SQL_THREAD; [ On Slave1 ] # To resume slave SQL thread SET DEBUG_SYNC= 'now SIGNAL signal.continue'; +SET DEBUG_SYNC= 'now WAIT_FOR signal.continued'; SET DEBUG_SYNC= 'RESET'; [ On Slave ] @@ -111,6 +113,7 @@ STOP SLAVE; ROLLBACK; [connection master] SET DEBUG_SYNC= 'now SIGNAL signal.continue'; +SET DEBUG_SYNC= 'now WAIT_FOR signal.continued'; SET DEBUG_SYNC= 'RESET'; [connection slave] include/wait_for_slave_to_stop.inc diff --git a/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result index 33666defaa4..7fcb0601ebf 100644 --- a/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result +++ b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result @@ -135,6 +135,8 @@ create table t2 ENGINE=MyISAM select rpad(UUID(),100,' '); create table t3 select 1 union select UUID(); create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3); create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); +Warnings: +Warning 1292 Incorrect datetime value: '3' insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4); create procedure foo() begin diff --git a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result index ec7a10f8142..78e15c1d491 100644 --- a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result +++ b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result @@ -91,9 +91,8 @@ master-bin.000001 # Query # # COMMIT BEGIN; DROP TEMPORARY TABLE t1; -# The rows event will binlogged before 'DROP TEMPORARY TABLE t1', -# as t1 is non-transactional table -INSERT INTO t1 SELECT Rand(); +# The rows event will binlogged after 'INSERT INTO t1 VALUES(1)' +INSERT INTO t1 VALUES(uuid()+0); COMMIT; show binlog events in 'master-bin.000001' from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info diff --git a/mysql-test/suite/rpl/r/rpl_temporary.result b/mysql-test/suite/rpl/r/rpl_temporary.result index 73821172d92..b5458a7a11a 100644 --- a/mysql-test/suite/rpl/r/rpl_temporary.result +++ b/mysql-test/suite/rpl/r/rpl_temporary.result @@ -1,7 +1,7 @@ -include/master-slave.inc -[connection master] SET sql_log_bin = 0; SET sql_log_bin = 1; +include/master-slave.inc +[connection master] reset master; DROP TABLE IF EXISTS t1; CREATE TEMPORARY TABLE t1 (a char(1)); diff --git a/mysql-test/suite/rpl/r/rpl_temporary_errors.result b/mysql-test/suite/rpl/r/rpl_temporary_errors.result index 4a9a8e1dad4..36dad2235f8 100644 --- a/mysql-test/suite/rpl/r/rpl_temporary_errors.result +++ b/mysql-test/suite/rpl/r/rpl_temporary_errors.result @@ -1,6 +1,7 @@ include/master-slave.inc [connection master] call mtr.add_suppression("Deadlock found"); +call mtr.add_suppression("Can't find record in 't.'"); **** On Master **** CREATE TABLE t1 (a INT PRIMARY KEY, b INT); INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4); diff --git a/mysql-test/suite/rpl/rpl_1slave_base.cnf b/mysql-test/suite/rpl/rpl_1slave_base.cnf index 813024bd3f0..a7a7f5c6218 100644 --- a/mysql-test/suite/rpl/rpl_1slave_base.cnf +++ b/mysql-test/suite/rpl/rpl_1slave_base.cnf @@ -7,7 +7,9 @@ # Run the master.sh script before starting this process #!run-master-sh -log-bin= master-bin +log-basename= master +# log-bin= master-bin +# relay-log= master-relay-bin [mysqld.2] # Run the slave.sh script before starting this process @@ -17,7 +19,8 @@ log-bin= master-bin # starting the mysqld #!use-slave-opt -relay-log= slave-relay-bin +log-basename= slave +# relay-log= slave-relay-bin init-rpl-role= slave log-slave-updates diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt b/mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt new file mode 100644 index 00000000000..79ed6f96a4a --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt @@ -0,0 +1 @@ +--replicate-ignore-table=test.t_ignored1 diff --git a/mysql-test/suite/rpl/t/rpl_binlog_corruption.test b/mysql-test/suite/rpl/t/rpl_binlog_corruption.test index 6717bda0fa7..66b0c80f6ad 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_corruption.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_corruption.test @@ -18,7 +18,7 @@ --source include/master-slave.inc # BUG#40482 only manifested itself in debug-compiled binaries. -source include/have_debug.inc; +-- source include/have_debug.inc --connection slave call mtr.add_suppression('Found invalid event in binary log'); diff --git a/mysql-test/suite/rpl/t/rpl_bug38694.test b/mysql-test/suite/rpl/t/rpl_bug38694.test index 48f950ad6ef..57d7dde0338 100644 --- a/mysql-test/suite/rpl/t/rpl_bug38694.test +++ b/mysql-test/suite/rpl/t/rpl_bug38694.test @@ -7,5 +7,7 @@ source include/master-slave.inc; +call mtr.add_suppression("Aborted connection"); + # End of tests --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_change_master.test b/mysql-test/suite/rpl/t/rpl_change_master.test index c31359a84d8..5e170d5acce 100644 --- a/mysql-test/suite/rpl/t/rpl_change_master.test +++ b/mysql-test/suite/rpl/t/rpl_change_master.test @@ -3,6 +3,7 @@ # I/O thread left (some old bug fixed in 4.0.17) source include/master-slave.inc; +call mtr.add_suppression("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum"); connection master; # Make SQL slave thread advance a bit diff --git a/mysql-test/suite/rpl/t/rpl_checksum-master.opt b/mysql-test/suite/rpl/t/rpl_checksum-master.opt new file mode 100644 index 00000000000..a6e99a9fd5a --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_checksum-master.opt @@ -0,0 +1 @@ +--binlog-checksum=CRC32 diff --git a/mysql-test/suite/rpl/t/rpl_checksum.test b/mysql-test/suite/rpl/t/rpl_checksum.test new file mode 100644 index 00000000000..237fffaf33e --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_checksum.test @@ -0,0 +1,264 @@ +# WL2540 replication events checksum +# Testing configuration parameters + +--source include/master-slave.inc +--source include/have_debug.inc +--source include/have_binlog_format_mixed.inc + +call mtr.add_suppression('Slave can not handle replication events with the checksum that master is configured to log'); +call mtr.add_suppression('Replication event checksum verification failed'); +# due to C failure simulation +call mtr.add_suppression('Relay log write failure: could not queue event from master'); +call mtr.add_suppression('Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process them'); + +# A. read/write access to the global vars: +# binlog_checksum master_verify_checksum slave_sql_verify_checksum + +connection master; + +set @master_save_binlog_checksum= @@global.binlog_checksum; +set @save_master_verify_checksum = @@global.master_verify_checksum; + +select @@global.binlog_checksum as 'must be CRC32 because of the command line option'; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.binlog_checksum as 'no session var'; + +select @@global.master_verify_checksum as 'must be zero because of default'; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.master_verify_checksum as 'no session var'; + +connection slave; + +set @slave_save_binlog_checksum= @@global.binlog_checksum; +set @save_slave_sql_verify_checksum = @@global.slave_sql_verify_checksum; + +select @@global.slave_sql_verify_checksum as 'must be one because of default'; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.slave_sql_verify_checksum as 'no session var'; + +connection master; + +source include/show_binary_logs.inc; +set @@global.binlog_checksum = NONE; +select @@global.binlog_checksum; +--echo *** must be rotations seen *** +source include/show_binary_logs.inc; + +set @@global.binlog_checksum = default; +select @@global.binlog_checksum; + +# testing lack of side-effects in non-effective update of binlog_checksum: +set @@global.binlog_checksum = CRC32; +select @@global.binlog_checksum; +set @@global.binlog_checksum = CRC32; + +set @@global.master_verify_checksum = 0; +set @@global.master_verify_checksum = default; + +--error ER_WRONG_VALUE_FOR_VAR +set @@global.binlog_checksum = ADLER32; +--error ER_WRONG_VALUE_FOR_VAR +set @@global.master_verify_checksum = 2; # the var is of bool type + +connection slave; + +set @@global.slave_sql_verify_checksum = 0; +set @@global.slave_sql_verify_checksum = default; +--error ER_WRONG_VALUE_FOR_VAR +set @@global.slave_sql_verify_checksum = 2; # the var is of bool type + +# +# B. Old Slave to New master conditions +# +# while master does not send a checksum-ed binlog the Old Slave can +# work with the New Master + +connection master; + +set @@global.binlog_checksum = NONE; +create table t1 (a int); + +# testing that binlog rotation preserves opt_binlog_checksum value +flush logs; +flush logs; +flush logs; + +sync_slave_with_master; +#connection slave; +# checking that rotation on the slave side leaves slave stable +flush logs; +flush logs; +flush logs; +select count(*) as zero from t1; + +source include/stop_slave.inc; + +connection master; +set @@global.binlog_checksum = CRC32; +insert into t1 values (1) /* will not be applied on slave due to simulation */; + +# instruction to the dump thread + +connection slave; +set @@global.debug='d,simulate_slave_unaware_checksum'; +start slave; +--let $slave_io_errno= 1236 +--let $show_slave_io_error= 1 +source include/wait_for_slave_io_error.inc; + +select count(*) as zero from t1; + +###connection master; +set @@global.debug=''; + +connection slave; +source include/start_slave.inc; + +# +# C. checksum failure simulations +# + +# C1. Failure by a client thread +connection master; +set @@global.master_verify_checksum = 1; +set @@session.debug='d,simulate_checksum_test_failure'; +--error ER_ERROR_WHEN_EXECUTING_COMMAND +show binlog events; +set @@session.debug=''; +set @@global.master_verify_checksum = default; + +#connection master; +sync_slave_with_master; + +connection slave; +source include/stop_slave.inc; + +connection master; +create table t2 (a int); +let $pos_master= query_get_value(SHOW MASTER STATUS, Position, 1); + +connection slave; + +# C2. Failure by IO thread +# instruction to io thread +set @@global.debug='d,simulate_checksum_test_failure'; +start slave io_thread; +--let $slave_io_errno= 1595 +--let $show_slave_io_error= 1 +source include/wait_for_slave_io_error.inc; +set @@global.debug=''; + +# to make IO thread re-read it again w/o the failure +start slave io_thread; +let $slave_param= Read_Master_Log_Pos; +let $slave_param_value= $pos_master; +source include/wait_for_slave_param.inc; + +# C3. Failure by SQL thread +# instruction to sql thread; +set @@global.slave_sql_verify_checksum = 1; + +set @@global.debug='d,simulate_checksum_test_failure'; + +start slave sql_thread; +--let $slave_sql_errno= 1593 +--let $show_slave_sql_error= 1 +source include/wait_for_slave_sql_error.inc; + +# resuming SQL thread to parse out the event w/o the failure + +set @@global.debug=''; +source include/start_slave.inc; + +connection master; +sync_slave_with_master; + +#connection slave; +select count(*) as 'must be zero' from t2; + +# +# D. Reset slave, Change-Master, Binlog & Relay-log rotations with +# random value on binlog_checksum on both master and slave +# +connection slave; +stop slave; +reset slave; + +# randomize slave server's own checksum policy +set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); +flush logs; + +connection master; +set @@global.binlog_checksum= CRC32; +reset master; +flush logs; +create table t3 (a int, b char(5)); + +connection slave; +source include/start_slave.inc; + +connection master; +sync_slave_with_master; + +#connection slave; +select count(*) as 'must be zero' from t3; +source include/stop_slave.inc; +--replace_result $MASTER_MYPORT MASTER_PORT +eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root'; + +connection master; +flush logs; +reset master; +insert into t3 value (1, @@global.binlog_checksum); + +connection slave; +source include/start_slave.inc; +flush logs; + +connection master; +sync_slave_with_master; + +#connection slave; +select count(*) as 'must be one' from t3; + +connection master; +set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); +insert into t3 value (1, @@global.binlog_checksum); +sync_slave_with_master; + +#connection slave; + +#clean-up + +connection master; +drop table t1, t2, t3; +set @@global.binlog_checksum = @master_save_binlog_checksum; +set @@global.master_verify_checksum = @save_master_verify_checksum; + +# +# BUG#58564: flush_read_lock fails in mysql-trunk-bugfixing after merging with WL#2540 +# +# Sanity check that verifies that no assertions are triggered because +# of old FD events (generated by versions prior to server released with +# checksums feature) +# +# There is no need for query log, if something wrong this should trigger +# an assertion + +--disable_query_log + +BINLOG ' +MfmqTA8BAAAAZwAAAGsAAAABAAQANS41LjctbTMtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAx+apMEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA== +'; + +--enable_query_log + +#connection slave; +sync_slave_with_master; +set @@global.binlog_checksum = @slave_save_binlog_checksum; +set @@global.slave_sql_verify_checksum = @save_slave_sql_verify_checksum; + +--echo End of tests + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_checksum_cache.test b/mysql-test/suite/rpl/t/rpl_checksum_cache.test new file mode 100644 index 00000000000..5667d599aff --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_checksum_cache.test @@ -0,0 +1,255 @@ +-- source include/have_innodb.inc +-- source include/master-slave.inc + +--disable_warnings +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t2 set data=repeat.*'a', @act_size.*"); +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t1 values.* NAME_CONST.*'n',.*, @data .*"); +--enable_warnings + +connection master; +set @save_binlog_cache_size = @@global.binlog_cache_size; +set @save_binlog_checksum = @@global.binlog_checksum; +set @save_master_verify_checksum = @@global.master_verify_checksum; +set @@global.binlog_cache_size = 4096; +set @@global.binlog_checksum = CRC32; +set @@global.master_verify_checksum = 1; + +# restart slave to force the dump thread to verify events (on master side) +connection slave; +source include/stop_slave.inc; +source include/start_slave.inc; + +connection master; + +# +# Testing a critical part of checksum handling dealing with transaction cache. +# The cache's buffer size is set to be less than the transaction's footprint +# in binlog. +# +# To verify combined buffer-by-buffer read out of the file and fixing crc per event +# there are the following parts: +# +# 1. the event size is much less than the cache's buffer +# 2. the event size is bigger than the cache's buffer +# 3. the event size if approximately the same as the cache's buffer +# 4. all in above + +# +# 1. the event size is much less than the cache's buffer +# + +flush status; +show status like "binlog_cache_use"; +show status like "binlog_cache_disk_use"; +--disable_warnings +drop table if exists t1; +--enable_warnings + +# +# parameter to ensure the test slightly varies binlog content +# between different invocations +# +let $deviation_size=32; +eval create table t1 (a int PRIMARY KEY, b CHAR($deviation_size)) engine=innodb; + +# Now we are going to create transaction which is long enough so its +# transaction binlog will be flushed to disk... + +delimiter |; +create procedure test.p_init (n int, size int) +begin + while n > 0 do + select round(RAND() * size) into @act_size; + set @data = repeat('a', @act_size); + insert into t1 values(n, @data ); + set n= n-1; + end while; +end| + +delimiter ;| + +let $1 = 4000; # PB2 can run it slow to time out on following sync_slave_with_master:s + +begin; +--disable_warnings +# todo: check if it is really so. +#+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. +eval call test.p_init($1, $deviation_size); +--enable_warnings +commit; + +show status like "binlog_cache_use"; +--echo *** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; + +sync_slave_with_master; + +let $diff_tables=master:test.t1, slave:test.t1; +source include/diff_tables.inc; + +# undoing changes with verifying the above once again +connection master; + +begin; +delete from t1; +commit; + +sync_slave_with_master; + + +# +# 2. the event size is bigger than the cache's buffer +# +connection master; + +flush status; +let $t2_data_size= `select 3 * @@global.binlog_cache_size`; +let $t2_aver_size= `select 2 * @@global.binlog_cache_size`; +let $t2_max_rand= `select 1 * @@global.binlog_cache_size`; + +eval create table t2(a int auto_increment primary key, data VARCHAR($t2_data_size)) ENGINE=Innodb; +let $1=100; +--disable_query_log +begin; +while ($1) +{ + eval select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size; + set @data = repeat('a', @act_size); + insert into t2 set data = @data; + dec $1; +} +commit; +--enable_query_log +show status like "binlog_cache_use"; +--echo *** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; + +sync_slave_with_master; + +let $diff_tables=master:test.t2, slave:test.t2; +source include/diff_tables.inc; + +# undoing changes with verifying the above once again +connection master; + +begin; +delete from t2; +commit; + +sync_slave_with_master; + +# +# 3. the event size if approximately the same as the cache's buffer +# + +connection master; + +flush status; +let $t3_data_size= `select 2 * @@global.binlog_cache_size`; +let $t3_aver_size= `select (9 * @@global.binlog_cache_size) / 10`; +let $t3_max_rand= `select (2 * @@global.binlog_cache_size) / 10`; + +eval create table t3(a int auto_increment primary key, data VARCHAR($t3_data_size)) engine=innodb; + +let $1= 300; +--disable_query_log +begin; +while ($1) +{ + eval select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size; + insert into t3 set data= repeat('a', @act_size); + dec $1; +} +commit; +--enable_query_log +show status like "binlog_cache_use"; +--echo *** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; + +sync_slave_with_master; + +let $diff_tables=master:test.t3, slave:test.t3; +source include/diff_tables.inc; + +# undoing changes with verifying the above once again +connection master; + +begin; +delete from t3; +commit; + +sync_slave_with_master; + + +# +# 4. all in above +# + +connection master; +flush status; + +delimiter |; +eval create procedure test.p1 (n int) +begin + while n > 0 do + case (select (round(rand()*100) % 3) + 1) + when 1 then + select round(RAND() * $deviation_size) into @act_size; + set @data = repeat('a', @act_size); + insert into t1 values(n, @data); + when 2 then + begin + select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size; + insert into t2 set data=repeat('a', @act_size); + end; + when 3 then + begin + select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size; + insert into t3 set data= repeat('a', @act_size); + end; + end case; + set n= n-1; + end while; +end| +delimiter ;| + +let $1= 1000; +set autocommit= 0; +begin; +--disable_warnings +eval call test.p1($1); +--enable_warnings +commit; + +show status like "binlog_cache_use"; +--echo *** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; + +sync_slave_with_master; + +let $diff_tables=master:test.t1, slave:test.t1; +source include/diff_tables.inc; + +let $diff_tables=master:test.t2, slave:test.t2; +source include/diff_tables.inc; + +let $diff_tables=master:test.t3, slave:test.t3; +source include/diff_tables.inc; + + +connection master; + +begin; +delete from t1; +delete from t2; +delete from t3; +commit; + +drop table t1, t2, t3; +set @@global.binlog_cache_size = @save_binlog_cache_size; +set @@global.binlog_checksum = @save_binlog_checksum; +set @@global.master_verify_checksum = @save_master_verify_checksum; +drop procedure test.p_init; +drop procedure test.p1; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_corruption-master.opt b/mysql-test/suite/rpl/t/rpl_corruption-master.opt new file mode 100644 index 00000000000..2612c17aa67 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_corruption-master.opt @@ -0,0 +1 @@ +--binlog-checksum=CRC32 --master-verify-checksum=1 diff --git a/mysql-test/suite/rpl/t/rpl_corruption-slave.opt b/mysql-test/suite/rpl/t/rpl_corruption-slave.opt new file mode 100644 index 00000000000..b32a52403c2 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_corruption-slave.opt @@ -0,0 +1 @@ +--binlog-checksum=CRC32 --slave-sql-verify-checksum=1 diff --git a/mysql-test/suite/rpl/t/rpl_corruption.test b/mysql-test/suite/rpl/t/rpl_corruption.test new file mode 100644 index 00000000000..a46325bf1f4 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_corruption.test @@ -0,0 +1,165 @@ +############################################################ +# Purpose: WL#5064 Testing with corrupted events. +# The test emulates the corruption at the vary stages +# of replication: +# - in binlog file +# - in network +# - in relay log +############################################################ + +# +# The tests intensively utilize @@global.debug. Note, +# Bug#11765758 - 58754, +# @@global.debug is read by the slave threads through dbug-interface. +# Hence, before a client thread set @@global.debug we have to ensure that: +# (a) the slave threads are stopped, or (b) the slave threads are in +# sync and waiting. + +--source include/have_debug.inc +--source include/master-slave.inc + +# Block legal errors for MTR +call mtr.add_suppression('Found invalid event in binary log'); +call mtr.add_suppression('Slave I/O: Relay log write failure: could not queue event from master'); +call mtr.add_suppression('event read from binlog did not pass crc check'); +call mtr.add_suppression('Replication event checksum verification failed'); +call mtr.add_suppression('Event crc check failed! Most likely there is event corruption'); +call mtr.add_suppression('Slave SQL: Error initializing relay log position: I/O error reading event at position .*, Error_code: 1593'); + +SET @old_master_verify_checksum = @@master_verify_checksum; + +# Creating test table/data and set corruption position for testing +--echo # 1. Creating test table/data and set corruption position for testing +--connection master +--echo * insert/update/delete rows in table t1 * +# Corruption algorithm modifies only the first event and +# then will be reset. To avoid checking always the first event +# from binlog (usually it is FD) we randomly execute different +# statements and set position for corruption inside events. + +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100)); +--disable_query_log +let $i=`SELECT 3+CEILING(10*RAND())`; +let $j=1; +let $pos=0; +while ($i) { + eval INSERT INTO t1 VALUES ($j, 'a', NULL); + if (`SELECT RAND() > 0.7`) + { + eval UPDATE t1 SET c = REPEAT('a', 20) WHERE a = $j; + } + if (`SELECT RAND() > 0.8`) + { + eval DELETE FROM t1 WHERE a = $j; + } + if (!$pos) { + let $pos= query_get_value(SHOW MASTER STATUS, Position, 1); + --sync_slave_with_master + --source include/stop_slave.inc + --disable_query_log + --connection master + } + dec $i; + inc $j; +} +--enable_query_log + + +# Emulate corruption in binlog file when SHOW BINLOG EVENTS is executing +--echo # 2. Corruption in master binlog and SHOW BINLOG EVENTS +SET GLOBAL debug="+d,corrupt_read_log_event_char"; +--echo SHOW BINLOG EVENTS; +--disable_query_log +send_eval SHOW BINLOG EVENTS FROM $pos; +--enable_query_log +--error ER_ERROR_WHEN_EXECUTING_COMMAND +reap; + +SET GLOBAL debug="-d,corrupt_read_log_event_char"; + +# Emulate corruption on master with crc checking on master +--echo # 3. Master read a corrupted event from binlog and send the error to slave + +# We have a rare but nasty potential race here: if the dump thread on +# the master for the _old_ slave connection has not yet discovered +# that the slave has disconnected, we will inject the corrupt event on +# the wrong connection, and the test will fail +# (+d,corrupt_read_log_event2 corrupts only one event). +# So kill any lingering dump thread (we need to kill; otherwise dump thread +# could manage to send all events down the socket before seeing it close, and +# hang forever waiting for new binlog events to be created). +let $id= `select id from information_schema.processlist where command = "Binlog Dump"`; +if ($id) +{ + --disable_query_log + --error 0,1094 + eval kill $id; + --enable_query_log +} +let $wait_condition= + SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE command = 'Binlog Dump'; +--source include/wait_condition.inc + +SET GLOBAL debug="+d,corrupt_read_log_event2"; +--connection slave +START SLAVE IO_THREAD; +let $slave_io_errno= 1236; +--source include/wait_for_slave_io_error.inc +--connection master +SET GLOBAL debug="-d,corrupt_read_log_event2"; + +# Emulate corruption on master without crc checking on master +--echo # 4. Master read a corrupted event from binlog and send it to slave +--connection master +SET GLOBAL master_verify_checksum=0; +SET GLOBAL debug="+d,corrupt_read_log_event2"; +--connection slave +START SLAVE IO_THREAD; +let $slave_io_errno= 1595,1722; +--source include/wait_for_slave_io_error.inc +--connection master +SET GLOBAL debug="-d,corrupt_read_log_event2"; +SET GLOBAL debug= ""; +SET GLOBAL master_verify_checksum=1; + +# Emulate corruption in network +--echo # 5. Slave. Corruption in network +--connection slave +SET GLOBAL debug="+d,corrupt_queue_event"; +START SLAVE IO_THREAD; +let $slave_io_errno= 1595,1722; +--source include/wait_for_slave_io_error.inc +SET GLOBAL debug="-d,corrupt_queue_event"; + +# Emulate corruption in relay log +--echo # 6. Slave. Corruption in relay log + +SET GLOBAL debug="+d,corrupt_read_log_event_char"; + +START SLAVE SQL_THREAD; +let $slave_sql_errno= 1593; +--source include/wait_for_slave_sql_error.inc + +SET GLOBAL debug="-d,corrupt_read_log_event_char"; +SET GLOBAL debug= ""; + +# Start normal replication and compare same table on master +# and slave +--echo # 7. Seek diff for tables on master and slave +--connection slave +--source include/start_slave.inc +--connection master +--sync_slave_with_master +let $diff_tables= master:test.t1, slave:test.t1; +--source include/diff_tables.inc + +# Clean up +--echo # 8. Clean up +--connection master +SET GLOBAL debug= ""; +SET GLOBAL master_verify_checksum = @old_master_verify_checksum; +DROP TABLE t1; +--sync_slave_with_master +SET GLOBAL debug= ""; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test b/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test index 4e24b9a8133..c9658105847 100644 --- a/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test +++ b/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test @@ -139,7 +139,7 @@ INSERT INTO t2 VALUES (2), (2); CREATE VIEW v1 AS SELECT id FROM t2; --let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1) -CREATE TABLE IF NOT EXISTS v1(a int, b int) SELECT id, id FROM t1; +CREATE TABLE IF NOT EXISTS v1(a int, b int) SELECT id, id as di FROM t1; --source include/show_binlog_events.inc SHOW CREATE TABLE v1; diff --git a/mysql-test/suite/rpl/t/rpl_deadlock_innodb.test b/mysql-test/suite/rpl/t/rpl_deadlock_innodb.test index b2d4e42a973..14776263516 100644 --- a/mysql-test/suite/rpl/t/rpl_deadlock_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_deadlock_innodb.test @@ -1,4 +1,5 @@ -- source include/not_ndb_default.inc -- source include/have_innodb.inc +-- source include/long_test.inc let $engine_type=innodb; -- source extra/rpl_tests/rpl_deadlock.test diff --git a/mysql-test/suite/rpl/t/rpl_hrtime.test b/mysql-test/suite/rpl/t/rpl_hrtime.test new file mode 100644 index 00000000000..98b08abec67 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_hrtime.test @@ -0,0 +1,7 @@ +--source include/have_binlog_format_mixed_or_statement.inc + +--source suite/rpl/include/hrtime.inc + +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 + diff --git a/mysql-test/suite/rpl/t/rpl_hrtime_row.test b/mysql-test/suite/rpl/t/rpl_hrtime_row.test new file mode 100644 index 00000000000..e1d49f5324b --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_hrtime_row.test @@ -0,0 +1,3 @@ +--source include/have_binlog_format_row.inc +--source suite/rpl/include/hrtime.inc + diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table.test b/mysql-test/suite/rpl/t/rpl_ignore_table.test index 233206c4135..c9ecce219a5 100644 --- a/mysql-test/suite/rpl/t/rpl_ignore_table.test +++ b/mysql-test/suite/rpl/t/rpl_ignore_table.test @@ -2,6 +2,10 @@ source include/master-slave.inc; let collation=utf8_unicode_ci; --source include/have_collation.inc +call mtr.add_suppression("Can't find record in 't.'"); +call mtr.add_suppression("Can't find record in 'user'"); +call mtr.add_suppression("Can't find record in 'tables_priv'"); + # # BUG#16487 # diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test b/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test index 782c01ec04f..afc0c2cbd4b 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test +++ b/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test @@ -127,11 +127,17 @@ delimiter ;| ############ Test Section ################### +begin; CALL test.proc_norm(); +commit; SELECT count(*) as "Master regular" FROM test.regular_tbl; +begin; CALL test.proc_bykey(); +commit; SELECT count(*) as "Master bykey" FROM test.bykey_tbl; +begin; CALL test.proc_byrange(); +commit; SELECT count(*) as "Master byrange" FROM test.byrange_tbl; --sync_slave_with_master diff --git a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test index f4b854eff87..db182d477a1 100644 --- a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test +++ b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test @@ -4,11 +4,14 @@ # imitate the bug, so it has to stop). source include/have_debug.inc; +# because of pretend_version_50034_in_binlog the test can't run with checksum +source include/have_binlog_checksum_off.inc; source include/master-slave.inc; # Currently only statement-based-specific bugs are here -- source include/have_binlog_format_mixed_or_statement.inc + # # This is to test that slave properly detects if # master may suffer from: diff --git a/mysql-test/suite/rpl/t/rpl_log_pos.test b/mysql-test/suite/rpl/t/rpl_log_pos.test index 44837e45715..e3d8c7ffc02 100644 --- a/mysql-test/suite/rpl/t/rpl_log_pos.test +++ b/mysql-test/suite/rpl/t/rpl_log_pos.test @@ -33,6 +33,7 @@ let $slave_io_errno= 1236; let $show_slave_io_error= 1; source include/wait_for_slave_io_error.inc; source include/stop_slave_sql.inc; +--enable_warnings connection master; source include/show_master_status.inc; diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.test b/mysql-test/suite/rpl/t/rpl_rotate_logs.test index 6e2a7e22352..77ce540ff36 100644 --- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test +++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test @@ -144,7 +144,10 @@ select * from t2; connection master; create temporary table temp_table (a char(80) not null); insert into temp_table values ("testing temporary tables part 2"); -let $1=100; + +# the nummber of produced logs is sensitive to whether checksum is NONE or CRC32 +# the value of 91 makes it even +let $1=91; create table t3 (n int); disable_query_log; diff --git a/mysql-test/suite/rpl/t/rpl_row_annotate_do-slave.opt b/mysql-test/suite/rpl/t/rpl_row_annotate_do-slave.opt new file mode 100644 index 00000000000..aa3af621897 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_annotate_do-slave.opt @@ -0,0 +1 @@ +--log-slave-updates --replicate-annotate-rows-events --replicate-ignore-table=test1.xt1 --replicate-ignore-table=test1.xt2
\ No newline at end of file diff --git a/mysql-test/suite/rpl/t/rpl_row_annotate_do.test b/mysql-test/suite/rpl/t/rpl_row_annotate_do.test new file mode 100644 index 00000000000..b61ce0ab6d8 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_annotate_do.test @@ -0,0 +1,16 @@ +############################################################################### +# WL47: Store in binlog text of statements that caused RBR events +# Wrapper for extra/rpl/rpl_row_annotate.test. +# Intended to test that if the --replicate-annotate-rows-events option +# is switched on on slave then Annotate_events: +# - are reproduced on slave +# - are reproduced only once for "multi-table-maps" rbr queries +# - are not reproduced when the corresponding queries are filtered away +# on replication +# - are reproduced when the corresponding queries are filtered away partialy +# (e.g. in case of multi-delete) +# - are not generated on slave for queries that are not annotated on master. +############################################################################### + +--source include/have_binlog_format_row.inc +--source extra/rpl_tests/rpl_row_annotate.test diff --git a/mysql-test/suite/rpl/t/rpl_row_annotate_dont-slave.opt b/mysql-test/suite/rpl/t/rpl_row_annotate_dont-slave.opt new file mode 100644 index 00000000000..74ac3bfefcb --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_annotate_dont-slave.opt @@ -0,0 +1 @@ +--log-slave-updates --replicate-ignore-table=test1.xt1 --replicate-ignore-table=test1.xt2
\ No newline at end of file diff --git a/mysql-test/suite/rpl/t/rpl_row_annotate_dont.test b/mysql-test/suite/rpl/t/rpl_row_annotate_dont.test new file mode 100644 index 00000000000..56765c591aa --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_annotate_dont.test @@ -0,0 +1,9 @@ +############################################################################### +# WL47: Store in binlog text of statements that caused RBR events +# Wrapper for extra/rpl/rpl_row_annotate.test. +# Intended to test that if the --replicate-annotate-rows-events option +# is switched off on slave then Annotate_events are not reproduced. +############################################################################### + +--source include/have_binlog_format_row.inc +--source extra/rpl_tests/rpl_row_annotate.test diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test index 8cd021e88fc..23832cd6298 100644 --- a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test +++ b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test @@ -1,3 +1,4 @@ +-- source include/have_query_cache.inc --source include/have_binlog_format_row.inc --source include/have_innodb.inc @@ -5,10 +6,13 @@ let $SERVER_VERSION=`select version()`; #This test case is not written for NDB, the result files #will not match when NDB is the default engine --- source include/not_ndb_default.inc +--source include/not_ndb_default.inc --source include/master-slave.inc +# Add suppression for expected warning(s) in slaves error log +call mtr.add_suppression("Can't find record in 't.'"); + # Bug#15942 (RBR ignores --binlog_ignore_db and tries to map to table # on slave for writes) diff --git a/mysql-test/suite/rpl/t/rpl_row_conflicts.test b/mysql-test/suite/rpl/t/rpl_row_conflicts.test index ce5332966ef..0f525e0f58d 100644 --- a/mysql-test/suite/rpl/t/rpl_row_conflicts.test +++ b/mysql-test/suite/rpl/t/rpl_row_conflicts.test @@ -9,6 +9,7 @@ source include/master-slave.inc; connection slave; call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: .*"); +call mtr.add_suppression("Can't find record in 't.'"); --echo [on slave] connection slave; diff --git a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test index 2e58f426f14..2429dbc1142 100644 --- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test +++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test @@ -1,7 +1,8 @@ # depends on the binlog output -- source include/have_binlog_format_row.inc +--source include/binlog_start_pos.inc -let $rename_event_pos= 912; +let $rename_event_pos= `select @binlog_start_pos + 819`; # Bug#18326: Do not lock table for writing during prepare of statement # The use of the ps protocol causes extra table maps in the binlog, so diff --git a/mysql-test/suite/rpl/t/rpl_row_index_choice.test b/mysql-test/suite/rpl/t/rpl_row_index_choice.test new file mode 100644 index 00000000000..d393c65438a --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_index_choice.test @@ -0,0 +1,243 @@ +--source include/have_binlog_format_row.inc +--source include/master-slave.inc +--source include/have_debug.inc +--source include/have_innodb.inc + +# Bug#58997: Row-based replication breaks on table with only fulltext index: +connection master; +CREATE TABLE t1 (a int, b varchar(100), fulltext(b)) engine=MyISAM; +INSERT INTO t1 VALUES (1,"a"), (2,"b"); +UPDATE t1 SET b='A' WHERE a=1; +DELETE FROM t1 WHERE a=2; + +sync_slave_with_master; + +connection slave; + +SELECT * FROM t1 ORDER BY a; + +connection master; +DROP TABLE t1; + + +# A utility table used to populate subsequent tables in various ways. +connection master; +CREATE TABLE t1 (d INT PRIMARY KEY) ENGINE=myisam; +INSERT INTO t1 VALUES (0); +INSERT INTO t1 SELECT d+1 FROM t1; +INSERT INTO t1 SELECT d+2 FROM t1; +INSERT INTO t1 SELECT d+4 FROM t1; +INSERT INTO t1 SELECT d+8 FROM t1; +INSERT INTO t1 SELECT d+16 FROM t1; +INSERT INTO t1 SELECT d+32 FROM t1; +INSERT INTO t1 SELECT d+64 FROM t1; +INSERT INTO t1 SELECT d+128 FROM t1; +INSERT INTO t1 SELECT d+256 FROM t1; +INSERT INTO t1 SELECT d+512 FROM t1; + +# Test that we pick the better multi-column index, even if the +# single-column index is more selective in the first column. +CREATE TABLE t2 (a INT, b INT, c INT, d INT, + KEY wrong_key(a), + KEY expected_key(b,c), + KEY wrong_key2(c)) ENGINE=myisam; +INSERT INTO t2 SELECT d DIV 10, d MOD 41, d MOD 37, d FROM t1; + +sync_slave_with_master; +connection slave; +ANALYZE TABLE t2; +--echo # Slave will crash if using the wrong or no index +SET GLOBAL debug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan"; + +connection master; +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; + +sync_slave_with_master; +connection slave; +SET GLOBAL debug=""; +SELECT * FROM t2 WHERE d IN (10042,53); + +# Test that we don't pick a unique index with NULLS over a more selective +# non-unique index. +connection master; +DROP TABLE t2; +CREATE TABLE t2 (a INT, b INT, c INT, d INT NOT NULL, e INT, + UNIQUE wrong_key3(a,e), + KEY wrong_key4(b,c), + UNIQUE expected_key(d)) ENGINE=myisam; +INSERT INTO t2 SELECT d DIV 10, d MOD 41, d MOD 37, d, NULL FROM t1; + +sync_slave_with_master; +connection slave; +ANALYZE TABLE t2; +--echo # Slave will crash if using the wrong or no index +SET GLOBAL debug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan"; + +connection master; +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; + +sync_slave_with_master; +connection slave; +SET GLOBAL debug=""; +SELECT * FROM t2 WHERE d IN (10042,53); + +connection master; +DROP TABLE t2; + +# Test that we pick a reasonable index when there is no rec_per_key[] +# information (no ANALYZE TABLE). +CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT NOT NULL, + KEY wrong_key5(b), + UNIQUE expected_key(d), + KEY wrong_key6(c)) ENGINE=myisam; +INSERT INTO t2 SELECT d DIV 10, d MOD 41, d MOD 37, d FROM t1; + +sync_slave_with_master; +connection slave; +--echo # Slave will crash if using the wrong or no index +SET GLOBAL debug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan"; + +connection master; +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; + +sync_slave_with_master; +connection slave; +SET GLOBAL debug=""; +SELECT * FROM t2 WHERE d IN (10042,53); + +connection master; +DROP TABLE t2; + + +# Also test without ANALYZE when we pick the sub-optimal index. +# In this case the key on (d) is the best one, but without ANALYZE TABLE we +# have no information and will pick the first one on (b). +# (This test should be updated if we improve the index selection, of course). +CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT NOT NULL, + KEY expected_key(b), + KEY wrong_key7(d), + KEY wrong_key8(c)) ENGINE=myisam; +INSERT INTO t2 SELECT d DIV 10, d MOD 41, d MOD 37, d FROM t1; + +sync_slave_with_master; +connection slave; +--echo # Slave will crash if using the wrong or no index +SET GLOBAL debug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan"; + +connection master; +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; + +sync_slave_with_master; +connection slave; +SET GLOBAL debug=""; +SELECT * FROM t2 WHERE d IN (10042,53); + +connection master; +DROP TABLE t2; + + +# Test that we pick the primary key for InnoDB, if available. +CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT, + UNIQUE wrong_key9(d), + KEY wrong_key10(a), + PRIMARY KEY expected_key(c,b)) ENGINE=innodb; +INSERT INTO t2 SELECT d DIV 10, d MOD 41, d MOD 37, d FROM t1; + +sync_slave_with_master; +connection slave; +--echo # Slave will crash if using the wrong or no index +SET GLOBAL debug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan,slave_crash_if_index_scan"; + +connection master; +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; + +sync_slave_with_master; +connection slave; +SET GLOBAL debug=""; +SELECT * FROM t2 WHERE d IN (10042,53); + +connection master; +DROP TABLE t2; + + +# Test that we pick a good index for InnoDB when primary key is not available. +CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT, e INT, + UNIQUE wrong_key11(e), + KEY wrong_key12(a), + KEY expected_key(c,b)) ENGINE=innodb; +INSERT INTO t2 SELECT d DIV 10, d MOD 41, d MOD 37, d, IF(d<10, d, NULL) FROM t1; + +sync_slave_with_master; +connection slave; +ANALYZE TABLE t2; +--echo # Slave will crash if using the wrong or no index +SET GLOBAL debug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan"; + +connection master; +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; + +sync_slave_with_master; +connection slave; +SET GLOBAL debug=""; +SELECT * FROM t2 WHERE d IN (10042,53); + +connection master; +DROP TABLE t2; + + +# When there is no ANALYZE TABLE, InnoDB will just report "1" for index +# cardinality for all indexes in rec_per_key. So currently we cannot choose +# index to use intelligently. Just test that we work as expected (select +# first index, remember that unique keys are sorted first by server). +CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT, e INT, + KEY wrong_key13(a), + UNIQUE expected_key(e), + KEY wrong_key14(c,b)) ENGINE=innodb; +INSERT INTO t2 SELECT d DIV 10, d MOD 41, d MOD 37, d, IF(d<10, d, NULL) FROM t1; + +sync_slave_with_master; +connection slave; +--echo # Slave will crash if using the wrong or no index +SET GLOBAL debug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan"; + +connection master; +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; + +sync_slave_with_master; +connection slave; +SET GLOBAL debug=""; +SELECT * FROM t2 WHERE d IN (10042,53); + +connection master; +DROP TABLE t2; + + +# Finally, test behaviour when no indexes are available at all. +CREATE TABLE t2 (a INT NOT NULL, d INT) ENGINE=innodb; +INSERT INTO t2 SELECT d DIV 10, d FROM t1; + +UPDATE t2 SET d=10042 WHERE d=42; +DELETE FROM t2 WHERE d=53; + +sync_slave_with_master; +connection slave; +SELECT * FROM t2 WHERE d IN (10042,53); + +connection master; +DROP TABLE t2; + + +connection master; +DROP TABLE t1; +sync_slave_with_master; +connection slave; +SET GLOBAL debug=""; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp003.test b/mysql-test/suite/rpl/t/rpl_row_sp003.test index bd085610725..b5d62f60199 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp003.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp003.test @@ -10,6 +10,7 @@ -- source include/have_binlog_format_row.inc # Slow test, don't run during staging part -- source include/not_staging.inc +--source include/long_test.inc -- source include/master-slave.inc let $engine_type=INNODB; diff --git a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test index de021f3e3e1..83ef8699425 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test +++ b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test @@ -1,5 +1,6 @@ # depends on the binlog output --source include/have_binlog_format_mixed_or_statement.inc +--source include/binlog_start_pos.inc -let $rename_event_pos= 945; +let $rename_event_pos= `select @binlog_start_pos + 578`; -- source extra/rpl_tests/rpl_flsh_tbls.test diff --git a/mysql-test/suite/rpl/t/rpl_stm_maria.test b/mysql-test/suite/rpl/t/rpl_stm_maria.test index 5c531a32d80..d5a4c5c315a 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_maria.test +++ b/mysql-test/suite/rpl/t/rpl_stm_maria.test @@ -55,4 +55,5 @@ connection master; drop table t1,t2,t3; sync_slave_with_master; +# End of tests --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_until-master.opt b/mysql-test/suite/rpl/t/rpl_stm_until-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_stm_until-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test index 4e9ccc2b0cf..210b6b50fa8 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_until.test +++ b/mysql-test/suite/rpl/t/rpl_stm_until.test @@ -19,6 +19,7 @@ -- source include/have_binlog_format_mixed_or_statement.inc -- source include/master-slave.inc +-- source include/rpl_reset.inc # Test is dependent on binlog positions @@ -72,7 +73,7 @@ select * from t1; --let $slave_param_value= $master_log_pos_1 --source include/check_slave_param.inc -let $relay_log_file= slave-relay-bin.000003; +let $relay_log_file= slave-relay-bin.000004; let $master_log_pos= $master_log_pos_2; source include/get_relay_log_pos.inc; # try replicate all up to and not including the second insert to t2; @@ -198,6 +199,14 @@ sync_with_master; --source include/rpl_reset.inc connection master; +--disable_warnings +drop table if exists t1; # there is create table t1 in bug47142_master-bin.000001 +--enable_warnings +sync_slave_with_master; +connection slave; +stop slave; +connection master; + flush logs; let $MYSQLD_DATADIR= `select @@datadir`; --remove_file $MYSQLD_DATADIR/master-bin.000001 diff --git a/mysql-test/suite/rpl/t/rpl_stop_slave.test b/mysql-test/suite/rpl/t/rpl_stop_slave.test index 296b002dbb7..6a1b29da676 100644 --- a/mysql-test/suite/rpl/t/rpl_stop_slave.test +++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test @@ -104,6 +104,7 @@ ROLLBACK; --source include/rpl_connection_master.inc SET DEBUG_SYNC= 'now SIGNAL signal.continue'; +SET DEBUG_SYNC= 'now WAIT_FOR signal.continued'; SET DEBUG_SYNC= 'RESET'; --source include/rpl_connection_slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_sync-master.opt b/mysql-test/suite/rpl/t/rpl_sync-master.opt index ad327ce0454..04b06bfa0f2 100644 --- a/mysql-test/suite/rpl/t/rpl_sync-master.opt +++ b/mysql-test/suite/rpl/t/rpl_sync-master.opt @@ -1,2 +1,2 @@ --default-storage-engine=MyISAM ---innodb-file-per-table=0 +--loose-innodb-file-per-table=0 diff --git a/mysql-test/suite/rpl/t/rpl_sync-slave.opt b/mysql-test/suite/rpl/t/rpl_sync-slave.opt index 3816e61bb1e..43dc2062ff0 100644 --- a/mysql-test/suite/rpl/t/rpl_sync-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_sync-slave.opt @@ -1,2 +1,2 @@ ---sync-relay-log-info=1 --relay-log-recovery=1 --innodb_file_format_check=1 --default-storage-engine=MyISAM --innodb-file-per-table=0 +--sync-relay-log-info=1 --relay-log-recovery=1 --loose-innodb_file_format_check=1 --default-storage-engine=MyISAM --loose-innodb-file-per-table=0 --skip-core-file diff --git a/mysql-test/suite/rpl/t/rpl_table_options.test b/mysql-test/suite/rpl/t/rpl_table_options.test index 27eb0e393d2..12ff1ca457b 100644 --- a/mysql-test/suite/rpl/t/rpl_table_options.test +++ b/mysql-test/suite/rpl/t/rpl_table_options.test @@ -28,6 +28,8 @@ connection master; drop table t1; set storage_engine=default; select 1; + +# Cleanup uninstall plugin example; -source include/rpl_end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test index 4b94dae3de9..70a2063c23c 100644 --- a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test +++ b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test @@ -191,9 +191,8 @@ DROP TEMPORARY TABLE t1; # # INSERT INTO t1 VALUES(1); ---echo # The rows event will binlogged before 'DROP TEMPORARY TABLE t1', ---echo # as t1 is non-transactional table -INSERT INTO t1 SELECT Rand(); +--echo # The rows event will binlogged after 'INSERT INTO t1 VALUES(1)' +INSERT INTO t1 VALUES(uuid()+0); COMMIT; source include/show_binlog_events.inc; diff --git a/mysql-test/suite/rpl/t/rpl_temporary.test b/mysql-test/suite/rpl/t/rpl_temporary.test index 878589ef006..96ee31667b6 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary.test +++ b/mysql-test/suite/rpl/t/rpl_temporary.test @@ -1,11 +1,11 @@ --- source include/master-slave.inc - # Test need anonymous user when connection are made as "zedjzlcsjhd" # But we only need it on the master, not the slave. SET sql_log_bin = 0; source include/add_anonymous_users.inc; SET sql_log_bin = 1; +-- source include/master-slave.inc + # Clean up old slave's binlogs. # The slave is started with --log-slave-updates # and this test does SHOW BINLOG EVENTS on the slave's @@ -313,6 +313,7 @@ select * from t1; connection master; drop table t1; --remove_file $MYSQLTEST_VARDIR/tmp/bug14157.sql + --sync_slave_with_master # Delete the anonymous users. diff --git a/mysql-test/suite/rpl/t/rpl_temporary_errors.test b/mysql-test/suite/rpl/t/rpl_temporary_errors.test index 07b23e10847..250ccf4c1cd 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary_errors.test +++ b/mysql-test/suite/rpl/t/rpl_temporary_errors.test @@ -1,7 +1,9 @@ source include/have_binlog_format_row.inc; source include/master-slave.inc; +source include/have_innodb.inc; call mtr.add_suppression("Deadlock found"); +call mtr.add_suppression("Can't find record in 't.'"); --echo **** On Master **** connection master; @@ -33,5 +35,13 @@ call mtr.add_suppression("Slave SQL.*Could not execute Update_rows event on tabl --echo **** On Master **** connection master; DROP TABLE t1; +--sync_slave_with_master +--connection master + +# We must wait for the slave to stop. +# Otherwise the warnings in the error log about deadlock may be written to +# the error log only during shutdown, and currently the suppression of +# "Deadlock found" set in this test case is not effective during server +# shutdown. --source include/rpl_end.inc |