Debian Codegraph @

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

raw
1 #
2 # ==== Purpose ====
3 #
4 # This test checks if the Exec_Master_Log_Pos and the Read_Master_Log_Pos match
5 # after a statement with an error ignored by the slave.
6 #
7 # ==== Implementation ====
8 #
9 # Assert if Exec_Master_Log_Pos is the same as Read_Master_Log_Pos after three
10 # different scenarios using transactional tables:
11 # 1) DDL
12 # 2) DML with autocommit
13 # 3) DML inside a transaction
14 #
15 # ==== References ====
16 #
17 # BUG#22268777 BINLOGLESS SLAVE DOES NOT UPDATE EXEC_MASTER_LOG_POS
18 # WITH REPLICA_SKIP_ERRORS
19
20 --source include/master-slave.inc
21
22 CREATE TABLE t1_trans (n INT NOT NULL PRIMARY KEY) ENGINE=INNODB;
23
24 --source include/sync_slave_sql_with_master.inc
25
26 call mtr.add_suppression("You need to use --log-bin to make --binlog-format work.");
27
28 CREATE TABLE t2_trans (a INT) ENGINE=INNODB;
29 INSERT INTO t1_trans VALUES (1);
30 INSERT INTO t1_trans VALUES (2);
31
32 --source include/rpl_connection_master.inc
33 # error because table already exists in slave
34 CREATE TABLE t2_trans (a INT);
35
36 # the slave will not apply all master's gtids
37 --let $ignore_gtids_on_sync= 1
38 --source include/sync_slave_sql_with_master.inc
39
40 --let $exec_master_log_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
41 --let $read_master_log_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1)
42
43 --let $assert_text= exec_master_log_pos should be equal to read_master_log_pos after CREATE TABLE
44 --let $assert_cond= $exec_master_log_pos = $read_master_log_pos
45 --source include/assert.inc
46
47 --source include/rpl_connection_master.inc
48 # error because the value already exists in the table in the slave
49 INSERT INTO t1_trans VALUES (1);
50 --source include/sync_slave_sql_with_master.inc
51
52 --let $exec_master_log_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
53 --let $read_master_log_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1)
54
55 --let $assert_text= exec_master_log_pos should be equal to read_master_log_pos after INSERT
56 --let $assert_cond= $exec_master_log_pos = $read_master_log_pos
57 --source include/assert.inc
58
59 --source include/rpl_connection_master.inc
60 # error because the value already exists in the table in the slave
61 BEGIN;
62 INSERT INTO t1_trans VALUES (2);
63 COMMIT;
64 --source include/sync_slave_sql_with_master.inc
65
66 --let $exec_master_log_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
67 --let $read_master_log_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1)
68
69 --let $assert_text= exec_master_log_pos should be equal to read_master_log_pos after INSERT inside transaction
70 --let $assert_cond= $exec_master_log_pos = $read_master_log_pos
71 --source include/assert.inc
72
73 # cleanup
74 --source include/rpl_connection_master.inc
75 DROP TABLE t1_trans, t2_trans;
76 --source include/sync_slave_sql_with_master.inc
77 --source include/rpl_connection_master.inc
78 --source include/rpl_end.inc