include/master-slave.inc
Warnings:
Note	####	Sending passwords in plain text without SSL/TLS is extremely insecure.
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.
[connection master]
CREATE DATABASE db1;
CREATE DATABASE db2;
CREATE TABLE t1(c1 INT);
CREATE TABLE t2(c1 INT);
CREATE TABLE mem_t1(c1 INT PRIMARY KEY) ENGINE = MEMORY;
CREATE TABLE mem_t2(c1 INT PRIMARY KEY) ENGINE = MEMORY;
CREATE TABLE db1.mem_t1(c1 INT PRIMARY KEY) ENGINE = MEMORY;
CREATE TABLE db1.mem_t2(c1 INT PRIMARY KEY) ENGINE = MEMORY;
CREATE TABLE db2.mem_t1(c1 INT PRIMARY KEY) ENGINE = MEMORY;
CREATE TABLE db2.mem_t2(c1 INT PRIMARY KEY) ENGINE = MEMORY;
CREATE TABLE db2.mem_t3(c1 INT PRIMARY KEY) ENGINE = MEMORY;
CREATE TABLE db2.mem_t4(c1 INT PRIMARY KEY) ENGINE = MEMORY;
CREATE TABLE db2.mem_t5(c1 INT PRIMARY KEY) ENGINE = MEMORY;
CREATE TRIGGER tr1 AFTER INSERT ON t2 FOR EACH ROW
BEGIN
INSERT INTO t1 SELECT * FROM db2.mem_t3;
END |
INSERT INTO db1.mem_t1 VALUES(1),(2),(3);
INSERT INTO db1.mem_t2 VALUES(1),(2),(3);
INSERT INTO db2.mem_t1 VALUES(1),(2),(3);
INSERT INTO db2.mem_t2 VALUES(1),(2),(3);
INSERT INTO db2.mem_t3 VALUES(1),(2),(3);
INSERT INTO db2.mem_t4 VALUES(1),(2),(3);
INSERT INTO db2.mem_t5 VALUES(1),(2),(3);
include/sync_slave_sql_with_master.inc
include/stop_slave_io.inc
[connection master]
include/rpl_restart_server.inc [server_number=1]
include/rpl_reconnect.inc
[connection slave]
include/start_slave_io.inc
include/sync_slave_sql.inc
#
# Test case 1: verify DELETE FROM mem_xx can be binlogged correctly
#              in CREATE TABLE ... LIKE
[connection master]
include/gtid_step_reset.inc
include/save_binlog_position.inc
CREATE TABLE t3 LIKE db2.mem_t1;
include/gtid_step_assert.inc [count=2, only_count=0]
include/assert_binlog_events.inc [Gtid # Query/.*BEGIN # Query/.*DELETE.* # Query/.*COMMIT]
include/sync_slave_sql_with_master.inc
SELECT * FROM db2.mem_t1;
c1
#
# Test case 2: verify DELETE FROM mem_xx can be binlogged correctly
#              in DML
[connection master]
include/gtid_step_reset.inc
include/save_binlog_position.inc
INSERT INTO t3 SELECT * FROM db2.mem_t2 UNION SELECT 10;
include/gtid_step_assert.inc [count=2, only_count=0]
include/assert_binlog_events.inc [Gtid # Query/.*BEGIN # Query/.*DELETE.* # Query/.*COMMIT]
include/sync_slave_sql_with_master.inc
SELECT * FROM db2.mem_t2;
c1
#
# Test case 3: verify DELETE FROM mem_xx can be binlogged correctly
#              in a trigger
[connection master]
include/gtid_step_reset.inc
include/save_binlog_position.inc
INSERT INTO t2 VALUES(11);
include/gtid_step_assert.inc [count=2, only_count=0]
include/assert_binlog_events.inc [Gtid # Query/.*BEGIN # Query/.*DELETE.* # Query/.*COMMIT]
include/sync_slave_sql_with_master.inc
SELECT * FROM db2.mem_t3;
c1
#
# Test case 4: Verify DELETE FROM mem_xx can be binlog correctly
#              when ALTER the memory table.
[connection master]
include/gtid_step_reset.inc
include/save_binlog_position.inc
ALTER TABLE db2.mem_t4 ADD COLUMN c2 INT;
include/gtid_step_assert.inc [count=2, only_count=0]
include/assert_binlog_events.inc [Gtid # Query/.*BEGIN # Query/.*DELETE.* # Query/.*COMMIT]
include/sync_slave_sql_with_master.inc
SELECT * FROM db2.mem_t4;
c1	c2
#
# Test case 5: Verify DELETE FROM mem_xx can be binlog correctly
#              when DROP the memory table.
[connection master]
include/gtid_step_reset.inc
DROP TABLE db2.mem_t5;
include/gtid_step_assert.inc [count=1, only_count=0]
include/sync_slave_sql_with_master.inc
[connection master]
DROP TABLE t1, t2, t3, mem_t1, mem_t2;
DROP DATABASE db1;
DROP DATABASE db2;
include/rpl_end.inc
