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###############################################################################
11source include/have_binlog_format_statement.inc;
12source include/master-slave.inc;
13
14CREATE TABLE t1(c1 INT);
15source include/show_binlog_events.inc;
16let $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
26source include/show_binlog_events.inc;
27let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
28sync_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
38PREPARE stmt FROM 'INSERT INTO /*!999999 blabla*/ t1 VALUES(60) /*!999999 ,(61)*/';
39EXECUTE stmt;
40DROP TABLE t1;
41CREATE TABLE t1(c1 INT);
42EXECUTE stmt;
43
44sync_slave_with_master;
45--let $diff_tables= master:t1,slave:t1
46--source include/diff_tables.inc
47
48--connection master
49--echo
50SET @value=62;
51PREPARE stmt FROM 'INSERT INTO /*!999999 blabla */ t1 VALUES(?) /*!999999 ,(63)*/';
52EXECUTE stmt USING @value;
53DROP TABLE t1;
54CREATE TABLE t1(c1 INT);
55EXECUTE stmt USING @value;
56
57source include/show_binlog_events.inc;
58let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
59
60sync_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
71SELECT c1 FROM /*!999999 t1 WHEREN; #*/
72
73#
74# Bug#28388217 - SERVER CAN FAIL WHILE REPLICATING CONDITIONAL COMMENTS
75#
76insert t1 values (/*!50505 1 /* foo */ */ + 2);
77insert t1 values (/*!999999 10 /* foo */ */ + 20);
78source include/show_binlog_events.inc;
79sync_slave_with_master;
80select * from t1;
81connection master;
82
83DROP TABLE t1;
84--source include/rpl_end.inc
85