Backport of revno: 2617.62.1
Bug #39675 rename tables on innodb tables with pending transactions causes slave data issue Bug was already fixed as part of patch for Bug#989 (If DROP TABLE while there's an active transaction, wrong binlog order) Test case added to rpl_innodb.test.
This commit is contained in:
parent
92ba2f2a4f
commit
4f48b423c2
@ -82,3 +82,48 @@ FLUSH LOGS;
|
|||||||
FLUSH LOGS;
|
FLUSH LOGS;
|
||||||
DROP DATABASE mysqltest1;
|
DROP DATABASE mysqltest1;
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
|
#
|
||||||
|
# Bug#39675 rename tables on innodb tables with pending
|
||||||
|
# transactions causes slave data issue.
|
||||||
|
#
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
DROP TABLE IF EXISTS t2;
|
||||||
|
DROP TABLE IF EXISTS t3;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
id INT PRIMARY KEY auto_increment,
|
||||||
|
b INT DEFAULT NULL
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
id INT PRIMARY KEY auto_increment,
|
||||||
|
b INT DEFAULT NULL
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 (b) VALUES (1),(2),(3);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO t1(b) VALUES (4);
|
||||||
|
-------- switch to master1 --------
|
||||||
|
RENAME TABLE t1 TO t3, t2 TO t1;;
|
||||||
|
-------- switch to master --------
|
||||||
|
COMMIT;
|
||||||
|
-------- switch to master1 --------
|
||||||
|
-------- switch to master --------
|
||||||
|
SELECT * FROM t1;
|
||||||
|
id b
|
||||||
|
SELECT * FROM t3;
|
||||||
|
id b
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
3 3
|
||||||
|
4 4
|
||||||
|
-------- switch to slave --------
|
||||||
|
SELECT * FROM t1;
|
||||||
|
id b
|
||||||
|
SELECT * FROM t3;
|
||||||
|
id b
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
3 3
|
||||||
|
4 4
|
||||||
|
-------- switch to master --------
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP TABLE t3;
|
||||||
|
End of 6.0 tests
|
||||||
|
@ -120,6 +120,71 @@ connection master;
|
|||||||
FLUSH LOGS;
|
FLUSH LOGS;
|
||||||
|
|
||||||
DROP DATABASE mysqltest1;
|
DROP DATABASE mysqltest1;
|
||||||
-- source include/master-slave-end.inc
|
|
||||||
|
|
||||||
--echo End of 5.1 tests
|
--echo End of 5.1 tests
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#39675 rename tables on innodb tables with pending
|
||||||
|
--echo # transactions causes slave data issue.
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
DROP TABLE IF EXISTS t2;
|
||||||
|
DROP TABLE IF EXISTS t3;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
id INT PRIMARY KEY auto_increment,
|
||||||
|
b INT DEFAULT NULL
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
id INT PRIMARY KEY auto_increment,
|
||||||
|
b INT DEFAULT NULL
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
INSERT INTO t1 (b) VALUES (1),(2),(3);
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO t1(b) VALUES (4);
|
||||||
|
|
||||||
|
--echo -------- switch to master1 --------
|
||||||
|
connection master1;
|
||||||
|
--send RENAME TABLE t1 TO t3, t2 TO t1;
|
||||||
|
|
||||||
|
--echo -------- switch to master --------
|
||||||
|
connection master;
|
||||||
|
# Need to wait until RENAME is received
|
||||||
|
let $wait_condition=
|
||||||
|
SELECT COUNT(*) = 1 FROM information_schema.processlist
|
||||||
|
WHERE info = "RENAME TABLE t1 TO t3, t2 TO t1" and
|
||||||
|
state = "Waiting for table";
|
||||||
|
--source include/wait_condition.inc
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
--echo -------- switch to master1 --------
|
||||||
|
connection master1;
|
||||||
|
--reap
|
||||||
|
|
||||||
|
--echo -------- switch to master --------
|
||||||
|
connection master;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
SELECT * FROM t3;
|
||||||
|
|
||||||
|
sync_slave_with_master;
|
||||||
|
|
||||||
|
--echo -------- switch to slave --------
|
||||||
|
connection slave;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
SELECT * FROM t3;
|
||||||
|
|
||||||
|
--echo -------- switch to master --------
|
||||||
|
connection master;
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP TABLE t3;
|
||||||
|
|
||||||
|
--echo End of 6.0 tests
|
||||||
|
|
||||||
|
--source include/master-slave-end.inc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user