| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
connection master; |
| 4 |
CREATE TABLE t4 ( |
| 5 |
id INT(5) unsigned NOT NULL auto_increment, |
| 6 |
name varchar(15) NOT NULL default '', |
| 7 |
number varchar(35) NOT NULL default 'default', |
| 8 |
PRIMARY KEY (id), |
| 9 |
UNIQUE KEY unique_rec (name,number) |
| 10 |
) ENGINE=InnoDB; |
| 11 |
LOAD DATA |
| 12 |
INFILE '../../std_data/loaddata_pair.dat' |
| 13 |
REPLACE INTO TABLE t4 |
| 14 |
(name,number); |
| 15 |
SELECT * FROM t4; |
| 16 |
id name number |
| 17 |
1 XXX 12345 |
| 18 |
2 XXY 12345 |
| 19 |
connection slave; |
| 20 |
SELECT * FROM t4; |
| 21 |
id name number |
| 22 |
1 XXX 12345 |
| 23 |
2 XXY 12345 |
| 24 |
connection master; |
| 25 |
LOAD DATA |
| 26 |
INFILE '../../std_data/loaddata_pair.dat' |
| 27 |
REPLACE INTO TABLE t4 |
| 28 |
(name,number); |
| 29 |
SELECT * FROM t4; |
| 30 |
id name number |
| 31 |
4 XXX 12345 |
| 32 |
5 XXY 12345 |
| 33 |
connection slave; |
| 34 |
SELECT * FROM t4; |
| 35 |
id name number |
| 36 |
4 XXX 12345 |
| 37 |
5 XXY 12345 |
| 38 |
connection master; |
| 39 |
connection slave; |
| 40 |
connection master; |
| 41 |
FLUSH LOGS; |
| 42 |
connection slave; |
| 43 |
FLUSH LOGS; |
| 44 |
connection master; |
| 45 |
DROP DATABASE IF EXISTS mysqltest1; |
| 46 |
CREATE DATABASE mysqltest1; |
| 47 |
CREATE TEMPORARY TABLE mysqltest1.tmp (f1 BIGINT); |
| 48 |
CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE="InnoDB"; |
| 49 |
SET AUTOCOMMIT = 0; |
| 50 |
connection slave; |
| 51 |
connection slave; |
| 52 |
ALTER TABLE mysqltest1.t1 ENGINE = MyISAM; |
| 53 |
SHOW CREATE TABLE mysqltest1.t1; |
| 54 |
Table Create Table |
| 55 |
t1 CREATE TABLE `t1` ( |
| 56 |
`f1` bigint(20) DEFAULT NULL |
| 57 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 58 |
connection master; |
| 59 |
INSERT INTO mysqltest1.t1 SET f1= 1; |
| 60 |
DROP TEMPORARY TABLE mysqltest1.tmp; |
| 61 |
ROLLBACK; |
| 62 |
SHOW CREATE TABLE mysqltest1.tmp; |
| 63 |
ERROR 42S02: Table 'mysqltest1.tmp' doesn't exist |
| 64 |
######### Must return no rows here ######### |
| 65 |
SELECT COUNT(*) FROM mysqltest1.t1; |
| 66 |
COUNT(*) |
| 67 |
0 |
| 68 |
INSERT INTO mysqltest1.t1 SET f1= 2; |
| 69 |
CREATE TEMPORARY TABLE mysqltest1.tmp2(a INT); |
| 70 |
ROLLBACK; |
| 71 |
SHOW CREATE TABLE mysqltest1.tmp2; |
| 72 |
Table Create Table |
| 73 |
tmp2 CREATE TEMPORARY TABLE `tmp2` ( |
| 74 |
`a` int(11) DEFAULT NULL |
| 75 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 76 |
######### Must return no rows here ######### |
| 77 |
SELECT COUNT(*) FROM mysqltest1.t1; |
| 78 |
COUNT(*) |
| 79 |
0 |
| 80 |
connection slave; |
| 81 |
connection slave; |
| 82 |
SHOW CREATE TABLE mysqltest1.tmp; |
| 83 |
ERROR 42S02: Table 'mysqltest1.tmp' doesn't exist |
| 84 |
SHOW CREATE TABLE mysqltest1.tmp2; |
| 85 |
ERROR 42S02: Table 'mysqltest1.tmp2' doesn't exist |
| 86 |
######### t1 has two rows here: the transaction not rolled back since t1 uses MyISAM ######### |
| 87 |
SELECT COUNT(*) FROM mysqltest1.t1; |
| 88 |
COUNT(*) |
| 89 |
2 |
| 90 |
FLUSH LOGS; |
| 91 |
connection master; |
| 92 |
FLUSH LOGS; |
| 93 |
DROP TEMPORARY TABLE IF EXISTS mysqltest1.tmp2; |
| 94 |
DROP DATABASE mysqltest1; |
| 95 |
End of 5.1 tests |
| 96 |
# |
| 97 |
# Bug#39675 rename tables on innodb tables with pending |
| 98 |
# transactions causes slave data issue. |
| 99 |
# |
| 100 |
DROP TABLE IF EXISTS t1; |
| 101 |
DROP TABLE IF EXISTS t2; |
| 102 |
DROP TABLE IF EXISTS t3; |
| 103 |
CREATE TABLE t1 ( |
| 104 |
id INT PRIMARY KEY auto_increment, |
| 105 |
b INT DEFAULT NULL |
| 106 |
) ENGINE=InnoDB; |
| 107 |
CREATE TABLE t2 ( |
| 108 |
id INT PRIMARY KEY auto_increment, |
| 109 |
b INT DEFAULT NULL |
| 110 |
) ENGINE=InnoDB; |
| 111 |
INSERT INTO t1 (b) VALUES (1),(2),(3); |
| 112 |
BEGIN; |
| 113 |
INSERT INTO t1(b) VALUES (4); |
| 114 |
connection master1; |
| 115 |
RENAME TABLE t1 TO t3, t2 TO t1;; |
| 116 |
connection master; |
| 117 |
COMMIT; |
| 118 |
connection master1; |
| 119 |
connection master; |
| 120 |
SELECT * FROM t1; |
| 121 |
id b |
| 122 |
SELECT * FROM t3; |
| 123 |
id b |
| 124 |
1 1 |
| 125 |
2 2 |
| 126 |
3 3 |
| 127 |
4 4 |
| 128 |
connection slave; |
| 129 |
connection slave; |
| 130 |
SELECT * FROM t1; |
| 131 |
id b |
| 132 |
SELECT * FROM t3; |
| 133 |
id b |
| 134 |
1 1 |
| 135 |
2 2 |
| 136 |
3 3 |
| 137 |
4 4 |
| 138 |
connection master; |
| 139 |
DROP TABLE t1; |
| 140 |
DROP TABLE t3; |
| 141 |
End of 6.0 tests |
| 142 |
include/rpl_end.inc |