1
include/master-slave.inc
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.
8
CREATE TABLE t1 (a CHAR(48));
9
CREATE TEMPORARY TABLE t1_tmp1(a INT);
10
INSERT INTO t1 VALUES (UUID());
12
==== Verify results on slave ====
13
SHOW STATUS LIKE "Slave_open_temp_tables";
15
Slave_open_temp_tables 1
19
==== Verify results on slave ====
20
SHOW STATUS LIKE "Slave_open_temp_tables";
22
Slave_open_temp_tables 0
25
include/rpl_connect.inc [creating master]
29
CREATE TABLE t1 (a int);
30
CREATE TABLE t2 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) );
31
CREATE TABLE t3 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) );
32
CREATE TRIGGER tr1 AFTER DELETE ON t2 FOR EACH ROW INSERT INTO t3 () VALUES ();
33
CREATE TEMPORARY TABLE t1_tmp (i1 int);
34
ALTER TABLE t1_tmp ADD COLUMN b INT;
36
CREATE TEMPORARY TABLE t2_tmp (a int);
37
ALTER TABLE t1_tmp ADD COLUMN c INT;
38
### assertion: assert that there is one open temp table on slave
39
SHOW STATUS LIKE 'Slave_open_temp_tables';
41
Slave_open_temp_tables 1
42
DROP TABLE t1_tmp, t2;
43
INSERT INTO t1 VALUES (1);
44
DROP TEMPORARY TABLE t2_tmp;
45
INSERT INTO t1 VALUES (2);
46
### assertion: assert that slave has no temporary tables opened
47
SHOW STATUS LIKE 'Slave_open_temp_tables';
49
Slave_open_temp_tables 0
51
include/show_binlog_events.inc
52
Log_name Pos Event_type Server_id End_log_pos Info
53
slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
54
slave-bin.000001 # Query # # use `test`; CREATE TABLE t2 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) )
55
slave-bin.000001 # Query # # use `test`; CREATE TABLE t3 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) )
56
slave-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t2 FOR EACH ROW INSERT INTO t3 () VALUES ()
57
slave-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE t1_tmp (i1 int)
58
slave-bin.000001 # Query # # use `test`; ALTER TABLE t1_tmp ADD COLUMN b INT
59
slave-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t1_tmp` /* generated by server */
60
slave-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
61
slave-bin.000001 # Query # # BEGIN
62
slave-bin.000001 # Table_map # # table_id: # (test.t1)
63
slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
64
slave-bin.000001 # Xid # # COMMIT /* XID */
65
slave-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t2_tmp` /* generated by server */
66
slave-bin.000001 # Query # # BEGIN
67
slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
68
slave-bin.000001 # Xid # # COMMIT /* XID */
69
slave-bin.000001 # Query # # use `test`; DROP TABLE `t3`,`t1` /* generated by server */
71
# Bug#55478 Row events wrongly apply on the temporary table of the same name
72
# ==========================================================================
73
# The statement should be binlogged
74
CREATE TEMPORARY TABLE t1(c1 INT) ENGINE=InnoDB;
76
# Case 1: CREATE TABLE t1 ... SELECT
77
# ----------------------------------
79
# The statement generates row events on t1. And the rows events should
80
# be inserted into the base table on slave.
81
CREATE TABLE t1 ENGINE=MyISAM SELECT rand();
82
include/show_binlog_events.inc
83
Log_name Pos Event_type Server_id End_log_pos Info
84
master-bin.000001 # Query # # BEGIN
85
master-bin.000001 # Query # # use `test`; CREATE TABLE `t1` (
86
`rand()` double NOT NULL DEFAULT '0'
88
master-bin.000001 # Table_map # # table_id: # (test.t1)
89
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
90
master-bin.000001 # Query # # COMMIT
92
# Case 2: DROP TEMPORARY TABLE in a transacation
93
# ----------------------------------------------
96
DROP TEMPORARY TABLE t1;
97
# The rows event will binlogged before 'DROP TEMPORARY TABLE t1',
98
# as t1 is non-transactional table
99
INSERT INTO t1 VALUES(Rand());
101
include/show_binlog_events.inc
102
Log_name Pos Event_type Server_id End_log_pos Info
103
master-bin.000001 # Query # # BEGIN
104
master-bin.000001 # Table_map # # table_id: # (test.t1)
105
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
106
master-bin.000001 # Query # # COMMIT
107
master-bin.000001 # Query # # BEGIN
108
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t1` /* generated by server */
109
master-bin.000001 # Query # # COMMIT
110
# Compare the base table.
111
include/diff_tables.inc [master:t1, slave:t1]