File: rpl_row_corruption.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (116 lines) | stat: -rw-r--r-- 3,939 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
--source include/not_group_replication_plugin.inc
--source include/have_debug.inc
--source include/have_binlog_format_row.inc
--source include/master-slave.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)

--source include/sync_slave_sql_with_master.inc
call mtr.add_suppression(".*Found table map event mapping table id 0 which was already mapped but with different settings.*");
call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state");

# 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 13117 (ER_REPLICA_FATAL_ERROR)
--let $slave_sql_errno=13117
--source include/wait_for_slave_sql_error.inc
--source include/stop_slave_io.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
--source include/sync_slave_sql_with_master.inc

## 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
--source include/sync_slave_sql_with_master.inc


## 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_BINLOG_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
--source include/sync_slave_sql_with_master.inc
SET GLOBAL debug= @save_debug;

--source include/rpl_end.inc