1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Bug #50124 Rpl failure on DROP table with concurrent txn/non-txn

DML flow and SAVEPOINT

The problem was that replication could break if a transaction involving
both transactional and non-transactional tables was rolled back to a
savepoint. It broke if a concurrent connection tried to drop a
transactional table which was locked after the savepoint was set.
This DROP TABLE completed when ROLLBACK TO SAVEPOINT was executed as the
lock on the table was dropped by the transaction. When the slave later
tried to apply the binlog, it would fail as the table would already
have been dropped.

The reason for the problem is that transactions involving both
transactional and non-transactional tables are written fully to the
binlog during ROLLBACK TO SAVEPOINT. At the same time, metadata locks
acquired after a savepoint, were released during ROLLBACK TO SAVEPOINT.
This allowed a second connection to drop a table only used between
SAVEPOINT and ROLLBACK TO SAVEPOINT. Which caused the transaction binlog
to refer to a non-existing table when it was written during ROLLBACK
TO SAVEPOINT.

This patch fixes the problem by not releasing metadata locks when
ROLLBACK TO SAVEPOINT is executed if binlogging is enabled.
This commit is contained in:
Jon Olav Hauglid
2010-06-25 09:32:24 +02:00
parent a5d9e0e0c4
commit 47edc4cade
3 changed files with 85 additions and 2 deletions

View File

@ -0,0 +1,32 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
#
# Bug#50124 Rpl failure on DROP table with concurrent txn/non-txn
# DML flow and SAVEPOINT
#
# Connection master
DROP TABLE IF EXISTS tt, nt;
CREATE TABLE tt (i INT) ENGINE = InnoDB;
CREATE TABLE nt (i INT) ENGINE = MyISAM;
FLUSH LOGS;
START TRANSACTION;
INSERT INTO nt VALUES (1);
SAVEPOINT insert_statement;
INSERT INTO tt VALUES (1);
# Connection master1
# Sending:
DROP TABLE tt;
# Connection master
ROLLBACK TO SAVEPOINT insert_statement;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
COMMIT;
# Connection master1
# Reaping: DROP TABLE tt
FLUSH LOGS;
# Connection master
DROP TABLE nt;