Skip to content

Commit 4ae0512

Browse files
author
Konstantin Osipov
committed
Backport of:
------------------------------------------------------------ revno: 2630.13.16 committer: Davi Arnaut <[email protected]> branch nick: WL#4284 timestamp: Sat 2008-07-26 13:38:20 -0300 message: WL#4284: Transactional DDL locking SQL statements' effect on transactions. Currently the MySQL server and its storage engines are not capable of rolling back operations that define or modify data structures (also known as DDL statements) or operations that alter any of the system tables (the mysql database). Allowing these group of statements to participate in transactions is unfeasible at this time (since rollback has no effect whatsoever on them) and goes against the design of our metadata locking subsystem. The solution is to issue implicit commits before and after those statements execution. This effectively confines each of those statements to its own special transaction and ensures that metadata locks taken during this special transaction are not leaked into posterior statements/transactions.
1 parent 37edcc7 commit 4ae0512

File tree

12 files changed

+2485
-154
lines changed

12 files changed

+2485
-154
lines changed

mysql-test/include/commit.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -725,15 +725,15 @@ call p_verify_status_increment(4, 4, 4, 4);
725725
alter table t3 add column (b int);
726726
call p_verify_status_increment(2, 0, 2, 0);
727727
alter table t3 rename t4;
728-
call p_verify_status_increment(2, 2, 2, 2);
728+
call p_verify_status_increment(4, 4, 4, 4);
729729
rename table t4 to t3;
730-
call p_verify_status_increment(2, 2, 2, 2);
730+
call p_verify_status_increment(0, 0, 0, 0);
731731
truncate table t3;
732732
call p_verify_status_increment(4, 4, 4, 4);
733733
create view v1 as select * from t2;
734-
call p_verify_status_increment(1, 0, 1, 0);
734+
call p_verify_status_increment(2, 0, 2, 0);
735735
check table t1;
736-
call p_verify_status_increment(3, 0, 3, 0);
736+
call p_verify_status_increment(2, 0, 2, 0);
737737
--echo # Sic: after this bug is fixed, CHECK leaves no pending transaction
738738
commit;
739739
call p_verify_status_increment(0, 0, 0, 0);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
INSERT INTO db1.trans (a) VALUES (1);
2+
--disable_result_log
3+
eval $statement;
4+
--enable_result_log
5+
CALL db1.test_if_commit();

mysql-test/r/commit_1innodb.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -841,25 +841,25 @@ call p_verify_status_increment(2, 0, 2, 0);
841841
SUCCESS
842842

843843
alter table t3 rename t4;
844-
call p_verify_status_increment(2, 2, 2, 2);
844+
call p_verify_status_increment(4, 4, 4, 4);
845845
SUCCESS
846846

847847
rename table t4 to t3;
848-
call p_verify_status_increment(2, 2, 2, 2);
848+
call p_verify_status_increment(0, 0, 0, 0);
849849
SUCCESS
850850

851851
truncate table t3;
852852
call p_verify_status_increment(4, 4, 4, 4);
853853
SUCCESS
854854

855855
create view v1 as select * from t2;
856-
call p_verify_status_increment(1, 0, 1, 0);
856+
call p_verify_status_increment(2, 0, 2, 0);
857857
SUCCESS
858858

859859
check table t1;
860860
Table Op Msg_type Msg_text
861861
test.t1 check status OK
862-
call p_verify_status_increment(3, 0, 3, 0);
862+
call p_verify_status_increment(2, 0, 2, 0);
863863
SUCCESS
864864

865865
# Sic: after this bug is fixed, CHECK leaves no pending transaction

0 commit comments

Comments
 (0)