| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
CREATE TABLE t1(c1 INT); |
| 4 |
include/show_binlog_events.inc |
| 5 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 6 |
master-bin.000001 # Gtid # # GTID #-#-# |
| 7 |
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT) |
| 8 |
|
| 9 |
# Case 1: |
| 10 |
# ------------------------------------------------------------------ |
| 11 |
# In a statement, some CCs are applied while others are not. The CCs |
| 12 |
# which are not applied on master will be binlogged as common comments. |
| 13 |
/*!999999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /*!999999 ,(11)*/; |
| 14 |
include/show_binlog_events.inc |
| 15 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 16 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 17 |
master-bin.000001 # Query # # use `test`; /* 999999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /* 999999 ,(11)*/ |
| 18 |
master-bin.000001 # Query # # COMMIT |
| 19 |
connection slave; |
| 20 |
include/diff_tables.inc [master:t1,slave:t1] |
| 21 |
|
| 22 |
# Case 2: |
| 23 |
# ----------------------------------------------------------------- |
| 24 |
# Verify whether it can be binlogged correctly when executing prepared |
| 25 |
# statement. |
| 26 |
connection master; |
| 27 |
PREPARE stmt FROM 'INSERT INTO /*!999999 blabla*/ t1 VALUES(60) /*!999999 ,(61)*/'; |
| 28 |
EXECUTE stmt; |
| 29 |
DROP TABLE t1; |
| 30 |
CREATE TABLE t1(c1 INT); |
| 31 |
EXECUTE stmt; |
| 32 |
connection slave; |
| 33 |
include/diff_tables.inc [master:t1,slave:t1] |
| 34 |
connection master; |
| 35 |
|
| 36 |
SET @value=62; |
| 37 |
PREPARE stmt FROM 'INSERT INTO /*!999999 blabla */ t1 VALUES(?) /*!999999 ,(63)*/'; |
| 38 |
EXECUTE stmt USING @value; |
| 39 |
DROP TABLE t1; |
| 40 |
CREATE TABLE t1(c1 INT); |
| 41 |
EXECUTE stmt USING @value; |
| 42 |
include/show_binlog_events.inc |
| 43 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 44 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 45 |
master-bin.000001 # Query # # use `test`; INSERT INTO /* 999999 blabla*/ t1 VALUES(60) /* 999999 ,(61)*/ |
| 46 |
master-bin.000001 # Query # # COMMIT |
| 47 |
master-bin.000001 # Gtid # # GTID #-#-# |
| 48 |
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ |
| 49 |
master-bin.000001 # Gtid # # GTID #-#-# |
| 50 |
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT) |
| 51 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 52 |
master-bin.000001 # Query # # use `test`; INSERT INTO /* 999999 blabla*/ t1 VALUES(60) /* 999999 ,(61)*/ |
| 53 |
master-bin.000001 # Query # # COMMIT |
| 54 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 55 |
master-bin.000001 # Query # # use `test`; INSERT INTO /* 999999 blabla */ t1 VALUES(62) /* 999999 ,(63)*/ |
| 56 |
master-bin.000001 # Query # # COMMIT |
| 57 |
master-bin.000001 # Gtid # # GTID #-#-# |
| 58 |
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ |
| 59 |
master-bin.000001 # Gtid # # GTID #-#-# |
| 60 |
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT) |
| 61 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 62 |
master-bin.000001 # Query # # use `test`; INSERT INTO /* 999999 blabla */ t1 VALUES(62) /* 999999 ,(63)*/ |
| 63 |
master-bin.000001 # Query # # COMMIT |
| 64 |
connection slave; |
| 65 |
include/diff_tables.inc [master:t1,slave:t1] |
| 66 |
|
| 67 |
# Case 3: |
| 68 |
# ----------------------------------------------------------------- |
| 69 |
# Verify it can restore the '!', if the it is an uncomplete conditional |
| 70 |
# comments |
| 71 |
connection master; |
| 72 |
SELECT c1 FROM /*!999999 t1 WHEREN; |
| 73 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '/*!999999 t1 WHEREN' at line 1 |
| 74 |
insert t1 values (/*!50505 1 /* foo */ */ + 2); |
| 75 |
insert t1 values (/*!999999 10 /* foo */ */ + 20); |
| 76 |
include/show_binlog_events.inc |
| 77 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 78 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 79 |
master-bin.000001 # Query # # use `test`; insert t1 values (/*!50505 1 /* foo */ */ + 2) |
| 80 |
master-bin.000001 # Query # # COMMIT |
| 81 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 82 |
master-bin.000001 # Query # # use `test`; insert t1 values (/* 999999 10 (* foo *) */ + 20) |
| 83 |
master-bin.000001 # Query # # COMMIT |
| 84 |
connection slave; |
| 85 |
select * from t1; |
| 86 |
c1 |
| 87 |
62 |
| 88 |
3 |
| 89 |
20 |
| 90 |
connection master; |
| 91 |
insert t1 values /*! (100);insert t1 values */ (200) // |
| 92 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'insert t1 values */ (200)' at line 1 |
| 93 |
select * from t1; |
| 94 |
c1 |
| 95 |
62 |
| 96 |
3 |
| 97 |
20 |
| 98 |
connection slave; |
| 99 |
select * from t1; |
| 100 |
c1 |
| 101 |
62 |
| 102 |
3 |
| 103 |
20 |
| 104 |
connection master; |
| 105 |
DROP TABLE t1; |
| 106 |
include/rpl_end.inc |