|
| 1 | +include/master-slave.inc |
| 2 | +Warnings: |
| 3 | +Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. |
| 4 | +Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. |
| 5 | +[connection master] |
| 6 | +CALL mtr.add_suppression("Found 1 prepared XA transactions"); |
| 7 | +CREATE DATABASE db1; |
| 8 | +CREATE DATABASE db2; |
| 9 | +CREATE TABLE t1(c1 INT); |
| 10 | +CREATE TABLE t2(c1 INT); |
| 11 | +CREATE TABLE mem_t1(c1 INT PRIMARY KEY) ENGINE = MEMORY; |
| 12 | +CREATE TABLE mem_t2(c1 INT PRIMARY KEY) ENGINE = MEMORY; |
| 13 | +CREATE TABLE db1.mem_t1(c1 INT PRIMARY KEY) ENGINE = MEMORY; |
| 14 | +CREATE TABLE db1.mem_t2(c1 INT PRIMARY KEY) ENGINE = MEMORY; |
| 15 | +CREATE TABLE db2.mem_t1(c1 INT PRIMARY KEY) ENGINE = MEMORY; |
| 16 | +CREATE TABLE db2.mem_t2(c1 INT PRIMARY KEY) ENGINE = MEMORY; |
| 17 | +CREATE TABLE db2.mem_t3(c1 INT PRIMARY KEY) ENGINE = MEMORY; |
| 18 | +CREATE TABLE db2.mem_t4(c1 INT PRIMARY KEY) ENGINE = MEMORY; |
| 19 | +CREATE TABLE db2.mem_t5(c1 INT PRIMARY KEY) ENGINE = MEMORY; |
| 20 | +CREATE TRIGGER tr1 AFTER INSERT ON t2 FOR EACH ROW |
| 21 | +BEGIN |
| 22 | +INSERT INTO t1 SELECT * FROM db2.mem_t3; |
| 23 | +END | |
| 24 | +INSERT INTO mem_t1 VALUES(1),(2),(3); |
| 25 | +INSERT INTO mem_t2 VALUES(1),(2),(3); |
| 26 | +INSERT INTO db1.mem_t1 VALUES(1),(2),(3); |
| 27 | +INSERT INTO db1.mem_t2 VALUES(1),(2),(3); |
| 28 | +INSERT INTO db2.mem_t1 VALUES(1),(2),(3); |
| 29 | +INSERT INTO db2.mem_t2 VALUES(1),(2),(3); |
| 30 | +INSERT INTO db2.mem_t3 VALUES(1),(2),(3); |
| 31 | +INSERT INTO db2.mem_t4 VALUES(1),(2),(3); |
| 32 | +INSERT INTO db2.mem_t5 VALUES(1),(2),(3); |
| 33 | +include/sync_slave_sql_with_master.inc |
| 34 | +include/stop_slave_io.inc |
| 35 | +[connection master] |
| 36 | +XA START 'xa1'; |
| 37 | +INSERT INTO t1 VALUES(1); |
| 38 | +XA END 'xa1'; |
| 39 | +XA PREPARE 'xa1'; |
| 40 | +include/save_master_pos.inc |
| 41 | +include/rpl_restart_server.inc [server_number=1] |
| 42 | +[connection slave] |
| 43 | +include/start_slave_io.inc |
| 44 | +include/sync_slave_sql.inc |
| 45 | +# |
| 46 | +# Test case 1: verify XA COMMIT can be binlogged correctly. |
| 47 | +# |
| 48 | +[connection master] |
| 49 | +include/gtid_step_reset.inc |
| 50 | +include/save_binlog_position.inc |
| 51 | +include/gtid_step_assert.inc [count=3, only_count=0] |
| 52 | +include/assert_binlog_events.inc [Gtid # Query/.*BEGIN # Query/.*DELETE.* # Query/.*COMMIT # Gtid # Query/.*BEGIN # Query/.*DELETE.* # Query/.*COMMIT] |
| 53 | +include/sync_slave_sql_with_master.inc |
| 54 | +include/rpl_diff.inc |
| 55 | +# |
| 56 | +# Test case 2: verify COM_FIELD_LIST can binlog DELETE FROM mem_xx |
| 57 | +# correctly |
| 58 | +# |
| 59 | +[connection master] |
| 60 | +include/gtid_step_reset.inc |
| 61 | +include/gtid_step_assert.inc [count=2, only_count=0] |
| 62 | +include/sync_slave_sql_with_master.inc |
| 63 | +SELECT * FROM mem_t1; |
| 64 | +c1 |
| 65 | +SELECT * FROM mem_t2; |
| 66 | +c1 |
| 67 | +# |
| 68 | +# Test case 3: verify DELETE FROM mem_xx can be binlogged correctly |
| 69 | +# in CREATE TABLE ... LIKE |
| 70 | +[connection master] |
| 71 | +include/gtid_step_reset.inc |
| 72 | +include/save_binlog_position.inc |
| 73 | +CREATE TABLE t3 LIKE db2.mem_t1; |
| 74 | +include/gtid_step_assert.inc [count=2, only_count=0] |
| 75 | +include/assert_binlog_events.inc [Gtid # Query/.*BEGIN # Query/.*DELETE.* # Query/.*COMMIT] |
| 76 | +include/sync_slave_sql_with_master.inc |
| 77 | +SELECT * FROM db2.mem_t1; |
| 78 | +c1 |
| 79 | +# |
| 80 | +# Test case 4: verify DELETE FROM mem_xx can be binlogged correctly |
| 81 | +# in DML |
| 82 | +[connection master] |
| 83 | +include/gtid_step_reset.inc |
| 84 | +include/save_binlog_position.inc |
| 85 | +INSERT INTO t3 SELECT * FROM db2.mem_t2 UNION SELECT 10; |
| 86 | +include/gtid_step_assert.inc [count=2, only_count=0] |
| 87 | +include/assert_binlog_events.inc [Gtid # Query/.*BEGIN # Query/.*DELETE.* # Query/.*COMMIT] |
| 88 | +include/sync_slave_sql_with_master.inc |
| 89 | +SELECT * FROM db2.mem_t2; |
| 90 | +c1 |
| 91 | +# |
| 92 | +# Test case 5: verify DELETE FROM mem_xx can be binlogged correctly |
| 93 | +# in a trigger |
| 94 | +[connection master] |
| 95 | +include/gtid_step_reset.inc |
| 96 | +include/save_binlog_position.inc |
| 97 | +INSERT INTO t2 VALUES(11); |
| 98 | +include/gtid_step_assert.inc [count=2, only_count=0] |
| 99 | +include/assert_binlog_events.inc [Gtid # Query/.*BEGIN # Query/.*DELETE.* # Query/.*COMMIT] |
| 100 | +include/sync_slave_sql_with_master.inc |
| 101 | +SELECT * FROM db2.mem_t3; |
| 102 | +c1 |
| 103 | +# |
| 104 | +# Test case 6: Verify DELETE FROM mem_xx can be binlog correctly |
| 105 | +# when ALTER the memory table. |
| 106 | +[connection master] |
| 107 | +include/gtid_step_reset.inc |
| 108 | +include/save_binlog_position.inc |
| 109 | +ALTER TABLE db2.mem_t4 ADD COLUMN c2 INT; |
| 110 | +include/gtid_step_assert.inc [count=2, only_count=0] |
| 111 | +include/assert_binlog_events.inc [Gtid # Query/.*BEGIN # Query/.*DELETE.* # Query/.*COMMIT] |
| 112 | +include/sync_slave_sql_with_master.inc |
| 113 | +SELECT * FROM db2.mem_t4; |
| 114 | +c1 c2 |
| 115 | +# |
| 116 | +# Test case 7: Verify DELETE FROM mem_xx can be binlog correctly |
| 117 | +# when DROP the memory table. |
| 118 | +[connection master] |
| 119 | +include/gtid_step_reset.inc |
| 120 | +DROP TABLE db2.mem_t5; |
| 121 | +include/gtid_step_assert.inc [count=1, only_count=0] |
| 122 | +include/sync_slave_sql_with_master.inc |
| 123 | +[connection master] |
| 124 | +DROP TABLE t1, t2, t3, mem_t1, mem_t2; |
| 125 | +DROP DATABASE db1; |
| 126 | +DROP DATABASE db2; |
| 127 | +include/rpl_end.inc |
0 commit comments