Commit 91e5e47a authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-30421 more tests cleaned up

All the .inc files that included from binlog_encryption are refactored.
parent bdf55806
--let $binlog_limit= 5,1
--source suite/rpl/include/rpl_binlog_errors.inc
--source suite/rpl/t/rpl_binlog_errors.test
--source suite/rpl/include/rpl_cant_read_event_incident.inc
--source suite/rpl/t/rpl_cant_read_event_incident.test
--source suite/rpl/include/rpl_checksum.inc
--source suite/rpl/t/rpl_checksum.test
--source suite/rpl/include/rpl_checksum_cache.inc
--source suite/rpl/t/rpl_checksum_cache.test
--source suite/rpl/include/rpl_corruption.inc
--source suite/rpl/t/rpl_corruption.test
......@@ -558,3 +558,27 @@ a
connection server_1;
DROP TABLE t1;
include/rpl_end.inc
#
# Start of 10.2 tests
#
#
# MDEV-10134 Add full support for DEFAULT
#
CREATE TABLE t1 (a VARCHAR(100) DEFAULT BINLOG_GTID_POS("master-bin.000001", 600));
ERROR HY000: Function or expression 'binlog_gtid_pos()' cannot be used in the DEFAULT clause of `a`
#
# End of 10.2 tests
#
#
# Start of 10.3 tests
#
#
# MDEV-13967 Parameter data type control for Item_long_func
#
SELECT MASTER_GTID_WAIT(ROW(1,1),'str');
ERROR HY000: Illegal parameter data type row for operation 'master_gtid_wait'
SELECT MASTER_GTID_WAIT('str',ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'master_gtid_wait'
#
# End of 10.3 tests
#
--source suite/rpl/include/rpl_gtid_basic.inc
--source suite/rpl/t/rpl_gtid_basic.test
--source suite/rpl/include/rpl_incident.inc
--source suite/rpl/t/rpl_incident.test
--source suite/rpl/include/rpl_init_slave_errors.inc
--source suite/rpl/t/rpl_init_slave_errors.test
--source suite/rpl/include/rpl_loaddata_local.inc
--source suite/rpl/t/rpl_loaddata_local.test
--source suite/rpl/include/rpl_loadfile.inc
--source suite/rpl/t/rpl_loadfile.test
--let $datadir= `SELECT @@datadir`
......
--source suite/rpl/include/rpl_packet.inc
--source suite/rpl/t/rpl_packet.test
--source suite/rpl/include/rpl_parallel_ignored_errors.inc
--source suite/rpl/t/rpl_parallel_ignored_errors.test
--source suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc
--source suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test
--source suite/rpl/include/rpl_relayrotate.inc
--source suite/rpl/t/rpl_relayrotate.test
--source suite/rpl/include/rpl_semi_sync.inc
--source suite/rpl/t/rpl_semi_sync.test
--let $use_remote_mysqlbinlog= 1
--source suite/rpl/include/rpl_skip_replication.inc
--source suite/rpl/t/rpl_skip_replication.test
--source suite/rpl/include/rpl_special_charset.inc
--source suite/rpl/t/rpl_special_charset.test
--source suite/rpl/include/rpl_sporadic_master.inc
--source suite/rpl/t/rpl_sporadic_master.test
--source suite/rpl/include/rpl_ssl.inc
--source suite/rpl/t/rpl_ssl.test
--source suite/rpl/include/rpl_stm_relay_ign_space.inc
--source suite/rpl/t/rpl_stm_relay_ign_space.test
--source suite/rpl/include/rpl_switch_stm_row_mixed.inc
--source suite/rpl/t/rpl_switch_stm_row_mixed.test
--source suite/rpl/include/rpl_sync_test.inc
--source suite/rpl/t/rpl_sync.test
--source suite/rpl/include/rpl_temporal_format_default_to_default.inc
--source suite/rpl/t/rpl_temporal_format_default_to_default.test
......@@ -3,4 +3,4 @@
--let $force_master_mysql56_temporal_format=false;
--let $force_slave_mysql56_temporal_format=true;
--source suite/rpl/include/rpl_temporal_format_default_to_default.inc
--source suite/rpl/t/rpl_temporal_format_default_to_default.test
--let $force_master_mysql56_temporal_format=true;
--let $force_slave_mysql56_temporal_format=false;
--source suite/rpl/include/rpl_temporal_format_default_to_default.inc
--source suite/rpl/t/rpl_temporal_format_default_to_default.test
--source suite/rpl/include/rpl_typeconv.inc
--source suite/rpl/t/rpl_typeconv.test
--source suite/rpl/include/rpl_switch_stm_row_mixed.inc
--source suite/rpl/t/rpl_switch_stm_row_mixed.test
This diff is collapsed.
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
#
# Bug#11747416 : 32228 A disk full makes binary log corrupt.
#
#
# The test demonstrates reading from binlog error propagation to slave
# and reporting there.
# Conditions for the bug include a crash at time of the last event to
# the binlog was written partly. With the fixes the event is not sent out
# any longer, but rather the dump thread sends out a sound error message.
#
# Crash is not simulated. A binlog with partly written event in its end is installed
# and replication is started from it.
#
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
--connection slave
# Make sure the slave is stopped while we are messing with master.
# Otherwise we get occasional failures as the slave manages to re-connect
# to the newly started master and we get extra events applied, causing
# conflicts.
--source include/stop_slave.inc
--connection master
call mtr.add_suppression("Error in Log_event::read_log_event()");
--let $datadir= `SELECT @@datadir`
--let $rpl_server_number= 1
--source include/rpl_stop_server.inc
--remove_file $datadir/master-bin.000001
--copy_file $MYSQL_TEST_DIR/std_data/bug11747416_32228_binlog.000001 $datadir/master-bin.000001
--let $rpl_server_number= 1
--source include/rpl_start_server.inc
--source include/wait_until_connected_again.inc
# evidence of the partial binlog
--error ER_ERROR_WHEN_EXECUTING_COMMAND
show binlog events;
--connection slave
call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log");
reset slave;
start slave;
# ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
--let $slave_param=Last_IO_Errno
--let $slave_param_value=1236
--source include/wait_for_slave_param.inc
--let $slave_field_result_replace= / at [0-9]*/ at XXX/
--let $status_items= Last_IO_Errno, Last_IO_Error
--source include/show_slave_status.inc
#
# Cleanup
#
--connection master
reset master;
--connection slave
stop slave;
reset slave;
# Table was created from binlog, it may not be created if SQL thread is running
# slowly and IO thread reaches incident before SQL thread applies it.
--disable_warnings
drop table if exists t;
--enable_warnings
reset master;
--echo End of the tests
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
# WL2540 replication events checksum
# Testing configuration parameters
--source include/have_debug.inc
--source include/have_binlog_format_mixed.inc
--source include/master-slave.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;
-- source include/wait_for_binlog_checkpoint.inc
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;
-- source include/wait_for_binlog_checkpoint.inc
insert into t1 values (1) /* will not be applied on slave due to simulation */;
# instruction to the dump thread
connection slave;
set @saved_dbug = @@global.debug_dbug;
set @@global.debug_dbug='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;
set @@global.debug_dbug = @saved_dbug;
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 @save_dbug = @@session.debug_dbug;
set @@session.debug_dbug='d,simulate_checksum_test_failure';
--error ER_ERROR_WHEN_EXECUTING_COMMAND
show binlog events;
SET debug_dbug= @save_dbug;
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 @saved_dbug = @@global.debug_dbug;
set @@global.debug_dbug='d,simulate_checksum_test_failure';
start slave io_thread;
# When the checksum error is detected, the slave sets error code 1913
# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately
# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io().
# So we usually get 1595, but it is occasionally possible to get 1913.
--let $slave_io_errno= 1595,1913
--let $show_slave_io_error= 0
source include/wait_for_slave_io_error.inc;
set @@global.debug_dbug = @saved_dbug;
# 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_dbug='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_dbug = @saved_dbug;
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;
--echo *** Bug#59123 / MDEV-5799: INCIDENT_EVENT checksum written to error log as garbage characters ***
--connection master
--source include/wait_for_binlog_checkpoint.inc
CREATE TABLE t4 (a INT PRIMARY KEY);
INSERT INTO t4 VALUES (1);
SET sql_log_bin=0;
CALL mtr.add_suppression("\\[ERROR\\] Can't generate a unique log-filename");
SET sql_log_bin=1;
SET @old_dbug= @@GLOBAL.debug_dbug;
SET debug_dbug= '+d,binlog_inject_new_name_error';
--error ER_NO_UNIQUE_LOGFILE
FLUSH LOGS;
SET debug_dbug= @old_dbug;
INSERT INTO t4 VALUES (2);
--connection slave
--let $slave_sql_errno= 1590
--source include/wait_for_slave_sql_error.inc
# Search the error log for the error message.
# The bug was that 4 garbage bytes were output in the middle of the error
# message; by searching for a pattern that spans that location, we can
# catch the error.
let $log_error_= `SELECT @@GLOBAL.log_error`;
if(!$log_error_)
{
# MySQL Server on windows is started with --console and thus
# does not know the location of its .err log, use default location
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err;
}
--let SEARCH_FILE= $log_error_
--let SEARCH_PATTERN= Slave SQL: The incident LOST_EVENTS occurred on the master\. Message: error writing to the binary log, Internal MariaDB error code: 1590
--source include/search_pattern_in_file.inc
SELECT * FROM t4 ORDER BY a;
STOP SLAVE IO_THREAD;
SET sql_slave_skip_counter= 1;
--source include/start_slave.inc
--connection master
--save_master_pos
--connection slave
--sync_with_master
SELECT * FROM t4 ORDER BY a;
--connection slave
set @@global.binlog_checksum = @slave_save_binlog_checksum;
set @@global.slave_sql_verify_checksum = @save_slave_sql_verify_checksum;
--echo End of tests
--connection master
DROP TABLE t4;
--source include/rpl_end.inc
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
-- 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: 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: 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
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
############################################################
# 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.* 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 @saved_dbug = @@global.debug_dbug;
SET @@global.debug_dbug="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_dbug=@saved_dbug;
# 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_dbug="d,corrupt_read_log_event2_set";
--connection slave
START SLAVE IO_THREAD;
let $slave_io_errno= 1236;
--let $slave_timeout= 10
--source include/wait_for_slave_io_error.inc
--connection master
SET @@global.debug_dbug=@saved_dbug;
# 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_dbug="d,corrupt_read_log_event2_set";
--connection slave
START SLAVE IO_THREAD;
# When the checksum error is detected, the slave sets error code 1743
# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately
# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io().
# So we usually get 1595, but it is occasionally possible to get 1743.
let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
--source include/wait_for_slave_io_error.inc
--connection master
SET @@global.debug_dbug=@saved_dbug;
SET GLOBAL master_verify_checksum=1;
# Emulate corruption in network
--echo # 5. Slave. Corruption in network
--connection slave
SET @saved_dbug_slave = @@GLOBAL.debug_dbug;
SET @@global.debug_dbug="d,corrupt_queue_event";
START SLAVE IO_THREAD;
let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
--source include/wait_for_slave_io_error.inc
SET @@global.debug_dbug=@saved_dbug_slave;
# Emulate corruption in relay log
--echo # 6. Slave. Corruption in relay log
SET @@global.debug_dbug="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_dbug=@saved_dbug_slave;
# 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_dbug = @saved_dbug;
SET GLOBAL master_verify_checksum = @old_master_verify_checksum;
DROP TABLE t1;
--sync_slave_with_master
--source include/rpl_end.inc
This diff is collapsed.
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
--source include/have_debug.inc
--source include/master-slave.inc
SET @old_binlog_checksum=@@binlog_checksum;
SET GLOBAL BINLOG_CHECKSUM=none;
connection slave;
SET @old_binlog_checksum=@@binlog_checksum;
SET GLOBAL BINLOG_CHECKSUM=none;
connection master;
--echo **** On Master ****
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*';
# This will generate an incident log event and store it in the binary
# log before the replace statement.
REPLACE INTO t1 VALUES (4);
--save_master_pos
SELECT * FROM t1;
set @@global.debug_dbug = @saved_dbug;
connection slave;
# Wait until SQL thread stops with error LOST_EVENT on master
call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590");
let $slave_sql_errno= 1590;
let $show_slave_sql_error= 1;
source include/wait_for_slave_sql_error.inc;
# The 4 should not be inserted into the table, since the incident log
# event should have stop the slave.
--echo **** On Slave ****
SELECT * FROM t1;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
--sync_with_master
# Now, we should have inserted the row into the table and the slave
# should be running. We should also have rotated to a new binary log.
SELECT * FROM t1;
source include/check_slave_is_running.inc;
connection master;
SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum;
DROP TABLE t1;
--sync_slave_with_master
SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum;
--source include/rpl_end.inc
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
######################################################################
# Some errors that cause the slave SQL thread to stop are not shown in
# the Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error
# is only in the server's error log.
#
# Two failures and their respective reporting are verified:
#
# 1 - Failures during slave thread initialization
# 2 - Failures while processing queries passed through the init_slave
# option.
#
# In order to check the first type of failure, we inject a fault in the
# SQL/IO Threads through SET GLOBAL debug.
#
# To check the second type, we set @@global.init_slave to an invalid
# command thus preventing the initialization of the SQL Thread.
#
# Obs:
# 1 - Note that testing failures while initializing the relay log position
# is hard as the same function is called before the code reaches the point
# that we want to test.
#
# 2 - This test does not target failures that are reported while applying
# events such as duplicate keys, errors while reading the relay-log.bin*,
# etc. Such errors are already checked on other tests.
######################################################################
######################################################################
# Configuring the Environment
######################################################################
source include/have_debug.inc;
source include/have_log_bin.inc;
source include/master-slave.inc;
connection slave;
--disable_warnings
stop slave;
--enable_warnings
reset slave;
######################################################################
# Injecting faults in the threads' initialization
######################################################################
connection slave;
# Set debug flags on slave to force errors to occur
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave;
#
# slave is going to stop because of emulated failures
# but there won't be any crashes nor asserts hit.
#
# 1593 = ER_SLAVE_FATAL_ERROR
--let $slave_sql_errno= 1593
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc
call mtr.add_suppression("Failed during slave.* thread initialization");
set @@global.debug_dbug = @saved_dbug;
######################################################################
# Injecting faults in the init_slave option
######################################################################
connection slave;
reset slave;
SET GLOBAL init_slave= "garbage";
start slave;
# 1064 = ER_PARSE_ERROR
--let $slave_sql_errno= 1064
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc
######################################################################
# Clean up
######################################################################
SET GLOBAL init_slave= "";
# Clean up Last_SQL_Error
--source include/stop_slave_io.inc
RESET SLAVE;
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
#############################################################################
# Original Author: JBM #
# Original Date: Aug/18/2005 #
#############################################################################
# TEST: To test the LOAD_FILE() in rbr #
#############################################################################
# Change Author: JBM
# Change Date: 2006-01-16
##########
# Includes
-- source include/have_binlog_format_mixed_or_row.inc
-- source include/master-slave.inc
-- source suite/rpl/include/rpl_loadfile.test
# BUG#39701: Mixed binlog format does not switch to row mode on LOAD_FILE
#
# DESCRIPTION
#
# Problem: when using load_file string function and mixed binlogging format
# there was no switch to row based binlogging format. This leads
# to scenarios on which the slave replicates the statement and it
# will try to load the file from local file system, which in most
# likely it will not exist.
#
# Solution:
# Marking this function as unsafe for statement format, makes the
# statement using it to be logged in row based format. As such, data
# replicated from the master, becomes the content of the loaded file.
# Consequently, the slave receives the necessary data to complete
# the load_file instruction correctly.
#
# IMPLEMENTATION
#
# The test is implemented as follows:
#
# On Master,
# i) write to file the desired content.
# ii) create table and stored procedure with load_file
# iii) stop slave
# iii) execute load_file
# iv) remove file
#
# On Slave,
# v) start slave
# vi) sync it with master so that it gets the updates from binlog (which
# should have bin logged in row format).
#
# If the the binlog format does not change to row, then the assertion
# done in the following step fails. This happens because tables differ
# since the file does not exist anymore, meaning that when slave
# attempts to execute LOAD_FILE statement it inserts NULL on table
# instead of the same contents that the master loaded when it executed
# the procedure (which was executed when file existed).
#
# vii) assert that the contents of master and slave
# table are the same
--source include/rpl_reset.inc
connection master;
let $file= $MYSQLTEST_VARDIR/tmp/bug_39701.data;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT repeat('x',20) INTO OUTFILE '$file'
disable_warnings;
DROP TABLE IF EXISTS t1;
enable_warnings;
CREATE TABLE t1 (t text);
DELIMITER |;
CREATE PROCEDURE p(file varchar(4096))
BEGIN
INSERT INTO t1 VALUES (LOAD_FILE(file));
END|
DELIMITER ;|
# stop slave before issuing the load_file on master
connection slave;
source include/stop_slave.inc;
connection master;
# test: check that logging falls back to rbr.
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval CALL p('$file')
# test: remove the file from the filesystem and assert that slave still
# gets the loaded file
remove_file $file;
# now that the file is removed it is safe (regarding what we want to test)
# to start slave
connection slave;
source include/start_slave.inc;
connection master;
sync_slave_with_master;
# assertion: assert that the slave got the updates even
# if the file was removed before the slave started,
# meaning that contents were indeed transfered
# through binlog (in row format)
let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
# CLEAN UP
--connection master
DROP TABLE t1;
DROP PROCEDURE p;
--source include/rpl_end.inc
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
# ==== Purpose ====
#
# Check replication protocol packet size handling
#
# ==== Related bugs ====
# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave
# BUG#23755: Replicated event larger that max_allowed_packet infinitely re-transmits
# BUG#42914: No LAST_IO_ERROR for max_allowed_packet errors
# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET
# max-out size db name
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, .*error.* 1153");
call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet");
let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
disable_warnings;
eval drop database if exists $db;
enable_warnings;
eval create database $db;
connection master;
let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`;
let $old_net_buffer_length= `SELECT @@global.net_buffer_length`;
let $old_slave_max_allowed_packet= `SELECT @@global.slave_max_allowed_packet`;
SET @@global.max_allowed_packet=1024;
SET @@global.net_buffer_length=1024;
sync_slave_with_master;
# Restart slave for setting to take effect
source include/stop_slave.inc;
source include/start_slave.inc;
# Reconnect to master for new setting to take effect
disconnect master;
# alas, can't use eval here; if db name changed apply the change here
connect (master,localhost,root,,DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________);
connection master;
select @@net_buffer_length, @@max_allowed_packet;
create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023');
sync_slave_with_master;
eval select count(*) from `$db`.`t1` /* must be 1 */;
SHOW STATUS LIKE 'Slave_running';
select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING';
connection master;
eval drop database $db;
sync_slave_with_master;
#
# Bug #23755: Replicated event larger that max_allowed_packet infinitely re-transmits
#
# Check that a situation when the size of event on the master is greater than
# max_allowed_packet on the slave does not lead to infinite re-transmits.
connection master;
# Change the max packet size on master
SET @@global.max_allowed_packet=4096;
SET @@global.net_buffer_length=4096;
# Restart slave for new setting to take effect
connection slave;
source include/stop_slave.inc;
source include/start_slave.inc;
# Reconnect to master for new setting to take effect
disconnect master;
connect (master, localhost, root);
connection master;
CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
sync_slave_with_master;
connection master;
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
#
# Bug#42914: The slave I/O thread must stop after trying to read the above
# event, However there is no Last_IO_Error report.
#
# The slave I/O thread must stop after trying to read the above event
connection slave;
# 1153 = ER_NET_PACKET_TOO_LARGE
--let $slave_io_errno= 1153
--let $show_slave_io_error= 1
--source include/wait_for_slave_io_error.inc
# TODO: this is needed because of BUG#55790. Remove once that is fixed.
--source include/stop_slave_sql.inc
#
# Bug#42914: On the master, if a binary log event is larger than
# max_allowed_packet, the error message ER_MASTER_FATAL_ERROR_READING_BINLOG
# is sent to a slave when it requests a dump from the master, thus leading the
# I/O thread to stop. However, there is no Last_IO_Error reported.
#
--let $rpl_only_running_threads= 1
--source include/rpl_reset.inc
--connection master
DROP TABLE t1;
--sync_slave_with_master
connection master;
CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM;
sync_slave_with_master;
connection master;
INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet));
connection slave;
# The slave I/O thread must stop after receiving
# 1153 = ER_NET_PACKET_TOO_LARGE
--let $slave_io_errno= 1153
--let $show_slave_io_error= 1
--source include/wait_for_slave_io_error.inc
# Remove the bad binlog and clear error status on slave.
STOP SLAVE;
RESET SLAVE;
--connection master
RESET MASTER;
#
# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET
#
# In BUG#55322, @@session.max_allowed_packet increased each time SHOW
# BINLOG EVENTS was issued. To verify that this bug is fixed, we
# execute SHOW BINLOG EVENTS twice and check that max_allowed_packet
# never changes. We turn off the result log because we don't care
# about the contents of the binlog.
--disable_result_log
SET @max_allowed_packet_0= @@session.max_allowed_packet;
SHOW BINLOG EVENTS;
SET @max_allowed_packet_1= @@session.max_allowed_packet;
SHOW BINLOG EVENTS;
SET @max_allowed_packet_2= @@session.max_allowed_packet;
--enable_result_log
if (`SELECT NOT(@max_allowed_packet_0 = @max_allowed_packet_1 AND @max_allowed_packet_1 = @max_allowed_packet_2)`)
{
--echo ERROR: max_allowed_packet changed after executing SHOW BINLOG EVENTS
--source include/show_rpl_debug_info.inc
SELECT @max_allowed_packet_0, @max_allowed_packet_1, @max_allowed_packet_2;
--die @max_allowed_packet changed after executing SHOW BINLOG EVENTS
}
--echo ==== clean up ====
connection master;
DROP TABLE t1;
eval SET @@global.max_allowed_packet= $old_max_allowed_packet;
eval SET @@global.net_buffer_length= $old_net_buffer_length;
eval SET @@global.slave_max_allowed_packet= $old_slave_max_allowed_packet;
# slave is stopped
connection slave;
DROP TABLE t1;
# Clear Last_IO_Error
RESET SLAVE;
--source include/rpl_end.inc
# End of tests
# ==== Purpose ====
#
# Test verifies that, in parallel replication, transaction failure notification
# is propagated to all the workers. Workers should abort the execution of
# transaction event groups, whose event positions are higher than the failing
# transaction group.
#
# ==== Implementation ====
#
# Steps:
# 0 - Create a table t1 on master which has a primary key. Enable parallel
# replication on slave with slave_parallel_mode='optimistic' and
# slave_parallel_threads=3.
# 1 - On slave start a transaction and execute a local INSERT statement
# which will insert value 32. This is done to block the INSERT coming
# from master.
# 2 - On master execute an INSERT statement with value 32, so that it is
# blocked on slave.
# 3 - On slave enable a debug sync point such that it holds the worker thread
# execution as soon as work is scheduled to it.
# 4 - INSERT value 33 on master. It will be held on slave by other worker
# thread due to debug simulation.
# 5 - INSERT value 34 on master.
# 6 - On slave, enusre that INSERT 34 has reached a state where it waits for
# its prior transactions to commit.
# 7 - Commit the local INSERT 32 on slave server so that first worker will
# error out.
# 8 - Now send a continue signal to second worker processing 33. It should
# wakeup and propagate the error to INSERT 34.
# 9 - Upon slave stop due to error, check that no rows are found after the
# failed INSERT 32.
#
# ==== References ====
#
# MDEV-20645: Replication consistency is broken as workers miss the error
# notification from an earlier failed group.
#
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_binlog_format_statement.inc
--source include/master-slave.inc
--enable_connect_log
--connection server_2
--source include/stop_slave.inc
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET @old_debug= @@GLOBAL.debug_dbug;
SET GLOBAL slave_parallel_mode='optimistic';
SET GLOBAL slave_parallel_threads= 3;
CHANGE MASTER TO master_use_gtid=slave_pos;
CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
--source include/start_slave.inc
--connection server_1
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=InnoDB;
--source include/save_master_gtid.inc
--connection server_2
--source include/sync_with_master_gtid.inc
--connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
BEGIN;
INSERT INTO t1 VALUES (32);
--connection server_1
INSERT INTO t1 VALUES (32);
--connection server_2
--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE info like "INSERT INTO t1 VALUES (32)"
--source include/wait_condition.inc
SET GLOBAL debug_dbug="+d,hold_worker_on_schedule";
SET debug_sync="debug_sync_action SIGNAL reached_pause WAIT_FOR continue_worker";
--connection server_1
SET gtid_seq_no=100;
INSERT INTO t1 VALUES (33);
--connection server_2
SET debug_sync='now WAIT_FOR reached_pause';
--connection server_1
INSERT INTO t1 VALUES (34);
--connection server_2
--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state like "Waiting for prior transaction to commit"
--source include/wait_condition.inc
--connection con_temp2
COMMIT;
# Clean up.
--connection server_2
--source include/stop_slave.inc
--let $assert_cond= COUNT(*) = 0 FROM t1 WHERE a>32
--let $assert_text= table t1 should have zero rows where a>32
--source include/assert.inc
SELECT * FROM t1 WHERE a>32;
DELETE FROM t1 WHERE a=32;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL debug_dbug=@old_debug;
SET DEBUG_SYNC= 'RESET';
--source include/start_slave.inc
--connection server_1
DROP TABLE t1;
--disable_connect_log
--source include/rpl_end.inc
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
# BUG#13979418: SHOW BINLOG EVENTS MAY CRASH THE SERVER
#
# The function mysql_show_binlog_events has a local stack variable
# 'LOG_INFO linfo;', which is assigned to thd->current_linfo, however
# this variable goes out of scope and is destroyed before clean
# thd->current_linfo.
#
# This test case runs SHOW BINLOG EVENTS and FLUSH LOGS to make sure
# that with the fix local variable linfo is valid along all
# mysql_show_binlog_events function scope.
#
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/master-slave.inc
--connection slave
SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end';
--send SHOW BINLOG EVENTS
--connection slave1
SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events';
FLUSH LOGS;
SET DEBUG_SYNC= 'now SIGNAL end';
--connection slave
--disable_result_log
--reap
--enable_result_log
SET DEBUG_SYNC= 'RESET';
--connection master
--source include/rpl_end.inc
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
#######################################################
# Wrapper for rpl_relayrotate.test to allow multi #
# Engines to reuse test code. By JBM 2006-02-15 #
#######################################################
-- source include/have_innodb.inc
# Slow test, don't run during staging part
-- source include/not_staging.inc
-- source include/master-slave.inc
let $engine_type=innodb;
-- source suite/rpl/include/rpl_relayrotate.test
--source include/rpl_end.inc
This diff is collapsed.
This diff is collapsed.
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
################################################################################
# Bug#19855907 IO THREAD AUTHENTICATION ISSUE WITH SOME CHARACTER SETS
# Problem: IO thread fails to connect to master if servers are configured with
# special character sets like utf16, utf32, ucs2.
#
# Analysis: MySQL server does not support few special character sets like
# utf16,utf32 and ucs2 as "client's character set"(eg: utf16,utf32, ucs2).
# When IO thread is trying to connect to Master, it sets server's character
# set as client's character set. When Slave server is started with these
# special character sets, IO thread (a connection to Master) fails because
# of the above said reason.
#
# Fix: If server's character set is not supported as client's character set,
# then set default's client character set(latin1) as client's character set.
###############################################################################
--source include/master-slave.inc
call mtr.add_suppression("'utf16' can not be used as client character set");
CREATE TABLE t1(i VARCHAR(20));
INSERT INTO t1 VALUES (0xFFFF);
--sync_slave_with_master
--let diff_tables=master:t1, slave:t1
--source include/diff_tables.inc
# Cleanup
--connection master
DROP TABLE t1;
--source include/rpl_end.inc
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
# test to see if replication can continue when master sporadically fails on
# COM_BINLOG_DUMP and additionally limits the number of events per dump
source include/master-slave.inc;
create table t2(n int);
create table t1(n int not null auto_increment primary key);
insert into t1 values (NULL),(NULL);
truncate table t1;
# We have to use 4 in the following to make this test work with all table types
insert into t1 values (4),(NULL);
sync_slave_with_master;
--source include/stop_slave.inc
--source include/start_slave.inc
connection master;
insert into t1 values (NULL),(NULL);
flush logs;
truncate table t1;
insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL);
sync_slave_with_master;
select * from t1 ORDER BY n;
connection master;
drop table t1,t2;
sync_slave_with_master;
--source include/rpl_end.inc
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
source include/have_ssl_communication.inc;
source include/master-slave.inc;
source include/no_valgrind_without_big.inc;
# create a user for replication that requires ssl encryption
connection master;
create user replssl@localhost;
grant replication slave on *.* to replssl@localhost require ssl;
create table t1 (t int auto_increment, KEY(t));
sync_slave_with_master;
# Set slave to use SSL for connection to master
stop slave;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval change master to
master_user='replssl',
master_password='',
master_ssl=1,
master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem',
master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem',
master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem';
start slave;
# Switch to master and insert one record, then sync it to slave
connection master;
insert into t1 values(1);
sync_slave_with_master;
# The record should now be on slave
select * from t1;
# The slave is synced and waiting/reading from master
# SHOW SLAVE STATUS will show "Waiting for master to send event"
let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Crl, Master_SSL_Crlpath, Master_SSL_Cert, Master_SSL_Key;
source include/show_slave_status.inc;
source include/check_slave_is_running.inc;
# Stop the slave, as reported in bug#21871 it would hang
STOP SLAVE;
select * from t1;
# Do the same thing a number of times
disable_query_log;
disable_result_log;
# 2007-11-27 mats Bug #32756 Starting and stopping the slave in a loop can lose rows
# After discussions with Engineering, I'm disabling this part of the test to avoid it causing
# red trees.
disable_parsing;
let $i= 100;
while ($i)
{
start slave;
connection master;
insert into t1 values (NULL);
select * from t1; # Some variance
connection slave;
select * from t1; # Some variance
stop slave;
dec $i;
}
enable_parsing;
START SLAVE;
enable_query_log;
enable_result_log;
connection master;
# INSERT one more record to make sure
# the sync has something to do
insert into t1 values (NULL);
let $master_count= `select count(*) from t1`;
sync_slave_with_master;
--source include/wait_for_slave_to_start.inc
source include/show_slave_status.inc;
source include/check_slave_is_running.inc;
let $slave_count= `select count(*) from t1`;
if ($slave_count != $master_count)
{
echo master and slave differed in number of rows;
echo master: $master_count;
echo slave: $slave_count;
connection master;
select count(*) t1;
select * from t1;
connection slave;
select count(*) t1;
select * from t1;
query_vertical show slave status;
}
connection master;
drop user replssl@localhost;
drop table t1;
sync_slave_with_master;
--source include/stop_slave.inc
CHANGE MASTER TO
master_user = 'root',
master_ssl = 0,
master_ssl_ca = '',
master_ssl_cert = '',
master_ssl_key = '';
--echo End of 5.0 tests
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
########################################################################################
# This test verifies the options --sync-relay-log-info and --relay-log-recovery by
# crashing the slave in two different situations:
# (case-1) - Corrupt the relay log with changes which were not processed by
# the SQL Thread and crashes it.
# (case-2) - Corrupt the master.info with wrong coordinates and crashes it.
#
# Case 1:
# 1 - Stops the SQL Thread
# 2 - Inserts new records into the master.
# 3 - Corrupts the relay-log.bin* which most likely has such changes.
# 4 - Crashes the slave
# 5 - Verifies if the slave is sync with the master which means that the information
# loss was circumvented by the recovery process.
#
# Case 2:
# 1 - Stops the SQL/IO Threads
# 2 - Inserts new records into the master.
# 3 - Corrupts the master.info with wrong coordinates.
# 4 - Crashes the slave
# 5 - Verifies if the slave is sync with the master which means that the information
# loss was circumvented by the recovery process.
########################################################################################
########################################################################################
# Configuring the environment
########################################################################################
--echo =====Configuring the enviroment=======;
--source include/not_embedded.inc
--source include/not_valgrind.inc
--source include/have_debug.inc
--source include/have_innodb.inc
--source include/not_crashrep.inc
--source include/master-slave.inc
call mtr.add_suppression('Attempting backtrace');
call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001");
# Use innodb so we do not get "table should be repaired" issues.
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
flush tables;
CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb;
insert into t1(a) values(1);
insert into t1(a) values(2);
insert into t1(a) values(3);
########################################################################################
# Case 1: Corrupt a relay-log.bin*
########################################################################################
--echo =====Inserting data on the master but without the SQL Thread being running=======;
sync_slave_with_master;
connection slave;
let $MYSQLD_SLAVE_DATADIR= `select @@datadir`;
--replace_result $MYSQLD_SLAVE_DATADIR MYSQLD_SLAVE_DATADIR
--copy_file $MYSQLD_SLAVE_DATADIR/master.info $MYSQLD_SLAVE_DATADIR/master.backup
--source include/stop_slave_sql.inc
connection master;
insert into t1(a) values(4);
insert into t1(a) values(5);
insert into t1(a) values(6);
--echo =====Removing relay log files and crashing/recoverying the slave=======;
connection slave;
--source include/stop_slave_io.inc
let $file= query_get_value("SHOW SLAVE STATUS", Relay_Log_File, 1);
--let FILE_TO_CORRUPT= $MYSQLD_SLAVE_DATADIR/$file
perl;
$file= $ENV{'FILE_TO_CORRUPT'};
open(FILE, ">$file") || die "Unable to open $file.";
truncate(FILE,0);
print FILE "failure";
close ($file);
EOF
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
SET SESSION debug_dbug="d,crash_before_rotate_relaylog";
--error 2013
FLUSH LOGS;
--let $rpl_server_number= 2
--source include/rpl_reconnect.inc
--echo =====Dumping and comparing tables=======;
--source include/start_slave.inc
connection master;
sync_slave_with_master;
let $diff_tables=master:t1,slave:t1;
source include/diff_tables.inc;
########################################################################################
# Case 2: Corrupt a master.info
########################################################################################
--echo =====Corrupting the master.info=======;
connection slave;
--source include/stop_slave.inc
connection master;
FLUSH LOGS;
insert into t1(a) values(7);
insert into t1(a) values(8);
insert into t1(a) values(9);
connection slave;
let MYSQLD_SLAVE_DATADIR=`select @@datadir`;
--perl
use strict;
use warnings;
my $src= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.backup";
my $dst= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.info";
open(FILE, "<", $src) or die;
my @content= <FILE>;
close FILE;
open(FILE, ">", $dst) or die;
binmode FILE;
print FILE @content;
close FILE;
EOF
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
SET SESSION debug_dbug="d,crash_before_rotate_relaylog";
--error 2013
FLUSH LOGS;
--let $rpl_server_number= 2
--source include/rpl_reconnect.inc
--echo =====Dumping and comparing tables=======;
--source include/start_slave.inc
connection master;
sync_slave_with_master;
let $diff_tables=master:t1,slave:t1;
source include/diff_tables.inc;
########################################################################################
# Clean up
########################################################################################
--echo =====Clean up=======;
connection master;
drop table t1;
--remove_file $MYSQLD_SLAVE_DATADIR/master.backup
--source include/rpl_end.inc
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
--source include/master-slave.inc
if ($force_master_mysql56_temporal_format)
{
connection master;
eval SET @@global.mysql56_temporal_format=$force_master_mysql56_temporal_format;
}
if ($force_slave_mysql56_temporal_format)
{
connection slave;
eval SET @@global.mysql56_temporal_format=$force_slave_mysql56_temporal_format;
}
connection master;
SELECT @@global.mysql56_temporal_format AS on_master;
connection slave;
SELECT @@global.mysql56_temporal_format AS on_slave;
connection master;
CREATE TABLE t1
(
c0 TIME(0),
c1 TIME(1),
c2 TIME(2),
c3 TIME(3),
c4 TIME(4),
c5 TIME(5),
c6 TIME(6)
);
CREATE TABLE t2
(
c0 TIMESTAMP(0),
c1 TIMESTAMP(1),
c2 TIMESTAMP(2),
c3 TIMESTAMP(3),
c4 TIMESTAMP(4),
c5 TIMESTAMP(5),
c6 TIMESTAMP(6)
);
CREATE TABLE t3
(
c0 DATETIME(0),
c1 DATETIME(1),
c2 DATETIME(2),
c3 DATETIME(3),
c4 DATETIME(4),
c5 DATETIME(5),
c6 DATETIME(6)
);
INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111');
INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
sync_slave_with_master;
connection slave;
--query_vertical SELECT * FROM t1;
--query_vertical SELECT * FROM t2;
--query_vertical SELECT * FROM t3;
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
connection master;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
connection slave;
SET @@global.mysql56_temporal_format=DEFAULT;
connection master;
SET @@global.mysql56_temporal_format=DEFAULT;
--source include/rpl_end.inc
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption suite).
# Please check all dependent tests after modifying it
#
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
connection slave;
set @saved_slave_type_conversions = @@global.slave_type_conversions;
CREATE TABLE type_conversions (
TestNo INT AUTO_INCREMENT PRIMARY KEY,
Source TEXT,
Target TEXT,
Flags TEXT,
On_Master LONGTEXT,
On_Slave LONGTEXT,
Expected LONGTEXT,
Compare INT,
Error TEXT);
SELECT @@global.slave_type_conversions;
SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
SELECT @@global.slave_type_conversions;
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
SELECT @@global.slave_type_conversions;
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
SELECT @@global.slave_type_conversions;
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
SELECT @@global.slave_type_conversions;
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT';
SELECT @@global.slave_type_conversions;
# Checking strict interpretation of type conversions
connection slave;
SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
source suite/rpl/include/type_conversions.test;
# Checking lossy integer type conversions
connection slave;
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
source suite/rpl/include/type_conversions.test;
# Checking non-lossy integer type conversions
connection slave;
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
source suite/rpl/include/type_conversions.test;
# Checking all type conversions
connection slave;
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
source suite/rpl/include/type_conversions.test;
connection slave;
--echo **** Result of conversions ****
disable_query_log;
SELECT RPAD(Source, 15, ' ') AS Source_Type,
RPAD(Target, 15, ' ') AS Target_Type,
RPAD(Flags, 25, ' ') AS All_Type_Conversion_Flags,
IF(Compare IS NULL AND Error IS NOT NULL, '<Correct error>',
IF(Compare, '<Correct value>',
CONCAT("'", On_Slave, "' != '", Expected, "'")))
AS Value_On_Slave
FROM type_conversions;
enable_query_log;
DROP TABLE type_conversions;
call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677");
connection master;
DROP TABLE t1;
sync_slave_with_master;
set global slave_type_conversions = @saved_slave_type_conversions;
--source include/rpl_end.inc
--source include/rpl_cant_read_event_incident.inc
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
#
# Bug#11747416 : 32228 A disk full makes binary log corrupt.
#
#
# The test demonstrates reading from binlog error propagation to slave
# and reporting there.
# Conditions for the bug include a crash at time of the last event to
# the binlog was written partly. With the fixes the event is not sent out
# any longer, but rather the dump thread sends out a sound error message.
#
# Crash is not simulated. A binlog with partly written event in its end is installed
# and replication is started from it.
#
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
--connection slave
# Make sure the slave is stopped while we are messing with master.
# Otherwise we get occasional failures as the slave manages to re-connect
# to the newly started master and we get extra events applied, causing
# conflicts.
--source include/stop_slave.inc
--connection master
call mtr.add_suppression("Error in Log_event::read_log_event()");
--let $datadir= `SELECT @@datadir`
--let $rpl_server_number= 1
--source include/rpl_stop_server.inc
--remove_file $datadir/master-bin.000001
--copy_file $MYSQL_TEST_DIR/std_data/bug11747416_32228_binlog.000001 $datadir/master-bin.000001
--let $rpl_server_number= 1
--source include/rpl_start_server.inc
--source include/wait_until_connected_again.inc
# evidence of the partial binlog
--error ER_ERROR_WHEN_EXECUTING_COMMAND
show binlog events;
--connection slave
call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log");
reset slave;
start slave;
# ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
--let $slave_param=Last_IO_Errno
--let $slave_param_value=1236
--source include/wait_for_slave_param.inc
--let $slave_field_result_replace= / at [0-9]*/ at XXX/
--let $status_items= Last_IO_Errno, Last_IO_Error
--source include/show_slave_status.inc
#
# Cleanup
#
--connection master
reset master;
--connection slave
stop slave;
reset slave;
# Table was created from binlog, it may not be created if SQL thread is running
# slowly and IO thread reaches incident before SQL thread applies it.
--disable_warnings
drop table if exists t;
--enable_warnings
reset master;
--echo End of the tests
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
--source include/rpl_incident.inc
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
--source include/have_debug.inc
--source include/master-slave.inc
SET @old_binlog_checksum=@@binlog_checksum;
SET GLOBAL BINLOG_CHECKSUM=none;
connection slave;
SET @old_binlog_checksum=@@binlog_checksum;
SET GLOBAL BINLOG_CHECKSUM=none;
connection master;
--echo **** On Master ****
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*';
# This will generate an incident log event and store it in the binary
# log before the replace statement.
REPLACE INTO t1 VALUES (4);
--save_master_pos
SELECT * FROM t1;
set @@global.debug_dbug = @saved_dbug;
connection slave;
# Wait until SQL thread stops with error LOST_EVENT on master
call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590");
let $slave_sql_errno= 1590;
let $show_slave_sql_error= 1;
source include/wait_for_slave_sql_error.inc;
# The 4 should not be inserted into the table, since the incident log
# event should have stop the slave.
--echo **** On Slave ****
SELECT * FROM t1;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
--sync_with_master
# Now, we should have inserted the row into the table and the slave
# should be running. We should also have rotated to a new binary log.
SELECT * FROM t1;
source include/check_slave_is_running.inc;
connection master;
SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum;
DROP TABLE t1;
--sync_slave_with_master
SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum;
--source include/rpl_end.inc
--source include/rpl_init_slave_errors.inc
#
# This include file is used by more than one test suite
# (currently rpl and binlog_encryption).
# Please check all dependent tests after modifying it
#
######################################################################
# Some errors that cause the slave SQL thread to stop are not shown in
# the Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error
# is only in the server's error log.
#
# Two failures and their respective reporting are verified:
#
# 1 - Failures during slave thread initialization
# 2 - Failures while processing queries passed through the init_slave
# option.
#
# In order to check the first type of failure, we inject a fault in the
# SQL/IO Threads through SET GLOBAL debug.
#
# To check the second type, we set @@global.init_slave to an invalid
# command thus preventing the initialization of the SQL Thread.
#
# Obs:
# 1 - Note that testing failures while initializing the relay log position
# is hard as the same function is called before the code reaches the point
# that we want to test.
#
# 2 - This test does not target failures that are reported while applying
# events such as duplicate keys, errors while reading the relay-log.bin*,
# etc. Such errors are already checked on other tests.
######################################################################
######################################################################
# Configuring the Environment
######################################################################
source include/have_debug.inc;
source include/have_log_bin.inc;
source include/master-slave.inc;
connection slave;
--disable_warnings
stop slave;
--enable_warnings
reset slave;
######################################################################
# Injecting faults in the threads' initialization
######################################################################
connection slave;
# Set debug flags on slave to force errors to occur
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave;
#
# slave is going to stop because of emulated failures
# but there won't be any crashes nor asserts hit.
#
# 1593 = ER_SLAVE_FATAL_ERROR
--let $slave_sql_errno= 1593
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc
call mtr.add_suppression("Failed during slave.* thread initialization");
set @@global.debug_dbug = @saved_dbug;
######################################################################
# Injecting faults in the init_slave option
######################################################################
connection slave;
reset slave;
SET GLOBAL init_slave= "garbage";
start slave;
# 1064 = ER_PARSE_ERROR
--let $slave_sql_errno= 1064
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc
######################################################################
# Clean up
######################################################################
SET GLOBAL init_slave= "";
# Clean up Last_SQL_Error
--source include/stop_slave_io.inc
RESET SLAVE;
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc
--source include/rpl_loaddata_local.inc
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment