Debian Codegraph @

mysql-test/suite/rpl/t/rpl_row_corruption.test

raw
1 #
2 --source include/have_debug.inc
3 --source include/have_binlog_format_row.inc
4 --source include/master-slave.inc
5
6 # BUG#11753004: 44360: REPLICATION FAILED
7
8 ## assert that we get an error when checking the
9 ## identifiers at the slave (instead of a crash or
10 ## different table being updated)
11
12 --let $t1= t1_11753004
13 --let $t2= t2_11753004
14 --let $t2_ign= t2_11753004_ign
15
16 ## test #1: assert that we get an error raised when multiple
17 ## tables in the same RBR statement are mapped with the
18 ## same identifier
19
20 --eval CREATE TABLE $t1 (c1 INT)
21 --eval CREATE TABLE $t2 (c1 INT)
22 --eval INSERT INTO $t1 VALUES (1)
23 --eval INSERT INTO $t2 VALUES (2)
24
25 --sync_slave_with_master
26 call mtr.add_suppression(".*Found table map event mapping table id 0 which was already mapped but with different settings.*");
27
28 # stop the slave and inject corruption
29 --source include/stop_slave.inc
30 SET @saved_debug= @@global.debug_dbug;
31 SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
32 --source include/start_slave.inc
33 --connection master
34 # both tables get mapped to 0 (in a way, simulating scenario
35 # originated by BUG#56226)
36 --eval UPDATE $t1, $t2 SET $t1.c1=3, $t2.c1=4 WHERE $t1.c1=1 OR $t2.c1=2
37 --connection slave
38
39 # wait for error 1593 (ER_SLAVE_FATAL_ERROR)
40 --let $slave_sql_errno=1593
41 --source include/wait_for_slave_sql_error.inc
42 --source include/stop_slave_io.inc
43
44 # clean up
45 SET @@global.debug_dbug=@saved_debug;
46 --source include/start_slave.inc
47 --connection master
48 --source include/rpl_reset.inc
49 --eval DROP TABLE $t1, $t2
50 --sync_slave_with_master
51
52 ## test #2: assert that ignored tables that may have been mapped
53 ## with the same identifier are skipped, thus no error
54 ## is raised.
55
56 --connection slave
57 --source include/stop_slave.inc
58 SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
59 --source include/start_slave.inc
60 --source include/rpl_reset.inc
61 --connection master
62 --eval CREATE TABLE $t1 (c1 INT)
63 --eval CREATE TABLE $t2_ign (c1 INT)
64 --eval INSERT INTO $t1 VALUES (1)
65 --eval INSERT INTO $t2_ign VALUES (2)
66 --eval UPDATE $t1, $t2_ign SET $t1.c1=3, $t2_ign.c1=4 WHERE $t1.c1=1 OR $t2_ign.c1=2
67
68 # must not raise error as second table is filtered
69 --sync_slave_with_master
70
71
72 ## test #3: check that BINLOG statements will also raise an
73 ## error if containing table map events mapping different
74 ## tables to same table identifier.
75
76 CREATE TABLE t1 (c1 INT);
77 CREATE TABLE t2 (c1 INT);
78
79 INSERT INTO t1 VALUES (1);
80 INSERT INTO t2 VALUES (1);
81
82 # FD event
83 BINLOG '
84 SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
85 AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=
86 '/*!*/;
87
88 #110708 12:21:44 server id 1 end_log_pos 774 Table_map: `test`.`t1` mapped to number 66
89 # at 774
90 #110708 12:21:44 server id 1 end_log_pos 815 Table_map: `test`.`t2` mapped to number 67
91 # at 815
92 #110708 12:21:44 server id 1 end_log_pos 855 Update_rows: table id 66
93 # at 855
94 #110708 12:21:44 server id 1 end_log_pos 895 Update_rows: table id 67 flags: STMT_END_F
95 SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
96 --error ER_SLAVE_FATAL_ERROR
97 BINLOG '
98 SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE=
99 SOgWThMBAAAAKQAAAC8DAAAAAEMAAAAAAAEABHRlc3QAAnQyAAEDAAE=
100 SOgWThgBAAAAKAAAAFcDAAAAAEIAAAAAAAAAAf///gEAAAD+AwAAAA==
101 SOgWThgBAAAAKAAAAH8DAAAAAEMAAAAAAAEAAf///gEAAAD+BAAAAA==
102 '/*!*/;
103
104
105 # clean up
106 DROP TABLE t1,t2;
107 --connection slave
108 SET @@global.debug_dbug=@saved_debug;
109 --connection master
110 --eval DROP TABLE $t1
111 --eval DROP TABLE $t2_ign
112 --sync_slave_with_master
113 SET @@global.debug_dbug= @save_debug;
114
115 --source include/rpl_end.inc