Debian Codegraph @

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

raw
1 --source include/not_group_replication_plugin.inc
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 --source include/sync_slave_sql_with_master.inc
26 call mtr.add_suppression(".*Found table map event mapping table id 0 which was already mapped but with different settings.*");
27 call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
28
29 # stop the slave and inject corruption
30 --source include/stop_slave.inc
31 SET @save_debug= @@global.debug;
32 SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
33 --source include/start_slave.inc
34 --connection master
35 # both tables get mapped to 0 (in a way, simulating scenario
36 # originated by BUG#56226)
37 --eval UPDATE $t1, $t2 SET $t1.c1=3, $t2.c1=4 WHERE $t1.c1=1 OR $t2.c1=2
38 --connection slave
39
40 # wait for error 13117 (ER_REPLICA_FATAL_ERROR)
41 --let $slave_sql_errno=13117
42 --source include/wait_for_slave_sql_error.inc
43 --source include/stop_slave_io.inc
44
45 # clean up
46 SET GLOBAL debug="-d,inject_tblmap_same_id_maps_diff_table";
47 --source include/start_slave.inc
48 --connection master
49 --source include/rpl_reset.inc
50 --eval DROP TABLE $t1, $t2
51 --source include/sync_slave_sql_with_master.inc
52
53 ## test #2: assert that ignored tables that may have been mapped
54 ## with the same identifier are skipped, thus no error
55 ## is raised.
56
57 --connection slave
58 --source include/stop_slave.inc
59 SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
60 --source include/start_slave.inc
61 --source include/rpl_reset.inc
62 --connection master
63 --eval CREATE TABLE $t1 (c1 INT)
64 --eval CREATE TABLE $t2_ign (c1 INT)
65 --eval INSERT INTO $t1 VALUES (1)
66 --eval INSERT INTO $t2_ign VALUES (2)
67 --eval UPDATE $t1, $t2_ign SET $t1.c1=3, $t2_ign.c1=4 WHERE $t1.c1=1 OR $t2_ign.c1=2
68
69 # must not raise error as second table is filtered
70 --source include/sync_slave_sql_with_master.inc
71
72
73 ## test #3: check that BINLOG statements will also raise an
74 ## error if containing table map events mapping different
75 ## tables to same table identifier.
76
77 CREATE TABLE t1 (c1 INT);
78 CREATE TABLE t2 (c1 INT);
79
80 INSERT INTO t1 VALUES (1);
81 INSERT INTO t2 VALUES (1);
82
83 # FD event
84 BINLOG '
85 SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
86 AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=
87 '/*!*/;
88
89 #110708 12:21:44 server id 1 end_log_pos 774 Table_map: `test`.`t1` mapped to number 66
90 # at 774
91 #110708 12:21:44 server id 1 end_log_pos 815 Table_map: `test`.`t2` mapped to number 67
92 # at 815
93 #110708 12:21:44 server id 1 end_log_pos 855 Update_rows: table id 66
94 # at 855
95 #110708 12:21:44 server id 1 end_log_pos 895 Update_rows: table id 67 flags: STMT_END_F
96 SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
97 --error ER_BINLOG_FATAL_ERROR
98 BINLOG '
99 SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE=
100 SOgWThMBAAAAKQAAAC8DAAAAAEMAAAAAAAEABHRlc3QAAnQyAAEDAAE=
101 SOgWThgBAAAAKAAAAFcDAAAAAEIAAAAAAAAAAf///gEAAAD+AwAAAA==
102 SOgWThgBAAAAKAAAAH8DAAAAAEMAAAAAAAEAAf///gEAAAD+BAAAAA==
103 '/*!*/;
104
105
106 # clean up
107 DROP TABLE t1,t2;
108 --connection slave
109 SET GLOBAL debug="-d,inject_tblmap_same_id_maps_diff_table";
110 --connection master
111 --eval DROP TABLE $t1
112 --eval DROP TABLE $t2_ign
113 --source include/sync_slave_sql_with_master.inc
114 SET GLOBAL debug= @save_debug;
115
116 --source include/rpl_end.inc