Debian Codegraph @

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

raw
1 ###############################################################################
2 # After the patch for BUG#49124:
3 # - Use ' ' instead of '!' in the conditional comments which are not applied on
4 # master. So they become common comments and will not be applied on slave.
5 #
6 # - Example:
7 # 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /*!999999 ,(3)*/
8 # will be binlogged as
9 # 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /* 99999 ,(3)*/'.
10 ###############################################################################
11 source include/have_binlog_format_statement.inc;
12 source include/master-slave.inc;
13
14 CREATE TABLE t1(c1 INT);
15 source include/show_binlog_events.inc;
16 let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
17
18 --echo
19 --echo # Case 1:
20 --echo # ------------------------------------------------------------------
21 --echo # In a statement, some CCs are applied while others are not. The CCs
22 --echo # which are not applied on master will be binlogged as common comments.
23
24 /*!999999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /*!999999 ,(11)*/;
25
26 source include/show_binlog_events.inc;
27 let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
28 sync_slave_with_master;
29 --let $diff_tables= master:t1,slave:t1
30 --source include/diff_tables.inc
31
32 --echo
33 --echo # Case 2:
34 --echo # -----------------------------------------------------------------
35 --echo # Verify whether it can be binlogged correctly when executing prepared
36 --echo # statement.
37 --connection master
38 PREPARE stmt FROM 'INSERT INTO /*!999999 blabla*/ t1 VALUES(60) /*!999999 ,(61)*/';
39 EXECUTE stmt;
40 DROP TABLE t1;
41 CREATE TABLE t1(c1 INT);
42 EXECUTE stmt;
43
44 sync_slave_with_master;
45 --let $diff_tables= master:t1,slave:t1
46 --source include/diff_tables.inc
47
48 --connection master
49 --echo
50 SET @value=62;
51 PREPARE stmt FROM 'INSERT INTO /*!999999 blabla */ t1 VALUES(?) /*!999999 ,(63)*/';
52 EXECUTE stmt USING @value;
53 DROP TABLE t1;
54 CREATE TABLE t1(c1 INT);
55 EXECUTE stmt USING @value;
56
57 source include/show_binlog_events.inc;
58 let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
59
60 sync_slave_with_master;
61 --let $diff_tables= master:t1,slave:t1
62 --source include/diff_tables.inc
63
64 --echo
65 --echo # Case 3:
66 --echo # -----------------------------------------------------------------
67 --echo # Verify it can restore the '!', if the it is an uncomplete conditional
68 --echo # comments
69 --connection master
70 --error 1064
71 SELECT c1 FROM /*!999999 t1 WHEREN; #*/
72
73 #
74 # Bug#28388217 - SERVER CAN FAIL WHILE REPLICATING CONDITIONAL COMMENTS
75 #
76 insert t1 values (/*!50505 1 /* foo */ */ + 2);
77 insert t1 values (/*!999999 10 /* foo */ */ + 20);
78 source include/show_binlog_events.inc;
79 sync_slave_with_master;
80 select * from t1;
81 connection master;
82
83 #
84 # Bug#37117875 Binlog record error when delimiter is set to other symbols
85 #
86 delimiter //;
87 --error ER_PARSE_ERROR
88 insert t1 values /*! (100);insert t1 values */ (200) //
89 delimiter ;//
90 select * from t1;
91 sync_slave_with_master;
92 select * from t1;
93 connection master;
94
95 DROP TABLE t1;
96 --source include/rpl_end.inc