mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge with 5.2.
no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
stop slave;
|
||||
include/wait_for_slave_to_stop.inc
|
||||
include/stop_slave.inc
|
||||
create table t1 (a int);
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
@ -9,11 +8,8 @@ drop table t1;
|
||||
reset slave;
|
||||
start slave io_thread;
|
||||
include/wait_for_slave_param.inc [Slave_IO_State]
|
||||
stop slave io_thread;
|
||||
include/wait_for_slave_io_to_stop.inc
|
||||
include/stop_slave_io.inc
|
||||
reset slave;
|
||||
start slave;
|
||||
select master_pos_wait('MASTER_LOG_FILE',200,30)=-1;
|
||||
master_pos_wait('MASTER_LOG_FILE',200,30)=-1
|
||||
0
|
||||
include/start_slave.inc
|
||||
include/assert.inc [Assert that master_pos_wait does not timeout nor it returns NULL]
|
||||
include/rpl_end.inc
|
||||
|
49
mysql-test/suite/rpl/r/rpl_row_corruption.result
Normal file
49
mysql-test/suite/rpl/r/rpl_row_corruption.result
Normal file
@ -0,0 +1,49 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
CREATE TABLE t1_11753004 (c1 INT);
|
||||
CREATE TABLE t2_11753004 (c1 INT);
|
||||
INSERT INTO t1_11753004 VALUES (1);
|
||||
INSERT INTO t2_11753004 VALUES (2);
|
||||
call mtr.add_suppression(".*Found table map event mapping table id 0 which was already mapped but with different settings.*");
|
||||
include/stop_slave.inc
|
||||
SET @save_debug= @@global.debug;
|
||||
SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
|
||||
include/start_slave.inc
|
||||
UPDATE t1_11753004, t2_11753004 SET t1_11753004.c1=3, t2_11753004.c1=4 WHERE t1_11753004.c1=1 OR t2_11753004.c1=2;
|
||||
include/wait_for_slave_sql_error.inc [errno=1593 ]
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL debug="-d,inject_tblmap_same_id_maps_diff_table";
|
||||
include/start_slave.inc
|
||||
include/rpl_reset.inc
|
||||
DROP TABLE t1_11753004, t2_11753004;
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
|
||||
include/start_slave.inc
|
||||
include/rpl_reset.inc
|
||||
CREATE TABLE t1_11753004 (c1 INT);
|
||||
CREATE TABLE t2_11753004_ign (c1 INT);
|
||||
INSERT INTO t1_11753004 VALUES (1);
|
||||
INSERT INTO t2_11753004_ign VALUES (2);
|
||||
UPDATE t1_11753004, t2_11753004_ign SET t1_11753004.c1=3, t2_11753004_ign.c1=4 WHERE t1_11753004.c1=1 OR t2_11753004_ign.c1=2;
|
||||
CREATE TABLE t1 (c1 INT);
|
||||
CREATE TABLE t2 (c1 INT);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
BINLOG '
|
||||
SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=
|
||||
'/*!*/;
|
||||
SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
|
||||
BINLOG '
|
||||
SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE=
|
||||
SOgWThMBAAAAKQAAAC8DAAAAAEMAAAAAAAEABHRlc3QAAnQyAAEDAAE=
|
||||
SOgWThgBAAAAKAAAAFcDAAAAAEIAAAAAAAAAAf///gEAAAD+AwAAAA==
|
||||
SOgWThgBAAAAKAAAAH8DAAAAAEMAAAAAAAEAAf///gEAAAD+BAAAAA==
|
||||
'/*!*/;
|
||||
ERROR HY000: Fatal error: Found table map event mapping table id 0 which was already mapped but with different settings.
|
||||
DROP TABLE t1,t2;
|
||||
SET GLOBAL debug="-d,inject_tblmap_same_id_maps_diff_table";
|
||||
DROP TABLE t1_11753004;
|
||||
DROP TABLE t2_11753004_ign;
|
||||
SET GLOBAL debug= @save_debug;
|
||||
include/rpl_end.inc
|
@ -19,7 +19,7 @@ change master to master_port=MASTER_PORT;
|
||||
start slave until master_log_file='master-bin.000001', master_log_pos=UNTIL_POS;
|
||||
include/wait_for_slave_io_to_start.inc
|
||||
include/wait_for_slave_sql_to_stop.inc
|
||||
*** checking until postion execution: must be only t1 in the list ***
|
||||
*** checking until position execution: must be only t1 in the list ***
|
||||
show tables;
|
||||
Tables_in_test
|
||||
t1
|
||||
|
@ -10,7 +10,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
rpl_row_create_table : Bug#51574 Feb 27 2010 andrei failed different way than earlier with bug#45576
|
||||
rpl_get_master_version_and_clock : Bug#59178 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock
|
||||
rpl_row_create_table : Bug#11759274 Feb 27 2010 andrei failed different way than earlier with bug#45576
|
||||
rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock
|
||||
rpl_row_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
|
||||
rpl_stm_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
|
||||
|
@ -2,10 +2,9 @@
|
||||
# to force the deadlock after one event.
|
||||
|
||||
source include/master-slave.inc;
|
||||
let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1);
|
||||
--let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
connection slave;
|
||||
stop slave;
|
||||
source include/wait_for_slave_to_stop.inc;
|
||||
--source include/stop_slave.inc
|
||||
connection master;
|
||||
# This will generate a master's binlog > 10 bytes
|
||||
create table t1 (a int);
|
||||
@ -21,23 +20,33 @@ let $slave_param_value= Waiting for the slave SQL thread to free enough relay lo
|
||||
source include/wait_for_slave_param.inc;
|
||||
|
||||
# A bug caused the I/O thread to refuse stopping.
|
||||
stop slave io_thread;
|
||||
source include/wait_for_slave_io_to_stop.inc;
|
||||
--source include/stop_slave_io.inc
|
||||
reset slave;
|
||||
start slave;
|
||||
# The I/O thread stops filling the relay log when
|
||||
# it's >10b. And the SQL thread cannot purge this relay log
|
||||
# as purge is done only when the SQL thread switches to another
|
||||
# relay log, which does not exist here.
|
||||
# So we should have a deadlock.
|
||||
# if it is not resolved automatically we'll detect
|
||||
# it with master_pos_wait that waits for farther than 1Ob;
|
||||
# it will timeout;
|
||||
# also the slave will probably not cooperate to shutdown
|
||||
# (as 2 threads are locked)
|
||||
--replace_result $master_log_file MASTER_LOG_FILE
|
||||
eval select master_pos_wait('$master_log_file',200,30)=-1;
|
||||
--source include/start_slave.inc
|
||||
|
||||
# The I/O thread stops filling the relay log when it's >10b. And the
|
||||
# SQL thread cannot purge this relay log as purge is done only when
|
||||
# the SQL thread switches to another relay log, which does not exist
|
||||
# here. So we should have a deadlock. If it is not resolved
|
||||
# automatically we'll detect it with master_pos_wait that waits for
|
||||
# farther than 1Ob; it will timeout after 300 seconds (which is inline
|
||||
# with the default used for sync_slave_with_master and will protect us
|
||||
# against slow test envs); also the slave will probably not cooperate
|
||||
# to shutdown (as 2 threads are locked)
|
||||
--let $outcome= `SELECT MASTER_POS_WAIT('$master_log_file',200,300) AS mpw;`
|
||||
|
||||
# master_pos_wait returns:
|
||||
#
|
||||
# * >= 0, the number of events the slave had to wait to advance to the
|
||||
# position
|
||||
#
|
||||
# * -1, if there was a timeout
|
||||
#
|
||||
# * NULL, if an error occurred, or the SQL thread was not started,
|
||||
# slave master info is not initialized, the arguments are incorrect
|
||||
--let $assert_text= Assert that master_pos_wait does not timeout nor it returns NULL
|
||||
--let $assert_cond= $outcome IS NOT NULL AND $outcome <> -1
|
||||
--source include/assert.inc
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
|
1
mysql-test/suite/rpl/t/rpl_row_corruption-slave.opt
Normal file
1
mysql-test/suite/rpl/t/rpl_row_corruption-slave.opt
Normal file
@ -0,0 +1 @@
|
||||
--replicate-ignore-table=test.t2_11753004_ign
|
115
mysql-test/suite/rpl/t/rpl_row_corruption.test
Normal file
115
mysql-test/suite/rpl/t/rpl_row_corruption.test
Normal file
@ -0,0 +1,115 @@
|
||||
#
|
||||
--source include/master-slave.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_binlog_format_row.inc
|
||||
|
||||
# BUG#11753004: 44360: REPLICATION FAILED
|
||||
|
||||
## assert that we get an error when checking the
|
||||
## identifiers at the slave (instead of a crash or
|
||||
## different table being updated)
|
||||
|
||||
--let $t1= t1_11753004
|
||||
--let $t2= t2_11753004
|
||||
--let $t2_ign= t2_11753004_ign
|
||||
|
||||
## test #1: assert that we get an error raised when multiple
|
||||
## tables in the same RBR statement are mapped with the
|
||||
## same identifier
|
||||
|
||||
--eval CREATE TABLE $t1 (c1 INT)
|
||||
--eval CREATE TABLE $t2 (c1 INT)
|
||||
--eval INSERT INTO $t1 VALUES (1)
|
||||
--eval INSERT INTO $t2 VALUES (2)
|
||||
|
||||
--sync_slave_with_master
|
||||
call mtr.add_suppression(".*Found table map event mapping table id 0 which was already mapped but with different settings.*");
|
||||
|
||||
# stop the slave and inject corruption
|
||||
--source include/stop_slave.inc
|
||||
SET @save_debug= @@global.debug;
|
||||
SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
|
||||
--source include/start_slave.inc
|
||||
--connection master
|
||||
# both tables get mapped to 0 (in a way, simulating scenario
|
||||
# originated by BUG#56226)
|
||||
--eval UPDATE $t1, $t2 SET $t1.c1=3, $t2.c1=4 WHERE $t1.c1=1 OR $t2.c1=2
|
||||
--connection slave
|
||||
|
||||
# wait for error 1593 (ER_SLAVE_FATAL_ERROR)
|
||||
--let $slave_sql_errno=1593
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
--source include/stop_slave.inc
|
||||
|
||||
# clean up
|
||||
SET GLOBAL debug="-d,inject_tblmap_same_id_maps_diff_table";
|
||||
--source include/start_slave.inc
|
||||
--connection master
|
||||
--source include/rpl_reset.inc
|
||||
--eval DROP TABLE $t1, $t2
|
||||
--sync_slave_with_master
|
||||
|
||||
## test #2: assert that ignored tables that may have been mapped
|
||||
## with the same identifier are skipped, thus no error
|
||||
## is raised.
|
||||
|
||||
--connection slave
|
||||
--source include/stop_slave.inc
|
||||
SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
|
||||
--source include/start_slave.inc
|
||||
--source include/rpl_reset.inc
|
||||
--connection master
|
||||
--eval CREATE TABLE $t1 (c1 INT)
|
||||
--eval CREATE TABLE $t2_ign (c1 INT)
|
||||
--eval INSERT INTO $t1 VALUES (1)
|
||||
--eval INSERT INTO $t2_ign VALUES (2)
|
||||
--eval UPDATE $t1, $t2_ign SET $t1.c1=3, $t2_ign.c1=4 WHERE $t1.c1=1 OR $t2_ign.c1=2
|
||||
|
||||
# must not raise error as second table is filtered
|
||||
--sync_slave_with_master
|
||||
|
||||
|
||||
## test #3: check that BINLOG statements will also raise an
|
||||
## error if containing table map events mapping different
|
||||
## tables to same table identifier.
|
||||
|
||||
CREATE TABLE t1 (c1 INT);
|
||||
CREATE TABLE t2 (c1 INT);
|
||||
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
|
||||
# FD event
|
||||
BINLOG '
|
||||
SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=
|
||||
'/*!*/;
|
||||
|
||||
#110708 12:21:44 server id 1 end_log_pos 774 Table_map: `test`.`t1` mapped to number 66
|
||||
# at 774
|
||||
#110708 12:21:44 server id 1 end_log_pos 815 Table_map: `test`.`t2` mapped to number 67
|
||||
# at 815
|
||||
#110708 12:21:44 server id 1 end_log_pos 855 Update_rows: table id 66
|
||||
# at 855
|
||||
#110708 12:21:44 server id 1 end_log_pos 895 Update_rows: table id 67 flags: STMT_END_F
|
||||
SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
|
||||
--error ER_SLAVE_FATAL_ERROR
|
||||
BINLOG '
|
||||
SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE=
|
||||
SOgWThMBAAAAKQAAAC8DAAAAAEMAAAAAAAEABHRlc3QAAnQyAAEDAAE=
|
||||
SOgWThgBAAAAKAAAAFcDAAAAAEIAAAAAAAAAAf///gEAAAD+AwAAAA==
|
||||
SOgWThgBAAAAKAAAAH8DAAAAAEMAAAAAAAEAAf///gEAAAD+BAAAAA==
|
||||
'/*!*/;
|
||||
|
||||
|
||||
# clean up
|
||||
DROP TABLE t1,t2;
|
||||
--connection slave
|
||||
SET GLOBAL debug="-d,inject_tblmap_same_id_maps_diff_table";
|
||||
--connection master
|
||||
--eval DROP TABLE $t1
|
||||
--eval DROP TABLE $t2_ign
|
||||
--sync_slave_with_master
|
||||
SET GLOBAL debug= @save_debug;
|
||||
|
||||
--source include/rpl_end.inc
|
@ -9,29 +9,29 @@ connection master;
|
||||
CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4);
|
||||
DROP TABLE t1;
|
||||
# Save master log postion for query DROP TABLE t1
|
||||
# Save master log position for query DROP TABLE t1
|
||||
save_master_pos;
|
||||
let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 7);
|
||||
let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 7);
|
||||
|
||||
CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
|
||||
# Save master log postion for query CREATE TABLE t2
|
||||
# Save master log position for query CREATE TABLE t2
|
||||
save_master_pos;
|
||||
let $master_pos_create_t2= query_get_value(SHOW BINLOG EVENTS, Pos, 8);
|
||||
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
save_master_pos;
|
||||
# Save master log postion for query INSERT INTO t2 VALUES (1),(2);
|
||||
# Save master log position for query INSERT INTO t2 VALUES (1),(2);
|
||||
let $master_pos_insert1_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 12);
|
||||
sync_slave_with_master;
|
||||
|
||||
# Save relay log postion for query INSERT INTO t2 VALUES (1),(2);
|
||||
# Save relay log position for query INSERT INTO t2 VALUES (1),(2);
|
||||
let $relay_pos_insert1_t2= query_get_value(show slave status, Relay_Log_Pos, 1);
|
||||
|
||||
connection master;
|
||||
INSERT INTO t2 VALUES (3),(4);
|
||||
DROP TABLE t2;
|
||||
# Save master log postion for query INSERT INTO t2 VALUES (1),(2);
|
||||
# Save master log position for query INSERT INTO t2 VALUES (1),(2);
|
||||
let $master_pos_drop_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 17);
|
||||
sync_slave_with_master;
|
||||
|
||||
|
@ -47,7 +47,7 @@ eval start slave until master_log_file='master-bin.000001', master_log_pos=$unti
|
||||
--source include/wait_for_slave_io_to_start.inc
|
||||
--source include/wait_for_slave_sql_to_stop.inc
|
||||
|
||||
--echo *** checking until postion execution: must be only t1 in the list ***
|
||||
--echo *** checking until position execution: must be only t1 in the list ***
|
||||
show tables;
|
||||
|
||||
# cleanup
|
||||
|
Reference in New Issue
Block a user