diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2016-03-25 20:51:22 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2016-03-31 10:11:16 +0400 |
commit | 282497dd6d1049b4fb963641504c2733752845a7 (patch) | |
tree | 7288d17c29fbbe9ac47ec51f6988fb954f59a361 /mysql-test/t/mdl_sync.test | |
parent | 5052e2479e873461bebfcedbc674bbaf57d3c968 (diff) | |
download | mariadb-git-282497dd6d1049b4fb963641504c2733752845a7.tar.gz |
MDEV-6720 - enable connection log in mysqltest by default
Diffstat (limited to 'mysql-test/t/mdl_sync.test')
-rw-r--r-- | mysql-test/t/mdl_sync.test | 510 |
1 files changed, 0 insertions, 510 deletions
diff --git a/mysql-test/t/mdl_sync.test b/mysql-test/t/mdl_sync.test index 8e809788a08..0b6d6f58013 100644 --- a/mysql-test/t/mdl_sync.test +++ b/mysql-test/t/mdl_sync.test @@ -101,7 +101,6 @@ create table t1 (c1 int); --echo # handler t1 open; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that S, SH, SR and SW locks are compatible with it. handler t1 open t; @@ -128,7 +127,6 @@ unlock tables; --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above RENAME is blocked because of S lock. let $wait_condition= @@ -137,29 +135,24 @@ let $wait_condition= info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # ---echo # Switching to connection 'default'. connection default; --echo # Unblock RENAME TABLE. handler t1 close; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping RENAME TABLE. --reap --echo # Restore the original state of the things. rename table t2 to t1; --echo # ---echo # Switching to connection 'default'. connection default; handler t1 open; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that upgrade from SNW to X is blocked by presence of S lock. --echo # Sending: --send alter table t1 add column c2 int; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above ALTER TABLE is blocked because of S lock. let $wait_condition= @@ -168,30 +161,25 @@ let $wait_condition= info = "alter table t1 add column c2 int"; --source include/wait_condition.inc --echo # ---echo # Switching to connection 'default'. connection default; --echo # Unblock ALTER TABLE. handler t1 close; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping ALTER TABLE. --reap --echo # Restore the original state of the things. alter table t1 drop column c2; --echo # ---echo # Switching to connection 'default'. connection default; handler t1 open; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that upgrade from SNRW to X is blocked by presence of S lock. lock table t1 write; --echo # Sending: --send alter table t1 add column c2 int; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above upgrade of SNRW to X in ALTER TABLE is blocked --echo # because of S lock. @@ -201,12 +189,10 @@ let $wait_condition= info = "alter table t1 add column c2 int"; --source include/wait_condition.inc --echo # ---echo # Switching to connection 'default'. connection default; --echo # Unblock ALTER TABLE. handler t1 close; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping ALTER TABLE. --reap @@ -214,7 +200,6 @@ connection mdl_con1; alter table t1 drop column c2; unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # --echo # 2) Acquire SH (shared high-priority) lock on the table. @@ -225,7 +210,6 @@ set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish'; --echo # Sending: --send select table_name, table_type, auto_increment, table_comment from information_schema.tables where table_schema='test' and table_name='t1'; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; set debug_sync= 'now WAIT_FOR locked'; --echo # Check that S, SH, SR and SW locks are compatible with it. @@ -253,7 +237,6 @@ unlock tables; --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above RENAME is blocked because of SH lock. let $wait_condition= @@ -264,32 +247,27 @@ let $wait_condition= --echo # Unblock RENAME TABLE. set debug_sync= 'now SIGNAL finish'; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping SELECT ... FROM I_S. --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping RENAME TABLE. --reap --echo # Restore the original state of the things. rename table t2 to t1; --echo # ---echo # Switching to connection 'default'. connection default; set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish'; --echo # Sending: --send select table_name, table_type, auto_increment, table_comment from information_schema.tables where table_schema='test' and table_name='t1'; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; set debug_sync= 'now WAIT_FOR locked'; --echo # Check that upgrade from SNW to X is blocked by presence of SH lock. --echo # Sending: --send alter table t1 add column c2 int; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above ALTER TABLE is blocked because of SH lock. let $wait_condition= @@ -300,24 +278,20 @@ let $wait_condition= --echo # Unblock RENAME TABLE. set debug_sync= 'now SIGNAL finish'; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping SELECT ... FROM I_S. --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping ALTER TABLE. --reap --echo # Restore the original state of the things. alter table t1 drop column c2; --echo # ---echo # Switching to connection 'default'. connection default; set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish'; --send select table_name, table_type, auto_increment, table_comment from information_schema.tables where table_schema='test' and table_name='t1'; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; set debug_sync= 'now WAIT_FOR locked'; --echo # Check that upgrade from SNRW to X is blocked by presence of S lock. @@ -325,7 +299,6 @@ lock table t1 write; --echo # Sending: --send alter table t1 add column c2 int; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above upgrade of SNRW to X in ALTER TABLE is blocked --echo # because of S lock. @@ -337,12 +310,10 @@ let $wait_condition= --echo # Unblock RENAME TABLE. set debug_sync= 'now SIGNAL finish'; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping SELECT ... FROM I_S. --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping ALTER TABLE. --reap @@ -350,7 +321,6 @@ connection mdl_con1; alter table t1 drop column c2; unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # --echo # @@ -360,7 +330,6 @@ connection default; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that S, SH, SR and SW locks are compatible with it. handler t1 open; @@ -383,7 +352,6 @@ alter table t1 add primary key (c1); --echo # Sending: --send lock table t1 write; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Check that the above LOCK TABLES is blocked because of SR lock. let $wait_condition= @@ -394,25 +362,21 @@ let $wait_condition= --echo # Unblock LOCK TABLES. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping LOCK TABLES. --reap delete from t1 limit 1; unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that X lock is incompatible with SR lock. --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above RENAME is blocked because of SR lock. let $wait_condition= @@ -421,30 +385,25 @@ let $wait_condition= info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # ---echo # Switching to connection 'default'. connection default; --echo # Unblock RENAME TABLE. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping RENAME TABLE. --reap --echo # Restore the original state of the things. rename table t2 to t1; --echo # ---echo # Switching to connection 'default'. connection default; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that upgrade from SNW to X is blocked by presence of SR lock. --echo # Sending: --send alter table t1 add column c2 int; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above ALTER TABLE is blocked because of SR lock. let $wait_condition= @@ -453,12 +412,10 @@ let $wait_condition= info = "alter table t1 add column c2 int"; --source include/wait_condition.inc --echo # ---echo # Switching to connection 'default'. connection default; --echo # Unblock ALTER TABLE. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping ALTER TABLE. --reap @@ -469,7 +426,6 @@ alter table t1 drop column c2; --echo # by presence of SR lock because SNRW is incompatible with SR anyway. --echo # --echo # ---echo # Switching to connection 'default'. connection default; --echo # --echo # @@ -479,7 +435,6 @@ connection default; begin; insert into t1 values (1); --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that S, SH, SR and SW locks are compatible with it. handler t1 open; @@ -503,7 +458,6 @@ alter table t1 add index (not_exist); --echo # Sending: --send alter table t1 add primary key (c1); --echo # ---echo # Switching to connection 'default'. connection default; --echo # Check that the above ALTER TABLE is blocked because of SW lock. let $wait_condition= @@ -514,24 +468,20 @@ let $wait_condition= --echo # Unblock ALTER TABLE. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping ALTER TABLE. --error ER_DUP_ENTRY --reap --echo # ---echo # Switching to connection 'default'. connection default; begin; insert into t1 values (1); --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that SNRW lock is not compatible with SW lock. --echo # Sending: --send lock table t1 write; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Check that the above LOCK TABLES is blocked because of SW lock. let $wait_condition= @@ -542,25 +492,21 @@ let $wait_condition= --echo # Unblock LOCK TABLES. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping LOCK TABLES. --reap delete from t1 limit 2; unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; begin; insert into t1 values (1); --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that X lock is incompatible with SW lock. --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above RENAME is blocked because of SW lock. let $wait_condition= @@ -569,12 +515,10 @@ let $wait_condition= info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # ---echo # Switching to connection 'default'. connection default; --echo # Unblock RENAME TABLE. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping RENAME TABLE. --reap @@ -586,7 +530,6 @@ rename table t2 to t1; --echo # with SW anyway. --echo # --echo # ---echo # Switching to connection 'default'. connection default; --echo # --echo # @@ -597,7 +540,6 @@ set debug_sync= 'alter_opened_table SIGNAL locked WAIT_FOR finish'; --echo # Sending: --send alter table t1 add primary key (c1); --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; set debug_sync= 'now WAIT_FOR locked'; --echo # Check that S, SH, SR and SW locks are compatible with it. @@ -611,7 +553,6 @@ delete from t1 limit 1; --echo # Sending: --send alter table t1 add primary key (c1); --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above ALTER is blocked because of SU lock. let $wait_condition= @@ -622,32 +563,27 @@ let $wait_condition= --echo # Unblock ALTERs. set debug_sync= 'now SIGNAL finish'; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping first ALTER TABLE. --error ER_DUP_ENTRY --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping another ALTER TABLE. --error ER_DUP_ENTRY --reap --echo # ---echo # Switching to connection 'default'. connection default; set debug_sync= 'alter_opened_table SIGNAL locked WAIT_FOR finish'; --echo # Sending: --send alter table t1 add primary key (c1); --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; set debug_sync= 'now WAIT_FOR locked'; --echo # Check that SNRW lock is incompatible with SU lock. --echo # Sending: --send lock table t1 write; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above LOCK TABLES is blocked because of SU lock. let $wait_condition= @@ -658,33 +594,28 @@ let $wait_condition= --echo # Unblock ALTER and thus LOCK TABLES. set debug_sync= 'now SIGNAL finish'; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping ALTER TABLE. --error ER_DUP_ENTRY --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping LOCK TABLES --reap insert into t1 values (1); unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; set debug_sync= 'alter_opened_table SIGNAL locked WAIT_FOR finish'; --echo # Sending: --send alter table t1 add primary key (c1); --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; set debug_sync= 'now WAIT_FOR locked'; --echo # Check that X lock is incompatible with SU lock. --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above RENAME is blocked because of SU lock. let $wait_condition= @@ -695,7 +626,6 @@ let $wait_condition= --echo # Unblock ALTER and thus RENAME TABLE. set debug_sync= 'now SIGNAL finish'; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Now we have ALTER TABLE with SU->SNW and RENAME TABLE with pending --echo # X-lock. In this case ALTER TABLE should be chosen as victim. @@ -703,7 +633,6 @@ connection default; --error ER_LOCK_DEADLOCK --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping RENAME TABLE --reap @@ -714,7 +643,6 @@ rename table t2 to t1; --echo # blocked by presence of another SU lock because SNW/SNRW is --echo # incompatible with SU anyway. --echo # ---echo # Switching to connection 'default'. connection default; --echo # --echo # @@ -725,7 +653,6 @@ set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR fini --echo # Sending: --send alter table t1 add primary key (c1), lock=shared, algorithm=copy; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; set debug_sync= 'now WAIT_FOR locked'; --echo # Check that S, SH and SR locks are compatible with it. @@ -738,7 +665,6 @@ select count(*) from t1; --echo # Sending: --send delete from t1 limit 2; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above DELETE is blocked because of SNW lock. let $wait_condition= @@ -749,31 +675,26 @@ let $wait_condition= --echo # Unblock ALTER and thus DELETE. set debug_sync= 'now SIGNAL finish'; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping ALTER TABLE. --error ER_DUP_ENTRY --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping DELETE. --reap --echo # ---echo # Switching to connection 'default'. connection default; set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish'; --echo # Sending: --send alter table t1 add primary key (c1), lock=shared, algorithm=copy; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; set debug_sync= 'now WAIT_FOR locked'; --echo # Check that SU lock is incompatible with SNW lock. --echo # Sending: --send alter table t1 add primary key (c1); --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above ALTER is blocked because of SNW lock. let $wait_condition= @@ -784,13 +705,11 @@ let $wait_condition= --echo # Unblock ALTERs. set debug_sync= 'now SIGNAL finish'; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping first ALTER TABLE. --error ER_DUP_ENTRY --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping another ALTER TABLE. --error ER_DUP_ENTRY @@ -800,20 +719,17 @@ connection mdl_con1; --echo # SNW is only used by ALTER TABLE after upgrading from SU --echo # and SU is also incompatible with SNW. --echo # ---echo # Switching to connection 'default'. connection default; set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish'; --echo # Sending: --send alter table t1 add primary key (c1), lock=shared, algorithm=copy; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; set debug_sync= 'now WAIT_FOR locked'; --echo # Check that SNRW lock is incompatible with SNW lock. --echo # Sending: --send lock table t1 write; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above LOCK TABLES is blocked because of SNW lock. let $wait_condition= @@ -824,33 +740,28 @@ let $wait_condition= --echo # Unblock ALTER and thus LOCK TABLES. set debug_sync= 'now SIGNAL finish'; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping ALTER TABLE. --error ER_DUP_ENTRY --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping LOCK TABLES --reap insert into t1 values (1); unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish'; --echo # Sending: --send alter table t1 add primary key (c1), algorithm=copy, lock=shared; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; set debug_sync= 'now WAIT_FOR locked'; --echo # Check that X lock is incompatible with SNW lock. --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above RENAME is blocked because of SNW lock. let $wait_condition= @@ -861,13 +772,11 @@ let $wait_condition= --echo # Unblock ALTER and thus RENAME TABLE. set debug_sync= 'now SIGNAL finish'; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping ALTER TABLE. --error ER_DUP_ENTRY --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping RENAME TABLE --reap @@ -878,7 +787,6 @@ rename table t2 to t1; --echo # blocked by presence of another SNW lock because SNW/SNRW is --echo # incompatible with SNW anyway. --echo # ---echo # Switching to connection 'default'. connection default; --echo # --echo # @@ -887,7 +795,6 @@ connection default; --echo # lock table t1 write; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that S and SH locks are compatible with it. handler t1 open; @@ -898,7 +805,6 @@ select column_name from information_schema.columns where --echo # Sending: --send select count(*) from t1; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Check that the above SELECT is blocked because of SNRW lock. let $wait_condition= @@ -909,22 +815,18 @@ let $wait_condition= --echo # Unblock SELECT. unlock tables; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping SELECT. --reap --echo # ---echo # Switching to connection 'default'. connection default; lock table t1 write; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that SW lock is incompatible with SNRW lock. --echo # Sending: --send delete from t1 limit 1; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Check that the above DELETE is blocked because of SNRW lock. let $wait_condition= @@ -935,22 +837,18 @@ let $wait_condition= --echo # Unblock DELETE. unlock tables; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping DELETE. --reap --echo # ---echo # Switching to connection 'default'. connection default; lock table t1 write; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that SU lock is incompatible with SNRW lock. --echo # Sending: --send alter table t1 add primary key (c1); --echo # ---echo # Switching to connection 'default'. connection default; --echo # Check that the above ALTER is blocked because of SNRW lock. let $wait_condition= @@ -961,7 +859,6 @@ let $wait_condition= --echo # Unblock ALTER. unlock tables; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping ALTER TABLE. --error ER_DUP_ENTRY @@ -971,17 +868,14 @@ connection mdl_con1; --echo # SNW is only used by ALTER TABLE after upgrading from SU --echo # and SU is also incompatible with SNRW. --echo # ---echo # Switching to connection 'default'. connection default; lock table t1 write; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that SNRW lock is incompatible with SNRW lock. --echo # Sending: --send lock table t1 write; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Check that the above LOCK TABLES is blocked because of SNRW lock. let $wait_condition= @@ -992,24 +886,20 @@ let $wait_condition= --echo # Unblock waiting LOCK TABLES. unlock tables; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping LOCK TABLES --reap insert into t1 values (1); unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; lock table t1 write; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that X lock is incompatible with SNRW lock. --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Check that the above RENAME is blocked because of SNRW lock. let $wait_condition= @@ -1020,7 +910,6 @@ let $wait_condition= --echo # Unblock RENAME TABLE unlock tables; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping RENAME TABLE --reap @@ -1031,7 +920,6 @@ rename table t2 to t1; --echo # blocked by presence of another SNRW lock because SNW/SNRW is --echo # incompatible with SNRW anyway. --echo # ---echo # Switching to connection 'default'. connection default; --echo # --echo # @@ -1040,18 +928,15 @@ connection default; --echo # create table t2 (c1 int); --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Take a lock on t2, so RENAME TABLE t1 TO t2 will get blocked --echo # after acquiring X lock on t1. lock tables t2 read; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that RENAME has acquired X lock on t1 and is waiting for t2. let $wait_condition= @@ -1063,7 +948,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send handler t1 open; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above HANDLER statement is blocked because of X lock. let $wait_condition= @@ -1074,29 +958,24 @@ where state = "Waiting for table metadata lock" and --echo # Unblock RENAME TABLE unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping RENAME TABLE. --error ER_TABLE_EXISTS_ERROR --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping HANDLER. --reap handler t1 close; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Prepare for blocking RENAME TABLE. lock tables t2 read; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that RENAME has acquired X lock on t1 and is waiting for t2. let $wait_condition= @@ -1108,7 +987,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send select column_name from information_schema.columns where table_schema='test' and table_name='t1'; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above SELECT ... FROM I_S ... statement is blocked --echo # because of X lock. @@ -1120,28 +998,23 @@ where state = "Waiting for table metadata lock" and --echo # Unblock RENAME TABLE unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping RENAME TABLE. --error ER_TABLE_EXISTS_ERROR --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping SELECT ... FROM I_S. --reap --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Prepare for blocking RENAME TABLE. lock tables t2 read; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that RENAME has acquired X lock on t1 and is waiting for t2. let $wait_condition= @@ -1153,7 +1026,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above SELECT statement is blocked --echo # because of X lock. @@ -1165,28 +1037,23 @@ where state = "Waiting for table metadata lock" and --echo # Unblock RENAME TABLE unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping RENAME TABLE. --error ER_TABLE_EXISTS_ERROR --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping SELECT. --reap --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Prepare for blocking RENAME TABLE. lock tables t2 read; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that RENAME has acquired X lock on t1 and is waiting for t2. let $wait_condition= @@ -1198,7 +1065,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send delete from t1 limit 1; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above DELETE statement is blocked --echo # because of X lock. @@ -1210,28 +1076,23 @@ where state = "Waiting for table metadata lock" and --echo # Unblock RENAME TABLE unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping RENAME TABLE. --error ER_TABLE_EXISTS_ERROR --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping DELETE. --reap --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Prepare for blocking RENAME TABLE. lock tables t2 read; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that RENAME has acquired X lock on t1 and is waiting for t2. let $wait_condition= @@ -1243,7 +1104,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send alter table t1 add primary key (c1); --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above ALTER statement is blocked --echo # because of X lock. @@ -1255,13 +1115,11 @@ where state = "Waiting for table metadata lock" and --echo # Unblock RENAME TABLE unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping RENAME TABLE --error ER_TABLE_EXISTS_ERROR --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping ALTER. --error ER_DUP_ENTRY @@ -1271,17 +1129,14 @@ connection mdl_con1; --echo # SNW is only used by ALTER TABLE after upgrading from SU --echo # and SU is also incompatible with X. --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Prepare for blocking RENAME TABLE. lock tables t2 read; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that RENAME has acquired X lock on t1 and is waiting for t2. let $wait_condition= @@ -1293,7 +1148,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send lock table t1 write; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above LOCK TABLE statement is blocked --echo # because of X lock. @@ -1305,29 +1159,24 @@ where state = "Waiting for table metadata lock" and --echo # Unblock RENAME TABLE unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping RENAME TABLE --error ER_TABLE_EXISTS_ERROR --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping LOCK TABLE. --reap unlock tables; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Prepare for blocking RENAME TABLE. lock tables t2 read; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that RENAME has acquired X lock on t1 and is waiting for t2. let $wait_condition= @@ -1339,7 +1188,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send rename table t1 to t3; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above RENAME statement is blocked --echo # because of X lock. @@ -1351,13 +1199,11 @@ where state = "Waiting for table metadata lock" and --echo # Unblock RENAME TABLE unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping RENAME TABLE --error ER_TABLE_EXISTS_ERROR --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping RENAME. --reap @@ -1373,7 +1219,6 @@ rename table t3 to t1; --echo # --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # --echo # 1) Check compatibility for pending SNW lock. @@ -1382,13 +1227,11 @@ connection mdl_con2; begin; insert into t1 values (1); --echo # ---echo # Switching to connection 'default'. connection default; --echo # Add pending SNW lock. --echo # Sending: --send alter table t1 add primary key (c1); --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that ALTER TABLE is waiting with pending SNW lock. let $wait_condition= @@ -1406,7 +1249,6 @@ select count(*) from t1; --echo # Sending: --send delete from t1 limit 1; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above DELETE is blocked because of pending SNW lock. let $wait_condition= @@ -1417,13 +1259,11 @@ where state = "Waiting for table metadata lock" and --echo # Unblock ALTER TABLE. commit; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping ALTER. --error ER_DUP_ENTRY --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping DELETE. --reap @@ -1432,7 +1272,6 @@ connection mdl_con1; --echo # they will also be blocked by active SW lock. --echo # --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # --echo # 2) Check compatibility for pending SNRW lock. @@ -1441,13 +1280,11 @@ connection mdl_con2; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Add pending SNRW lock. --echo # Sending: --send lock table t1 write; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that LOCK TABLE is waiting with pending SNRW lock. let $wait_condition= @@ -1464,7 +1301,6 @@ select column_name from information_schema.columns where --echo # Sending: --send select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above SELECT is blocked because of pending SNRW lock. let $wait_condition= @@ -1475,29 +1311,24 @@ where state = "Waiting for table metadata lock" and --echo # Unblock LOCK TABLE. commit; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping LOCK TABLE. --reap unlock tables; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping SELECT. --reap --echo # Restore pending SNRW lock. --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Sending: --send lock table t1 write; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that LOCK TABLE is waiting with pending SNRW lock. let $wait_condition= @@ -1509,7 +1340,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send insert into t1 values (1); --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above INSERT is blocked because of pending SNRW lock. let $wait_condition= @@ -1520,29 +1350,24 @@ where state = "Waiting for table metadata lock" and --echo # Unblock LOCK TABLE. commit; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping LOCK TABLE. --reap unlock tables; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping INSERT. --reap --echo # Restore pending SNRW lock. --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Sending: --send lock table t1 write; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that LOCK TABLE is waiting with pending SNRW lock. let $wait_condition= @@ -1555,12 +1380,10 @@ where state = "Waiting for table metadata lock" and --error ER_DUP_ENTRY alter table t1 add primary key (c1); --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Unblock LOCK TABLE. commit; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping LOCK TABLE. --reap @@ -1570,7 +1393,6 @@ unlock tables; --echo # they will also be blocked by active SR lock. --echo # --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # --echo # 3) Check compatibility for pending X lock. @@ -1579,13 +1401,11 @@ connection mdl_con2; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Add pending X lock. --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that RENAME TABLE is waiting with pending X lock. let $wait_condition= @@ -1600,7 +1420,6 @@ select column_name from information_schema.columns where --echo # Sending: --send handler t1 open; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above HANDLER OPEN is blocked because of pending X lock. let $wait_condition= @@ -1611,31 +1430,26 @@ where state = "Waiting for table metadata lock" and --echo # Unblock RENAME TABLE. commit; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping RENAME TABLE. --error ER_TABLE_EXISTS_ERROR --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping HANDLER t1 OPEN. --reap handler t1 close; --echo # Restore pending X lock. --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Add pending X lock. --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that RENAME TABLE is waiting with pending X lock. let $wait_condition= @@ -1647,7 +1461,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above SELECT is blocked because of pending X lock. let $wait_condition= @@ -1658,30 +1471,25 @@ where state = "Waiting for table metadata lock" and --echo # Unblock RENAME TABLE. commit; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping RENAME TABLE. --error ER_TABLE_EXISTS_ERROR --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping SELECT. --reap --echo # Restore pending X lock. --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Add pending X lock. --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that RENAME TABLE is waiting with pending X lock. let $wait_condition= @@ -1693,7 +1501,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send delete from t1 limit 1; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above DELETE is blocked because of pending X lock. let $wait_condition= @@ -1704,30 +1511,25 @@ where state = "Waiting for table metadata lock" and --echo # Unblock RENAME TABLE. commit; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping RENAME TABLE. --error ER_TABLE_EXISTS_ERROR --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping DELETE. --reap --echo # Restore pending X lock. --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Add pending X lock. --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that RENAME TABLE is waiting with pending X lock. let $wait_condition= @@ -1739,7 +1541,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send alter table t1 add primary key (c1); --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above ALTER TABLE is blocked because of pending X lock. let $wait_condition= @@ -1750,30 +1551,25 @@ where state = "Waiting for table metadata lock" and --echo # Unblock RENAME TABLE. commit; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping RENAME TABLE. --error ER_TABLE_EXISTS_ERROR --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping ALTER TABLE. --error ER_DUP_ENTRY --reap --echo # Restore pending X lock. --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; handler t1 open; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Add pending X lock. --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that RENAME TABLE is waiting with pending X lock. let $wait_condition= @@ -1785,7 +1581,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send lock table t1 write; --echo # ---echo # Switching to connection 'mdl_con3'. connection mdl_con3; --echo # Check that the above LOCK TABLES is blocked because of pending X lock. let $wait_condition= @@ -1794,24 +1589,20 @@ where state = "Waiting for table metadata lock" and info = "lock table t1 write"; --source include/wait_condition.inc --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Unblock RENAME TABLE. handler t1 close; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping RENAME TABLE. --error ER_TABLE_EXISTS_ERROR --reap --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reaping LOCK TABLES. --reap unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # @@ -1833,7 +1624,6 @@ connection default; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Create an active SNW lock on t2. --echo # We have to use DEBUG_SYNC facility as otherwise SNW lock @@ -1843,7 +1633,6 @@ set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR fini --echo # Sending: --send alter table t2 add primary key (c1), algorithm=copy, lock=shared; --echo # ---echo # Switching to connection 'default'. connection default; set debug_sync= 'now WAIT_FOR locked'; --echo # SR lock should be acquired without any waiting. @@ -1855,7 +1644,6 @@ select count(*) from t1; --echo # Sending: --send insert into t2 values (1); --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above INSERT is blocked. let $wait_condition= @@ -1866,13 +1654,11 @@ where state = "Waiting for table metadata lock" and --echo # Unblock ALTER TABLE and thus INSERT. set debug_sync= 'now SIGNAL finish'; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reap ALTER TABLE. --error ER_DUP_ENTRY --reap --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reap INSERT. --reap @@ -1887,14 +1673,12 @@ commit; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Create an active SNW lock on t1. set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish'; --echo # Sending: --send alter table t1 add primary key (c1), algorithm=copy, lock=shared; --echo # ---echo # Switching to connection 'default'. connection default; set debug_sync= 'now WAIT_FOR locked'; --echo # We should still be able to get SR lock without waiting. @@ -1905,7 +1689,6 @@ select count(*) from t1; --echo # Sending: --send insert into t1 values (1); --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above INSERT is blocked. let $wait_condition= @@ -1916,13 +1699,11 @@ where state = "Waiting for table metadata lock" and --echo # Unblock ALTER TABLE and thus INSERT. set debug_sync= 'now SIGNAL finish'; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reap ALTER TABLE. --error ER_DUP_ENTRY --reap --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reap INSERT. --reap @@ -1935,13 +1716,11 @@ commit; begin; insert into t1 values (1); --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Create pending SNW lock on t1. --echo # Sending: --send alter table t1 add primary key (c1); --echo # ---echo # Switching to connection 'default'. connection default; --echo # Wait until ALTER TABLE starts waiting for SNW lock. let $wait_condition= @@ -1955,13 +1734,11 @@ delete from t1 limit 1; --echo # Unblock ALTER TABLE. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reap ALTER TABLE. --error ER_DUP_ENTRY --reap --echo # ---echo # Switching to connection 'default'. connection default; --echo # --echo # 2) Now similar tests for active SNW lock which is being upgraded @@ -1972,20 +1749,17 @@ connection default; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Start transaction which will prevent SNW -> X upgrade from --echo # completing immediately. begin; select count(*) from t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Create SNW lock pending upgrade to X on t2. --echo # Sending: --send alter table t2 add column c2 int; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Wait until ALTER TABLE starts waiting X lock. let $wait_condition= @@ -1997,7 +1771,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send select count(*) from t2; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above SELECT is blocked. let $wait_condition= @@ -2008,12 +1781,10 @@ where state = "Waiting for table metadata lock" and --echo # Unblock ALTER TABLE. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reap ALTER TABLE. --reap --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reap SELECT. --reap @@ -2022,20 +1793,17 @@ commit; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Start transaction which will prevent SNW -> X upgrade from --echo # completing immediately. begin; select count(*) from t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Create SNW lock pending upgrade to X on t2. --echo # Sending: --send alter table t2 drop column c2; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Wait until ALTER TABLE starts waiting X lock. let $wait_condition= @@ -2047,7 +1815,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send insert into t2 values (1); --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above INSERT is blocked. let $wait_condition= @@ -2058,12 +1825,10 @@ where state = "Waiting for table metadata lock" and --echo # Unblock ALTER TABLE. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reap ALTER TABLE. --reap --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reap INSERT. --reap @@ -2075,13 +1840,11 @@ commit; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Create SNW lock pending upgrade to X. --echo # Sending: --send alter table t1 add column c2 int; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Wait until ALTER TABLE starts waiting X lock. let $wait_condition= @@ -2098,12 +1861,10 @@ delete from t1 limit 1; --echo # Unblock ALTER TABLE. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reap ALTER TABLE. --reap --echo # ---echo # Switching to connection 'default'. connection default; --echo # --echo # 3) Check how various locks used within transactional context @@ -2114,18 +1875,15 @@ connection default; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; lock table t2 write; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Attempt to acquire SR should be blocked. It should --echo # not cause errors as it does not creates deadlock. --echo # Sending: --send select count(*) from t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that the above SELECT is blocked let $wait_condition= @@ -2136,7 +1894,6 @@ where state = "Waiting for table metadata lock" and --echo # Unblock SELECT. unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reap SELECT. --reap @@ -2145,18 +1902,15 @@ commit; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; lock table t2 write; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Again attempt to acquire SW should be blocked and should --echo # not cause any errors. --echo # Sending: --send delete from t2 limit 1; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Check that the above DELETE is blocked let $wait_condition= @@ -2167,7 +1921,6 @@ where state = "Waiting for table metadata lock" and --echo # Unblock DELETE. unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reap DELETE. --reap @@ -2182,12 +1935,10 @@ commit; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Sending: --send lock table t1 write; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Wait until LOCK TABLE is blocked creating pending request for X lock. let $wait_condition= @@ -2204,13 +1955,11 @@ delete from t1 limit 1; --echo # Unblock LOCK TABLES. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reap LOCK TABLES. --reap unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # --echo # **) Now case when transaction has a SW lock. @@ -2218,12 +1967,10 @@ connection default; begin; delete from t1 limit 1; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Sending: --send lock table t1 write; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Wait until LOCK TABLE is blocked creating pending request for X lock. let $wait_condition= @@ -2238,13 +1985,11 @@ insert into t1 values (1, 1); --echo # Unblock LOCK TABLES. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reap LOCK TABLES. --reap unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # --echo # 4) Check how various locks used within transactional context @@ -2255,20 +2000,17 @@ connection default; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Start transaction which will prevent X lock from going away --echo # immediately. begin; select count(*) from t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Create pending X lock on t2. --echo # Sending: --send rename table t2 to t3; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Wait until RENAME TABLE starts waiting with pending X lock. let $wait_condition= @@ -2280,7 +2022,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send select count(*) from t2; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above SELECT is blocked. let $wait_condition= @@ -2291,12 +2032,10 @@ where state = "Waiting for table metadata lock" and --echo # Unblock RENAME TABLE. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reap RENAME TABLE. --reap --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reap SELECT. --error ER_NO_SUCH_TABLE @@ -2307,20 +2046,17 @@ rename table t3 to t2; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Start transaction which will prevent X lock from going away --echo # immediately. begin; select count(*) from t2; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Create pending X lock on t2. --echo # Sending: --send rename table t2 to t3; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Wait until RENAME TABLE starts waiting with pending X lock. let $wait_condition= @@ -2332,7 +2068,6 @@ where state = "Waiting for table metadata lock" and --echo # Sending: --send delete from t2 limit 1; --echo # ---echo # Switching to connection 'mdl_con2'. connection mdl_con2; --echo # Check that the above DELETE is blocked. let $wait_condition= @@ -2343,12 +2078,10 @@ where state = "Waiting for table metadata lock" and --echo # Unblock RENAME TABLE. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reap RENAME TABLE. --reap --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reap DELETE. --error ER_NO_SUCH_TABLE @@ -2365,12 +2098,10 @@ rename table t3 to t2; begin; select count(*) from t1; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Wait until RENAME TABLE is blocked creating pending request for X lock. let $wait_condition= @@ -2387,13 +2118,11 @@ delete from t1 limit 1; --echo # Unblock RENAME TABLE. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reap RENAME TABLE. --error ER_TABLE_EXISTS_ERROR --reap --echo # ---echo # Switching to connection 'default'. connection default; --echo # --echo # **) The second case is when transaction has a SW lock. @@ -2401,12 +2130,10 @@ connection default; begin; delete from t1 limit 1; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Sending: --send rename table t1 to t2; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Wait until RENAME TABLE is blocked creating pending request for X lock. let $wait_condition= @@ -2421,13 +2148,11 @@ insert into t1 values (1, 1); --echo # Unblock RENAME TABLE. commit; --echo # ---echo # Switching to connection 'mdl_con1'. connection mdl_con1; --echo # Reap RENAME TABLE. --error ER_TABLE_EXISTS_ERROR --reap --echo # ---echo # Switching to connection 'default'. connection default; --echo # Clean-up. @@ -2460,14 +2185,12 @@ insert into t1 values (1); --echo # handler t1 open; --echo # ---echo # Switching to connection 'handler_con1'. connection handler_con1; lock table t1 write; --echo # Upgrade SNRW to X lock. --echo # Sending: --send alter table t1 add column j int; --echo # ---echo # Switching to connection 'handler_con2'. connection handler_con2; --echo # Wait until ALTER is blocked during upgrade. let $wait_condition= @@ -2476,18 +2199,15 @@ let $wait_condition= info = "alter table t1 add column j int"; --source include/wait_condition.inc --echo # ---echo # Switching to connection 'default'. connection default; --echo # The below statement should not cause deadlock. --send handler t1 read first; --echo # ---echo # Switching to connection 'handler_con1'. connection handler_con1; --echo # Reap ALTER TABLE. --reap unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reap HANDLER READ. --reap @@ -2500,18 +2220,15 @@ handler t1 close; --echo # handler t1 open; --echo # ---echo # Switching to connection 'handler_con1'. connection handler_con1; lock table t1 write, t2 read; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Execute statement which will be blocked on table-level lock --echo # owned by connection 'handler_con1'. --echo # Sending: --send insert into t2 values (1); --echo # ---echo # Switching to connection 'handler_con1'. connection handler_con1; --echo # Wait until INSERT is blocked on table-level lock. let $wait_condition= @@ -2522,7 +2239,6 @@ let $wait_condition= --echo # Sending 'alter table t1 drop column j'. It should not cause --echo # deadlock. send alter table t1 drop column j; ---echo # Switching to connection 'handler_con2'. connection handler_con2; --echo # Wait until ALTER is blocked during upgrade. let $wait_condition= @@ -2531,19 +2247,16 @@ let $wait_condition= info = "alter table t1 drop column j"; --source include/wait_condition.inc --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reap INSERT. --error ER_LOCK_ABORTED --reap handler t1 close; --echo # ---echo # Switching to connection 'handler_con1'. connection handler_con1; --echo # Reaping 'alter table t1 drop column j' --reap unlock tables; ---echo # Switching to connection 'default'. connection default; --echo # Then, check the scenario in which upgrade of SNRW lock to X @@ -2552,17 +2265,14 @@ connection default; --echo # handler t1 open; --echo # ---echo # Switching to connection 'handler_con1'. connection handler_con1; lock table t1 write; --echo # ---echo # Switching to connection 'default'. connection default; --echo # The below insert should be blocked because active SNRW lock on 't1'. --echo # Sending: --send insert into t1 values (1); --echo # ---echo # Switching to connection 'handler_con1'. connection handler_con1; --echo # Wait until INSERT is blocked because of SNRW lock. let $wait_condition= @@ -2574,7 +2284,6 @@ let $wait_condition= --echo # Sending: --send alter table t1 add column j int; --echo # ---echo # Switching to connection 'default'. connection default; --echo # INSERT should be chosen as victim for resolving deadlock. --echo # Reaping INSERT. @@ -2583,13 +2292,11 @@ connection default; --echo # Close HANDLER to unblock ALTER TABLE. handler t1 close; --echo # ---echo # Switching to connection 'handler_con1'. connection handler_con1; --echo # Reaping ALTER TABLE. --reap unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # @@ -2599,17 +2306,14 @@ connection default; --echo # handler t1 open; --echo # ---echo # Switching to connection 'handler_con1'. connection handler_con1; lock table t1 write, t2 write; --echo # ---echo # Switching to connection 'default'. connection default; --echo # The below insert should be blocked because active SNRW lock on 't1'. --echo # Sending: --send insert into t2 values (1); --echo # ---echo # Switching to connection 'handler_con1'. connection handler_con1; --echo # Wait until INSERT is blocked because of SNRW lock. let $wait_condition= @@ -2621,7 +2325,6 @@ let $wait_condition= --echo # Sending: --send alter table t1 drop column j; --echo # ---echo # Switching to connection 'default'. connection default; --echo # INSERT should be chosen as victim for resolving deadlock. --echo # Reaping INSERT. @@ -2630,13 +2333,11 @@ connection default; --echo # Close HANDLER to unblock ALTER TABLE. handler t1 close; --echo # ---echo # Switching to connection 'handler_con1'. connection handler_con1; --echo # Reaping ALTER TABLE. --reap unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Clean-up. @@ -2668,25 +2369,21 @@ create table t4 (k int); --echo # --echo # ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; begin; insert into t1 values (1); --echo # ---echo # Switching to connection 'deadlock_con2'. connection deadlock_con2; begin; insert into t2 values (1); --echo # ---echo # Switching to connection 'default'. connection default; --echo # Send: --send rename table t2 to t0, t3 to t2, t0 to t3; --echo # ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Wait until the above RENAME TABLE is blocked because it has to wait --echo # for 'deadlock_con2' which holds shared metadata lock on 't2'. @@ -2702,7 +2399,6 @@ let $wait_condition= --send select * from t2; --echo # ---echo # Switching to connection 'deadlock_con2'. connection deadlock_con2; --echo # Wait until the above SELECT * FROM t2 is starts waiting --echo # for an exclusive metadata lock to go away. @@ -2716,19 +2412,16 @@ let $wait_condition= commit; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reap RENAME TABLE. --reap --echo # ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Reap SELECT. --reap --echo # ---echo # Switching to connection 'default'. connection default; --echo # --echo # Let us check that in the process of waiting for conflicting lock @@ -2738,7 +2431,6 @@ connection default; --send rename table t1 to t0, t3 to t1, t0 to t3; --echo # ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Wait until the above RENAME TABLE is blocked because it has to wait --echo # for 'deadlock_con1' which should still hold shared metadata lock on @@ -2752,7 +2444,6 @@ let $wait_condition= commit; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reap RENAME TABLE. --reap @@ -2762,19 +2453,16 @@ connection default; --echo # --echo # ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; begin; insert into t2 values (2); --echo # ---echo # Switching to connection 'default'. connection default; --echo # Send: --send rename table t2 to t0, t1 to t2, t0 to t1; --echo # ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Wait until the above RENAME TABLE is blocked because it has to wait --echo # for 'deadlock_con1' which holds shared metadata lock on 't2'. @@ -2791,7 +2479,6 @@ let $wait_condition= select * from t1; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reap RENAME TABLE. --reap @@ -2801,18 +2488,15 @@ connection default; --echo # --echo # ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; begin; insert into t2 values (1); --echo # ---echo # Switching to connection 'default'. connection default; lock table t1 write; --echo # ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # The below SELECT statement should wait for metadata lock --echo # on table 't1' and should not produce ER_LOCK_DEADLOCK @@ -2820,7 +2504,6 @@ connection deadlock_con1; --send select * from t1; --echo # ---echo # Switching to connection 'deadlock_con2'. connection deadlock_con2; --echo # Wait until the above SELECT * FROM t1 is starts waiting --echo # for an UNRW metadata lock to go away. @@ -2834,7 +2517,6 @@ let $wait_condition= --send rename table t1 to t0, t2 to t1, t0 to t2; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Wait till above RENAME TABLE is blocked while holding --echo # pending X lock on t1. @@ -2848,7 +2530,6 @@ let $wait_condition= unlock tables; --echo # ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Since the latest RENAME TABLE entered in deadlock with SELECT --echo # statement the latter should be aborted and emit ER_LOCK_DEADLOCK @@ -2858,13 +2539,11 @@ connection deadlock_con1; --reap --echo # ---echo # Switching to connection 'deadlock_con2'. connection deadlock_con2; --echo # Reap RENAME TABLE ... . --reap; --echo # ---echo # Switching to connection 'default'. connection default; drop tables t1, t2, t3, t4; @@ -2881,19 +2560,16 @@ insert into t1 values (1); select * from t1; --echo # ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; begin; select * from t1; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Send: --send alter table t1 add column j int, rename to t2; --echo # ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Wait until the above ALTER TABLE ... RENAME acquires exclusive --echo # metadata lock on 't2' and starts waiting for connection @@ -2911,7 +2587,6 @@ let $wait_condition= select * from t2; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reap ALTER TABLE ... RENAME. --reap @@ -2935,7 +2610,6 @@ set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish'; --send select * from t2, t1 --echo # ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Wait till SELECT acquires MDL on 't2' and starts waiting for signal. set debug_sync= 'now WAIT_FOR locked'; @@ -2943,7 +2617,6 @@ set debug_sync= 'now WAIT_FOR locked'; --send lock tables t1 write, t2 write --echo # ---echo # Switching to connection 'deadlock_con2'. connection deadlock_con2; --echo # Wait until LOCK TABLES acquires SNRW lock on 't1' and is blocked --echo # while trying to acquire SNRW lock on 't1'. @@ -2956,14 +2629,12 @@ let $wait_condition= set debug_sync= 'now SIGNAL finish'; --echo # ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Reaping LOCK TABLES. --reap unlock tables; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping SELECT. It succeed and not report ER_LOCK_DEADLOCK error. --reap @@ -2983,7 +2654,6 @@ set debug_sync='alter_table_copy_after_lock_upgrade SIGNAL parked1 WAIT_FOR go1' --send alter table t1 add column j int --echo # ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Wait till ALTER acquires SNW lock and stops. set debug_sync='now WAIT_FOR parked1'; @@ -2995,7 +2665,6 @@ set debug_sync='mdl_acquire_lock_wait SIGNAL parked2 WAIT_FOR go2'; --send insert into t1 values () --echo # ---echo # Switching to connection 'deadlock_con2'. connection deadlock_con2; --echo # Wait till INSERT is paused. set debug_sync='now WAIT_FOR parked2'; @@ -3005,7 +2674,6 @@ set debug_sync='now WAIT_FOR parked2'; set debug_sync='now SIGNAL go1'; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping ALTER TABLE. --reap @@ -3014,7 +2682,6 @@ connection default; --send alter table t1 drop column j --echo # ---echo # Switching to connection 'deadlock_con2'. connection deadlock_con2; --echo # Wait until ALTER is blocked. let $wait_condition= @@ -3035,13 +2702,11 @@ let $wait_condition= set debug_sync='now SIGNAL go2'; --echo # ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Reaping INSERT. --reap --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reaping ALTER. It should succeed and not produce ER_LOCK_DEADLOCK. --reap @@ -3063,7 +2728,6 @@ create table t2(j int); --echo # set debug_sync= 'RESET'; ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Start a statement, which will acquire SR metadata lock on t1, open it --echo # and then stop, before trying to acquire SW lock on t2 and opening it. @@ -3071,7 +2735,6 @@ set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR --echo # Sending: --send select * from t1 where i in (select j from t2 for update) ---echo # Switching to connection 'deadlock_con2'. connection deadlock_con2; --echo # Wait till the above SELECT stops. set debug_sync='now WAIT_FOR parked'; @@ -3080,7 +2743,6 @@ set debug_sync='now WAIT_FOR parked'; --echo # Sending: send flush tables t1, t2 with read lock; ---echo # Switching to connection 'deadlock_con3'. connection deadlock_con3; --echo # Wait until FLUSH TABLES WITH t1, t2 READ LOCK starts waiting --echo # for SELECT to close t1. @@ -3095,13 +2757,11 @@ let $wait_condition= --echo # by backing-off SELECT. As a result FTWRL should be able to finish. set debug_sync='now SIGNAL go'; ---echo # Switching to connection 'deadlock_con2'. connection deadlock_con2; --echo # Reap FLUSH TABLES WITH READ LOCK. reap; unlock tables; ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Reap SELECT. reap; @@ -3113,7 +2773,6 @@ reap; --echo # set debug_sync= 'RESET'; ---echo # Switching to connection 'deadlock_con2'. connection deadlock_con2; set debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked WAIT_FOR go'; @@ -3122,7 +2781,6 @@ set debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked WA --echo # Sending: send flush tables t1, t2 with read lock; ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Wait till FLUSH TABLE WITH READ LOCK stops. set debug_sync='now WAIT_FOR parked'; @@ -3132,7 +2790,6 @@ set debug_sync='now WAIT_FOR parked'; --echo # Sending: send select * from t1 where i in (select j from t2 for update); ---echo # Switching to connection 'deadlock_con3'. connection deadlock_con3; --echo # Wait till the above SELECT blocks. let $wait_condition= @@ -3146,13 +2803,11 @@ let $wait_condition= --echo # backing-off SELECT. As a result FTWRL should be able to finish. set debug_sync='now SIGNAL go'; ---echo # Switching to connection 'deadlock_con2'. connection deadlock_con2; --echo # Reap FLUSH TABLES WITH READ LOCK. reap; unlock tables; ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Reap SELECT. reap; @@ -3163,7 +2818,6 @@ reap; --echo # set debug_sync= 'RESET'; ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Start a statement which will acquire SR metadata lock on t2, open it --echo # and then stop, before trying to acquire SR on t1 and opening it. @@ -3171,7 +2825,6 @@ set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR --echo # Sending: send select * from t2, t1; ---echo # Switching to connection 'deadlock_con2'. connection deadlock_con2; --echo # Wait till the above SELECT stops. set debug_sync='now WAIT_FOR parked'; @@ -3180,7 +2833,6 @@ set debug_sync='now WAIT_FOR parked'; --echo # Sending: send flush tables t2 with read lock; ---echo # Switching to connection 'deadlock_con3'. connection deadlock_con3; --echo # Wait until FLUSH TABLES WITH READ LOCK starts waiting --echo # for SELECT to close t2. @@ -3195,7 +2847,6 @@ let $wait_condition= --echo # Sending: send drop tables t1, t2; ---echo # Switching to connection 'default'. connection default; --echo # Wait until DROP TABLES starts waiting for X lock on t2. let $wait_condition= @@ -3209,25 +2860,21 @@ let $wait_condition= --echo # by backing-off SELECT. As a result, FTWRL should be able to finish. set debug_sync='now SIGNAL go'; ---echo # Switching to connection 'deadlock_con2'. connection deadlock_con2; --echo # Reap FLUSH TABLES WITH READ LOCK. reap; --echo # Unblock DROP TABLES. unlock tables; ---echo # Switching to connection 'deadlock_con3'. connection deadlock_con3; --echo # Reap DROP TABLES. reap; ---echo # Switching to connection 'deadlock_con1'. connection deadlock_con1; --echo # Reap SELECT. It should emit error about missing table. --error ER_NO_SUCH_TABLE reap; ---echo # Switching to connection 'default'. connection default; set debug_sync= 'RESET'; @@ -3251,7 +2898,6 @@ set debug_sync= 'RESET'; create table t1(i int); create table t2(j int); ---echo # Switching to connection 'con2'. connection con2; set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go'; @@ -3261,7 +2907,6 @@ set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR --echo # Sending: send flush tables t1, t2 with read lock; ---echo # Switching to connection 'con1'. connection con1; --echo # Wait till FLUSH TABLES <list> WITH READ LOCK stops. set debug_sync='now WAIT_FOR parked'; @@ -3271,7 +2916,6 @@ set debug_sync='now WAIT_FOR parked'; --echo # Sending: send flush tables; ---echo # Switching to connection 'default'. connection default; --echo # Wait till the above FLUSH TABLES blocks. let $wait_condition= @@ -3286,19 +2930,16 @@ let $wait_condition= --echo # which would result in assertion failures. set debug_sync='now SIGNAL go'; ---echo # Switching to connection 'con2'. connection con2; --echo # Reap FLUSH TABLES <list> WITH READ LOCK. reap; unlock tables; ---echo # Switching to connection 'con1'. connection con1; --echo # Reap FLUSH TABLES. reap; --echo # Clean-up. ---echo # Switching to connection 'default'. connection default; drop tables t1, t2; set debug_sync= 'RESET'; @@ -3328,16 +2969,13 @@ create trigger t1_bi before insert on t1 for each row create trigger t2_bi before insert on t2 for each row insert into t3 values (new.j); --echo # ---echo # Switching to connection 'con1root'. connection con1root; lock tables t4 read; --echo # ---echo # Switching to connection 'con2root'. connection con2root; --echo # Send : --send rename table t3 to t5, t4 to t3; --echo # ---echo # Switching to connection 'default'. connection default; --echo # Wait until the above RENAME TABLE adds pending requests for exclusive --echo # metadata lock on its tables and blocks due to 't4' being used by LOCK @@ -3349,7 +2987,6 @@ let $wait_condition= select count(*)= 1 from information_schema.processlist --echo # Send : --send insert into t1 values (1); --echo # ---echo # Switching to connection 'con1root'. connection con1root; --echo # Wait until INSERT statement waits due to encountering pending --echo # exclusive metadata lock on 't3'. @@ -3359,12 +2996,10 @@ let $wait_condition= select count(*)= 1 from information_schema.processlist --source include/wait_condition.inc unlock tables; --echo # ---echo # Switching to connection 'con2root'. connection con2root; --echo # Reap RENAME TABLE. --reap --echo # ---echo # Switching to connection 'default'. connection default; --echo # Reap INSERT. --reap @@ -3390,14 +3025,12 @@ connect(con2, localhost, root,,); --echo # Test 1: CREATE TABLE --echo # ---echo # Connection 2 connection con2; --echo # Start insert on the not-yet existing table --echo # Wait after taking the MDL lock SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish'; --send INSERT INTO t1 VALUES(1,"def") ---echo # Connection 1 connection default; SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Now INSERT has a MDL on the non-existent table t1. @@ -3408,13 +3041,11 @@ SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL finish'; --echo # Try to create that table. --send CREATE TABLE t1 (c1 INT, c2 VARCHAR(100), KEY(c1)) ---echo # Connection 2 --echo # Insert fails connection con2; --error ER_NO_SUCH_TABLE --reap ---echo # Connection 1 connection default; --reap; SET DEBUG_SYNC= 'RESET'; @@ -3430,14 +3061,12 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t2 (c1 INT, c2 VARCHAR(100), KEY(c1)); ---echo # Connection 2 connection con2; --echo # Start insert on the not-yet existing table --echo # Wait after taking the MDL SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish'; --send INSERT INTO t1 VALUES(1,"def") ---echo # Connection 1 connection default; SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Now INSERT has a MDL on the non-existent table t1. @@ -3448,13 +3077,11 @@ SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL finish'; --echo # Try to create that table. --send CREATE TABLE t1 LIKE t2 ---echo # Connection 2 --echo # Insert fails connection con2; --error ER_NO_SUCH_TABLE --reap ---echo # Connection 1 connection default; --reap SET DEBUG_SYNC= 'RESET'; @@ -3488,12 +3115,10 @@ insert into t1 values(1); --echo # which owner is in its turn waiting for our connection. lock tables t1 read; ---echo # Switching to connection 'con46044_2'. connection con46044_2; --echo # Sending: --send update t1 set i = 2 ---echo # Switching to connection 'con46044'. connection con46044; --echo # Waiting until UPDATE t1 SET ... is blocked. @@ -3506,7 +3131,6 @@ let $wait_condition= --echo # Sending: --send create table t2 select * from t1; ---echo # Switching to connection 'default'. connection default; --echo # Waiting until CREATE TABLE ... SELECT ... is blocked. let $wait_condition= @@ -3533,11 +3157,9 @@ select column_name from information_schema.columns select table_name, table_type, auto_increment, table_comment from information_schema.tables where table_schema='test' and table_name='t2'; ---echo # Switching to connection 'default'. connection default; unlock tables; ---echo # Switching to connection 'con46044'. connection con46044; --echo # Reaping CREATE TABLE ... SELECT ... . --reap @@ -3555,16 +3177,13 @@ connection con46044_2; --echo # --echo # We check same three queries to I_S in this new situation. ---echo # Switching to connection 'con46044_2'. connection con46044_2; lock tables t1 read; ---echo # Switching to connection 'con46044_3'. connection con46044_3; --echo # Sending: send update t1 set i = 3; ---echo # Switching to connection 'con46044'. connection con46044; --echo # Waiting until UPDATE t1 SET ... is blocked. @@ -3577,7 +3196,6 @@ let $wait_condition= --echo # Sending: --send create table t2 select * from t1; ---echo # Switching to connection 'default'. connection default; --echo # Waiting until CREATE TABLE ... SELECT ... is blocked. let $wait_condition= @@ -3590,7 +3208,6 @@ let $wait_condition= --echo # Sending: --send show fields from t2; ---echo # Switching to connection 'con46044_2'. connection con46044_2; --echo # Wait until SHOW FIELDS gets blocked. let $wait_condition= @@ -3601,12 +3218,10 @@ let $wait_condition= unlock tables; ---echo # Switching to connection 'con46044'. connection con46044; --echo # Reaping CREATE TABLE ... SELECT ... . --reap ---echo # Switching to connection 'default'. connection default; --echo # Reaping SHOW FIELDS ... --reap @@ -3616,16 +3231,13 @@ connection con46044_3; --echo # Reaping UPDATE t1 statement --reap ---echo # Switching to connection 'con46044_2'. connection con46044_2; lock tables t1 read; ---echo # Switching to connection 'con46044_3'. connection con46044_3; --echo # Sending: --send update t1 set i = 4 ---echo # Switching to connection 'con46044'. connection con46044; --echo # Waiting until UPDATE t1 SET ... is blocked. @@ -3638,7 +3250,6 @@ let $wait_condition= --echo # Sending: --send create table t2 select * from t1; ---echo # Switching to connection 'default'. connection default; --echo # Waiting until CREATE TABLE ... SELECT ... is blocked. let $wait_condition= @@ -3651,7 +3262,6 @@ let $wait_condition= --echo # Sending: --send select column_name from information_schema.columns where table_schema='test' and table_name='t2'; ---echo # Switching to connection 'con46044_2'. connection con46044_2; --echo # Wait until SELECT COLUMN_NAME FROM I_S.COLUMNS gets blocked. let $wait_condition= @@ -3662,12 +3272,10 @@ let $wait_condition= unlock tables; ---echo # Switching to connection 'con46044'. connection con46044; --echo # Reaping CREATE TABLE ... SELECT ... . --reap ---echo # Switching to connection 'default'. connection default; --echo # Reaping SELECT COLUMN_NAME FROM I_S.COLUMNS --reap @@ -3677,16 +3285,13 @@ connection con46044_3; --echo # Reaping UPDATE t1 statement --reap ---echo # Switching to connection 'con46044_2'. connection con46044_2; lock tables t1 read; ---echo # Switching to connection 'con46044_3'. connection con46044_3; --echo # Sending: --send update t1 set i = 5 ---echo # Switching to connection 'con46044'. connection con46044; --echo # Waiting until UPDATE t1 SET ... is blocked. @@ -3699,7 +3304,6 @@ let $wait_condition= --echo # Sending: --send create table t2 select * from t1; ---echo # Switching to connection 'default'. connection default; --echo # Waiting until CREATE TABLE ... SELECT ... is blocked. let $wait_condition= @@ -3713,7 +3317,6 @@ let $wait_condition= --echo # Sending: --send select table_name, table_type, auto_increment, table_comment from information_schema.tables where table_schema='test' and table_name='t2'; ---echo # Switching to connection 'con46044_2'. connection con46044_2; --echo # Wait until SELECT ... FROM I_S.TABLES gets blocked. let $wait_condition= @@ -3724,12 +3327,10 @@ let $wait_condition= unlock tables; ---echo # Switching to connection 'con46044'. connection con46044; --echo # Reaping CREATE TABLE ... SELECT ... . --reap ---echo # Switching to connection 'default'. connection default; --echo # Reaping SELECT ... FROM I_S.TABLES --reap @@ -3739,7 +3340,6 @@ connection con46044_3; --echo # Reaping UPDATE t1 statement --reap ---echo # Switching to connection 'default'. connection default; --echo # Clean-up. disconnect con46044; @@ -3765,13 +3365,11 @@ begin; select * from t1 where c2 = 3; --echo # ---echo # Switching to connection 'con46273'. connection con46273; set debug_sync='alter_table_copy_after_lock_upgrade SIGNAL alter_table_locked WAIT_FOR alter_go'; --send alter table t1 add column e int, rename to t2; --echo # ---echo # Switching to connection 'default'. connection default; set debug_sync='now WAIT_FOR alter_table_locked'; set debug_sync='mdl_acquire_lock_wait SIGNAL alter_go'; @@ -3782,13 +3380,11 @@ set debug_sync='mdl_acquire_lock_wait SIGNAL alter_go'; update t1 set c3=c3+1 where c2 = 3; --echo # ---echo # Switching to connection 'con46273'. connection con46273; --echo # Reap ALTER TABLE. --reap --echo # ---echo # Switching to connection 'default'. connection default; disconnect con46273; --echo # Clean-up. @@ -3807,12 +3403,10 @@ connect (con46673, localhost, root,,); connection default; create table t1 (i int); ---echo # Switching to connection 'con46673'. connection con46673; begin; insert into t1 values (1); ---echo # Switching to connection 'default'. connection default; --echo # Statement below should not get blocked. And if after some --echo # changes to code it is there should not be a deadlock between @@ -3820,12 +3414,10 @@ connection default; flush tables with read lock; unlock tables; ---echo # Switching to connection 'con46673'. connection con46673; delete from t1 where i = 1; commit; ---echo # Switching to connection 'default'. connection default; --echo # Clean-up disconnect con46673; @@ -3841,13 +3433,11 @@ connect (con2, localhost, root); --echo # Test 1: CREATE PROCEDURE ---echo # Connection 1 connection default; --echo # Start CREATE PROCEDURE and open mysql.proc SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait'; --send CREATE PROCEDURE p1() SELECT 1 ---echo # Connection 2 connection con2; SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; --echo # Check that FLUSH must wait to get the GRL @@ -3855,16 +3445,13 @@ SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait'; --send FLUSH TABLES WITH READ LOCK ---echo # Connection 1 connection default; --reap ---echo # Connection 2 connection con2; --reap UNLOCK TABLES; ---echo # Connection 1 connection default; SET DEBUG_SYNC= 'RESET'; @@ -3875,7 +3462,6 @@ connection default; SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait'; --send DROP PROCEDURE p1 ---echo # Connection 2 connection con2; SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; --echo # Check that FLUSH must wait to get the GRL @@ -3883,7 +3469,6 @@ SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait'; --send FLUSH TABLES WITH READ LOCK ---echo # Connection 1 connection default; --echo # Once FLUSH TABLES WITH READ LOCK starts waiting --echo # DROP PROCEDURE will be waked up and will drop @@ -3893,13 +3478,11 @@ connection default; --echo # Reaping DROP PROCEDURE. --reap ---echo # Connection 2 connection con2; --echo # Reaping FTWRL. --reap UNLOCK TABLES; ---echo # Connection 1 connection default; SET DEBUG_SYNC= 'RESET'; @@ -4015,13 +3598,11 @@ connect (con50913_2,localhost,root); connection default; create table t1 (i int) engine=InnoDB; ---echo # Switching to connection 'con50913_1'. connection con50913_1; set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL parked WAIT_FOR go'; --echo # Sending: --send alter table t1 add column j int, ALGORITHM=COPY ---echo # Switching to connection 'default'. connection default; --echo # Wait until ALTER TABLE gets blocked on a sync point after --echo # acquiring thr_lock.c lock. @@ -4031,7 +3612,6 @@ set debug_sync= 'now WAIT_FOR parked'; --echo # Sending: --send truncate table t1 ---echo # Switching to connection 'con50913_2'. connection con50913_2; --echo # Wait until TRUNCATE TABLE is blocked on MDL lock. let $wait_condition= @@ -4042,12 +3622,10 @@ let $wait_condition= --echo # Unblock ALTER TABLE. set debug_sync= 'now SIGNAL go'; ---echo # Switching to connection 'con50913_1'. connection con50913_1; --echo # Reaping ALTER TABLE. --reap ---echo # Switching to connection 'default'. connection default; --echo # Reaping TRUNCATE TABLE. --reap @@ -4074,17 +3652,14 @@ connect (con3,localhost,root); connection default; create table t1 (i int); ---echo # Switching to connection 'con1'. connection con1; begin; select * from t1; ---echo # Switching to connection 'con2'. connection con2; begin; select * from t1; ---echo # Switching to connection 'default'. connection default; --echo # Start ALTER TABLE which will acquire SNW lock and --echo # table lock and get blocked on sync point. @@ -4092,19 +3667,16 @@ set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL parked WAIT_FOR go'; --echo # Sending: --send alter table t1 add column j int ---echo # Switching to connection 'con1'. connection con1; --echo # Wait until ALTER TABLE gets blocked on a sync point. set debug_sync= 'now WAIT_FOR parked'; --echo # Sending: --send insert into t1 values (1) ---echo # Switching to connection 'con2'. connection con2; --echo # Sending: --send insert into t1 values (1) ---echo # Switching to connection 'con3'. connection con3; --echo # Wait until both 'con1' and 'con2' are blocked trying to acquire --echo # SW lock on the table. @@ -4119,7 +3691,6 @@ let $wait_condition= --echo # should be aborted with ER_LOCK_DEADLOCK errors. set debug_sync= 'now SIGNAL go'; ---echo # Switching to connection 'con1'. connection con1; --echo # Reaping INSERT. It should end with ER_LOCK_DEADLOCK error and --echo # not wait indefinitely (as it happened before the bugfix). @@ -4127,14 +3698,12 @@ connection con1; --reap commit; ---echo # Switching to connection 'con2'. connection con2; --echo # Reaping INSERT. --error ER_LOCK_DEADLOCK --reap commit; ---echo # Switching to connection 'default'. connection default; --echo # Reap ALTER TABLE. --reap @@ -4165,32 +3734,26 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2),(3); ---echo # Connection: con1 connection con1; LOCK TABLES t1 WRITE; SET debug_sync='upgrade_lock_for_truncate SIGNAL parked_truncate WAIT_FOR go_truncate'; send TRUNCATE TABLE t1; connection default; ---echo # Connection: default SET debug_sync='now WAIT_FOR parked_truncate'; connection con2; ---echo # Connection: con2 SET debug_sync='after_open_table_ignore_flush SIGNAL parked_show WAIT_FOR go_show'; send SHOW FIELDS FROM t1; connection default; ---echo # Connection: default SET debug_sync='now WAIT_FOR parked_show'; connection con3; ---echo # Connection: con3 SET debug_sync='after_flush_unlock SIGNAL parked_flush WAIT_FOR go_flush'; send FLUSH TABLES t1; connection default; ---echo # Connection: default SET debug_sync='now WAIT_FOR parked_flush'; SET debug_sync='now SIGNAL go_truncate'; --echo # Ensure that truncate waits for a exclusive lock @@ -4200,22 +3763,18 @@ let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist SET debug_sync= 'now SIGNAL go_show'; connection con1; ---echo # Connection: con1 (TRUNCATE) --echo # Reaping... reap; UNLOCK TABLES; connection con2; ---echo # Connection: con2 (SHOW FIELDS FROM t1) --echo # Reaping... reap; connection default; ---echo # Connection: default SET debug_sync= 'now SIGNAL go_flush'; connection con3; ---echo # Connection: con3 (FLUSH TABLES t1) --echo # Reaping... reap; @@ -4224,7 +3783,6 @@ disconnect con2; disconnect con3; connection default; ---echo # Connection: default SET debug_sync= 'RESET'; DROP TABLE t1; @@ -4268,20 +3826,17 @@ connect (con3, localhost, root); --echo # not database DDL on different databases. Tests X vs X lock. --echo # ---echo # Connection default connection default; SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked'; --echo # Sending: --send CREATE DATABASE db1 ---echo # Connection con2 connection con2; SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Sending: # This should block. --send CREATE DATABASE db1 ---echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE state='Waiting for schema metadata lock' AND info='CREATE DATABASE db1'; @@ -4292,12 +3847,10 @@ ALTER DATABASE db2 DEFAULT CHARACTER SET utf8; DROP DATABASE db2; SET DEBUG_SYNC= 'now SIGNAL blocked'; ---echo # Connection default connection default; --echo # Reaping: CREATE DATABASE db1 --reap ---echo # Connection con2 connection con2; --echo # Reaping: CREATE DATABASE db1 --error ER_DB_CREATE_EXISTS @@ -4308,20 +3861,17 @@ connection con2; --echo # not database DDL on different databases. Tests X vs X lock. --echo # ---echo # Connection default connection default; SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked'; --echo # Sending: --send ALTER DATABASE db1 DEFAULT CHARACTER SET utf8 ---echo # Connection con2 connection con2; SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Sending: # This should block. --send ALTER DATABASE db1 DEFAULT CHARACTER SET utf8 ---echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE state='Waiting for schema metadata lock' @@ -4333,42 +3883,35 @@ ALTER DATABASE db2 DEFAULT CHARACTER SET utf8; DROP DATABASE db2; SET DEBUG_SYNC= 'now SIGNAL blocked'; ---echo # Connection default connection default; --echo # Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8 --reap ---echo # Connection con2 connection con2; --echo # Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8 --reap ---echo # Connection default connection default; SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked'; --echo # Sending: --send ALTER DATABASE db1 DEFAULT CHARACTER SET utf8 ---echo # Connection con2 connection con2; SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Sending: # This should also block. --send DROP DATABASE db1 ---echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE state='Waiting for schema metadata lock' AND info='DROP DATABASE db1'; --source include/wait_condition.inc SET DEBUG_SYNC= 'now SIGNAL blocked'; ---echo # Connection default connection default; --echo # Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8 --reap ---echo # Connection con2 connection con2; --echo # Reaping: DROP DATABASE db1 --reap @@ -4387,20 +3930,17 @@ let $MYSQLD_DATADIR= `select @@datadir`; --mkdir $MYSQLD_DATADIR/a-b-c-d --copy_file $MYSQLD_DATADIR/db1/db.opt $MYSQLD_DATADIR/a-b-c-d/db.opt ---echo # Connection default connection default; SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked'; --echo # Sending: --send ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME ---echo # Connection con2 connection con2; SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Sending: # This should block. --send ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME ---echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE state='Waiting for schema metadata lock' @@ -4410,12 +3950,10 @@ let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist ALTER DATABASE `#mysql50#a-b-c-d` UPGRADE DATA DIRECTORY NAME; SET DEBUG_SYNC= 'now SIGNAL blocked'; ---echo # Connection default connection default; --echo # Reaping: ALTER DATABASE '#mysql50#a-b-c' UPGRADE DATA DIRECTORY NAME --reap ---echo # Connection con2 connection con2; --echo # Reaping: ALTER DATABASE '#mysql50#a-b-c' UPGRADE DATA DIRECTORY NAME --error ER_BAD_DB_ERROR @@ -4428,20 +3966,17 @@ DROP DATABASE `a-b-c-d`; --echo # not database DDL on different databases. Tests X vs X lock. --echo # ---echo # Connection default connection default; SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked'; --echo # Sending: --send DROP DATABASE db1 ---echo # Connection con2 connection con2; SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Sending: # This should block. --send DROP DATABASE db1 ---echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE state='Waiting for schema metadata lock' AND info='DROP DATABASE db1'; @@ -4452,32 +3987,27 @@ ALTER DATABASE db2 DEFAULT CHARACTER SET utf8; DROP DATABASE db2; SET DEBUG_SYNC= 'now SIGNAL blocked'; ---echo # Connection default connection default; --echo # Reaping: DROP DATABASE db1 --reap ---echo # Connection con2 connection con2; --echo # Reaping: DROP DATABASE db1 --error ER_DB_DROP_EXISTS --reap ---echo # Connection default connection default; CREATE DATABASE db1; SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked'; --echo # Sending: --send DROP DATABASE db1 ---echo # Connection con2 connection con2; SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Sending: # This should also block. --send ALTER DATABASE db1 DEFAULT CHARACTER SET utf8 ---echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE state='Waiting for schema metadata lock' @@ -4485,12 +4015,10 @@ let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist --source include/wait_condition.inc SET DEBUG_SYNC= 'now SIGNAL blocked'; ---echo # Connection default connection default; --echo # Reaping: DROP DATABASE db1 --reap ---echo # Connection con2 connection con2; --echo # Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8 # Error 1 is from ALTER DATABASE when the database does not exist. @@ -4504,21 +4032,18 @@ connection con2; --echo # Tests X vs IX lock. --echo # ---echo # Connection default connection default; CREATE DATABASE db1; SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked'; --echo # Sending: --send DROP DATABASE db1 ---echo # Connection con2 connection con2; SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Sending: # This should block. --send CREATE TABLE db1.t1 (a INT) ---echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE state='Waiting for schema metadata lock' AND @@ -4526,12 +4051,10 @@ let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist --source include/wait_condition.inc SET DEBUG_SYNC= 'now SIGNAL blocked'; ---echo # Connection default connection default; --echo # Reaping: DROP DATABASE db1 --reap ---echo # Connection con2 connection con2; --echo # Reaping: CREATE TABLE db1.t1 (a INT) --error ER_BAD_DB_ERROR @@ -4542,7 +4065,6 @@ connection con2; --echo # Tests X vs IX lock. --echo # ---echo # Connection default connection default; CREATE DATABASE db1; CREATE TABLE db1.t1 (a INT); @@ -4550,14 +4072,12 @@ SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked'; --echo # Sending: --send DROP DATABASE db1 ---echo # Connection con2 connection con2; SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Sending: # This should block. --send RENAME TABLE db1.t1 TO test.t1 ---echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE state='Waiting for schema metadata lock' AND @@ -4565,18 +4085,15 @@ let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist --source include/wait_condition.inc SET DEBUG_SYNC= 'now SIGNAL blocked'; ---echo # Connection default connection default; --echo # Reaping: DROP DATABASE db1 --reap ---echo # Connection con2 connection con2; --echo # Reaping: RENAME TABLE db1.t1 TO test.t1 --error ER_NO_SUCH_TABLE --reap ---echo # Connection default connection default; CREATE DATABASE db1; CREATE TABLE test.t2 (a INT); @@ -4584,14 +4101,12 @@ SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked'; --echo # Sending: --send DROP DATABASE db1 ---echo # Connection con2 connection con2; SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Sending: # This should block. --send RENAME TABLE test.t2 TO db1.t2 ---echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE state='Waiting for schema metadata lock' AND @@ -4599,12 +4114,10 @@ let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist --source include/wait_condition.inc SET DEBUG_SYNC= 'now SIGNAL blocked'; ---echo # Connection default connection default; --echo # Reaping: DROP DATABASE db1 --reap ---echo # Connection con2 connection con2; --echo # Reaping: RENAME TABLE test.t2 TO db1.t2 # Error 7 is from RENAME TABLE where the target database does not exist. @@ -4619,7 +4132,6 @@ DROP TABLE test.t2; --echo # Tests X vs IX lock. --echo # ---echo # Connection default connection default; CREATE DATABASE db1; CREATE TABLE db1.t1 (a INT); @@ -4627,32 +4139,27 @@ SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked'; --echo # Sending: --send DROP DATABASE db1 ---echo # Connection con2 connection con2; SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Sending: # This should block. --send DROP TABLE db1.t1 ---echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE state='Waiting for schema metadata lock' AND info='DROP TABLE db1.t1'; --source include/wait_condition.inc SET DEBUG_SYNC= 'now SIGNAL blocked'; ---echo # Connection default connection default; --echo # Reaping: DROP DATABASE db1 --reap ---echo # Connection con2 connection con2; --echo # Reaping: DROP TABLE db1.t1 --error ER_BAD_TABLE_ERROR --reap ---echo # Connection default connection default; disconnect con2; disconnect con3; @@ -4671,16 +4178,13 @@ CREATE TABLE db1.t1(a INT); connect(con2, localhost, root); connect(con3, localhost, root); ---echo # Connection default connection default; FLUSH TABLE WITH READ LOCK; ---echo # Connection con2 connection con2; # IX global lock should block --send CREATE TABLE db1.t2(a INT) ---echo # Connection default connection default; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE state='Waiting for global read lock' @@ -4688,21 +4192,17 @@ let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist --source include/wait_condition.inc UNLOCK TABLES; ---echo # Connection con2 connection con2; --echo # Reaping CREATE TABLE db1.t2(a INT) --reap ---echo # Connection default connection default; FLUSH TABLE WITH READ LOCK; ---echo # Connection con2 connection con2; # X global lock should block --send ALTER DATABASE db1 DEFAULT CHARACTER SET utf8 ---echo # Connection default connection default; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE state='Waiting for global read lock' @@ -4710,22 +4210,18 @@ let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist --source include/wait_condition.inc UNLOCK TABLES; ---echo # Connection con2 connection con2; --echo # Reaping ALTER DATABASE db1 DEFAULT CHARACTER SET utf8 --reap ---echo # Connection default connection default; FLUSH TABLE WITH READ LOCK; ---echo # Connection con2 connection con2; # S global lock should not block FLUSH TABLE WITH READ LOCK; UNLOCK TABLES; ---echo # Connection default connection default; UNLOCK TABLES; DROP DATABASE db1; @@ -4752,7 +4248,6 @@ connect(con1, localhost, root); connect(con2, localhost, root); connect(con3, localhost, root); ---echo # Connection con1 connection con1; --echo # We need EXECUTE 2 since ALTER TABLE does SU => SNW => X and we want --echo # to stop at the second upgrade. @@ -4760,7 +4255,6 @@ SET DEBUG_SYNC= 'mdl_upgrade_lock SIGNAL upgrade WAIT_FOR continue EXECUTE 2'; --echo # Sending: --send ALTER TABLE m1 engine=MERGE UNION=(t2, t1) ---echo # Connection con2 connection con2; --echo # Waiting for ALTER TABLE to try lock upgrade SET DEBUG_SYNC= 'now WAIT_FOR upgrade'; @@ -4769,7 +4263,6 @@ SET DEBUG_SYNC= 'now WAIT_FOR upgrade'; --echo # Sending: --send DELETE FROM t2 WHERE a = 3 ---echo # Connection default connection con3; --echo # Check that DELETE is waiting on a metadata lock and not a table lock. let $wait_condition= @@ -4786,18 +4279,15 @@ connection default; --echo # Resuming ALTER TABLE SET DEBUG_SYNC= 'now SIGNAL continue'; ---echo # Connection con1 connection con1; --echo # Reaping: ALTER TABLE m1 engine=MERGE UNION=(t2, t1) --reap ---echo # Connection con2 connection con2; --echo # Reaping: DELETE FROM t2 WHERE a = 3 --reap connection con3; --echo # Reaping: SELECT * FROM m1 WHERE a < 3 --reap ---echo # Connection default connection default; DROP TABLE m1, t1, t2; SET DEBUG_SYNC= 'RESET'; |