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)*/ /*!99999 ,(3)*/
8 # will be binlogged as
9 # 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /* 99999 ,(3)*/'.
10 ###############################################################################
11 --source include/set_privilege_checks_user_as_system_user.inc
12 source include/master-slave.inc;
13 source include/have_binlog_format_statement.inc;
14
15 --let $mask_binlog_commit_events= 1
16 CREATE TABLE t1(c1 INT);
17 source include/show_binlog_events.inc;
18 let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
19
20 --echo
21 --echo # Case 1:
22 --echo # ------------------------------------------------------------------
23 --echo # In a statement, some CCs are applied while others are not. The CCs
24 --echo # which are not applied on master will be binlogged as common comments.
25
26 /*!99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /*!99999 ,(11)*/;
27
28 source include/show_binlog_events.inc;
29 let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
30 --source include/sync_slave_sql_with_master.inc
31 --let $diff_tables= master:t1,slave:t1
32 --source include/diff_tables.inc
33
34 --echo
35 --echo # Case 2:
36 --echo # -----------------------------------------------------------------
37 --echo # Verify whether it can be binlogged correctly when executing prepared
38 --echo # statement.
39 --connection master
40 PREPARE stmt FROM 'INSERT INTO /*!99999 blabla*/ t1 VALUES(60) /*!99999 ,(61)*/';
41 EXECUTE stmt;
42 DROP TABLE t1;
43 CREATE TABLE t1(c1 INT);
44 EXECUTE stmt;
45
46 --source include/sync_slave_sql_with_master.inc
47 --let $diff_tables= master:t1,slave:t1
48 --source include/diff_tables.inc
49
50 --connection master
51 --echo
52 SET @value=62;
53 PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/';
54 EXECUTE stmt USING @value;
55 DROP TABLE t1;
56 CREATE TABLE t1(c1 INT);
57 EXECUTE stmt USING @value;
58
59 source include/show_binlog_events.inc;
60 let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
61
62 --source include/sync_slave_sql_with_master.inc
63 --let $diff_tables= master:t1,slave:t1
64 --source include/diff_tables.inc
65
66 --echo
67 --echo # Case 3:
68 --echo # -----------------------------------------------------------------
69 --echo # Verify it can restore the '!', if the it is an uncomplete conditional
70 --echo # comments
71 --connection master
72 --error 1064
73 SELECT c1 FROM /*!99999 t1 WHEREN;
74
75
76 --echo #
77 --echo # Bug#53373 Comments are not properly removed from the
78 --echo # pre-processed query buffer.
79 --echo #
80 CREATE/*!*/EVENT e1 ON SCHEDULE EVERY 10 DAY DO/*!*/SELECT 'abc';
81 source include/show_binlog_events.inc;
82
83 --let $mask_binlog_commit_events= 0
84
85 DROP TABLE t1;
86 DROP EVENT e1;
87 --source include/rpl_end.inc