diff options
Diffstat (limited to 'mysql-test/suite/handler')
-rw-r--r-- | mysql-test/suite/handler/aria.result | 27 | ||||
-rw-r--r-- | mysql-test/suite/handler/handler.inc | 21 | ||||
-rw-r--r-- | mysql-test/suite/handler/heap.result | 27 | ||||
-rw-r--r-- | mysql-test/suite/handler/innodb.result | 26 | ||||
-rw-r--r-- | mysql-test/suite/handler/interface.result | 18 | ||||
-rw-r--r-- | mysql-test/suite/handler/interface.test | 26 | ||||
-rw-r--r-- | mysql-test/suite/handler/myisam.result | 27 |
7 files changed, 77 insertions, 95 deletions
diff --git a/mysql-test/suite/handler/aria.result b/mysql-test/suite/handler/aria.result index b8ed1fd98c8..6b02ac9b085 100644 --- a/mysql-test/suite/handler/aria.result +++ b/mysql-test/suite/handler/aria.result @@ -545,7 +545,6 @@ optimize table t1; connection default; handler t1 read next; c1 -1 handler t1 close; connection con2; Table Op Msg_type Msg_text @@ -1296,19 +1295,27 @@ commit; # an open HANDLER, ER_LOCK_DEADLOCK is reported. # create table t1 (a int, key a(a)); -create table t2 like t1; handler t1 open; connection con1; -lock table t1 write, t2 write; +select get_lock('lock1', 10); +get_lock('lock1', 10) +1 connection default; -drop table t2; +select get_lock('lock1', 10); connection con2; -# Waiting for 'drop table t2' to get blocked... +# Waiting for 'select get_lock('lock1', 10)' to get blocked... connection con1; drop table t1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -unlock tables; +select release_lock('lock1'); +release_lock('lock1') +1 connection default; +get_lock('lock1', 10) +1 +select release_lock('lock1'); +release_lock('lock1') +1 # Demonstrate that there is no deadlock with FLUSH TABLE, # even though it is waiting for the other table to go away create table t2 like t1; @@ -1347,6 +1354,10 @@ handler t1 read a next; a 1 # Unblock 'lock tables t1 write'. +select * from t1; +a +1 +2 commit; connection con1; # Reap 'lock tables t1 write'. @@ -1516,10 +1527,6 @@ handler t1 read a last; a b 7 7 commit; -connection con1; -# Demonstrate that the HANDLER doesn't hold MDL_SHARED_WRITE. -lock table t1 write; -unlock tables; connection default; handler t1 read a prev; a b diff --git a/mysql-test/suite/handler/handler.inc b/mysql-test/suite/handler/handler.inc index a4ab5f1ed32..2432ff13e55 100644 --- a/mysql-test/suite/handler/handler.inc +++ b/mysql-test/suite/handler/handler.inc @@ -1054,24 +1054,24 @@ commit; --echo # an open HANDLER, ER_LOCK_DEADLOCK is reported. --echo # create table t1 (a int, key a(a)); -create table t2 like t1; handler t1 open; connection con1; -lock table t1 write, t2 write; +select get_lock('lock1', 10); connection default; -send drop table t2; +send select get_lock('lock1', 10); connection con2; ---echo # Waiting for 'drop table t2' to get blocked... +--echo # Waiting for 'select get_lock('lock1', 10)' to get blocked... let $wait_condition=select count(*)=1 from information_schema.processlist - where state='Waiting for table metadata lock' and - info='drop table t2'; + where state='User lock' and + info='select get_lock(\'lock1\', 10)'; --source include/wait_condition.inc connection con1; --error ER_LOCK_DEADLOCK drop table t1; -unlock tables; +select release_lock('lock1'); connection default; reap; +select release_lock('lock1'); --echo # Demonstrate that there is no deadlock with FLUSH TABLE, --echo # even though it is waiting for the other table to go away @@ -1118,6 +1118,7 @@ connection default; handler t1 read a next; --echo # Unblock 'lock tables t1 write'. +select * from t1; # Release MDL_SHARED_READ held by HANDLER commit; connection con1; @@ -1132,7 +1133,7 @@ connection con1; --echo # Waiting for 'handler t1 read a next' to get blocked... let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table level lock" and + where state = "Waiting for table metadata lock" and info = "handler t1 read a next"; --source include/wait_condition.inc @@ -1259,10 +1260,6 @@ handler t1 read a last; insert into t1 (a, b) values (7, 7); handler t1 read a last; commit; -connection con1; ---echo # Demonstrate that the HANDLER doesn't hold MDL_SHARED_WRITE. -lock table t1 write; -unlock tables; connection default; handler t1 read a prev; handler t1 close; diff --git a/mysql-test/suite/handler/heap.result b/mysql-test/suite/handler/heap.result index 70dcefe4ff3..fc42e43f710 100644 --- a/mysql-test/suite/handler/heap.result +++ b/mysql-test/suite/handler/heap.result @@ -545,7 +545,6 @@ optimize table t1; connection default; handler t1 read next; c1 -1 handler t1 close; connection con2; Table Op Msg_type Msg_text @@ -1296,19 +1295,27 @@ commit; # an open HANDLER, ER_LOCK_DEADLOCK is reported. # create table t1 (a int, key a(a)); -create table t2 like t1; handler t1 open; connection con1; -lock table t1 write, t2 write; +select get_lock('lock1', 10); +get_lock('lock1', 10) +1 connection default; -drop table t2; +select get_lock('lock1', 10); connection con2; -# Waiting for 'drop table t2' to get blocked... +# Waiting for 'select get_lock('lock1', 10)' to get blocked... connection con1; drop table t1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -unlock tables; +select release_lock('lock1'); +release_lock('lock1') +1 connection default; +get_lock('lock1', 10) +1 +select release_lock('lock1'); +release_lock('lock1') +1 # Demonstrate that there is no deadlock with FLUSH TABLE, # even though it is waiting for the other table to go away create table t2 like t1; @@ -1347,6 +1354,10 @@ handler t1 read a next; a 1 # Unblock 'lock tables t1 write'. +select * from t1; +a +1 +2 commit; connection con1; # Reap 'lock tables t1 write'. @@ -1516,10 +1527,6 @@ handler t1 read a last; a b 7 7 commit; -connection con1; -# Demonstrate that the HANDLER doesn't hold MDL_SHARED_WRITE. -lock table t1 write; -unlock tables; connection default; handler t1 read a prev; a b diff --git a/mysql-test/suite/handler/innodb.result b/mysql-test/suite/handler/innodb.result index 102237617fd..80e8ed679a9 100644 --- a/mysql-test/suite/handler/innodb.result +++ b/mysql-test/suite/handler/innodb.result @@ -1299,19 +1299,27 @@ commit; # an open HANDLER, ER_LOCK_DEADLOCK is reported. # create table t1 (a int, key a(a)); -create table t2 like t1; handler t1 open; connection con1; -lock table t1 write, t2 write; +select get_lock('lock1', 10); +get_lock('lock1', 10) +1 connection default; -drop table t2; +select get_lock('lock1', 10); connection con2; -# Waiting for 'drop table t2' to get blocked... +# Waiting for 'select get_lock('lock1', 10)' to get blocked... connection con1; drop table t1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -unlock tables; +select release_lock('lock1'); +release_lock('lock1') +1 connection default; +get_lock('lock1', 10) +1 +select release_lock('lock1'); +release_lock('lock1') +1 # Demonstrate that there is no deadlock with FLUSH TABLE, # even though it is waiting for the other table to go away create table t2 like t1; @@ -1350,6 +1358,10 @@ handler t1 read a next; a 1 # Unblock 'lock tables t1 write'. +select * from t1; +a +1 +2 commit; connection con1; # Reap 'lock tables t1 write'. @@ -1519,10 +1531,6 @@ handler t1 read a last; a b 7 7 commit; -connection con1; -# Demonstrate that the HANDLER doesn't hold MDL_SHARED_WRITE. -lock table t1 write; -unlock tables; connection default; handler t1 read a prev; a b diff --git a/mysql-test/suite/handler/interface.result b/mysql-test/suite/handler/interface.result index 4d5a385df0f..a4ac32c16b4 100644 --- a/mysql-test/suite/handler/interface.result +++ b/mysql-test/suite/handler/interface.result @@ -272,24 +272,6 @@ handler t1 read a next; ERROR 42S02: Unknown table 't1' in HANDLER connect con1,localhost,root,,; connect con2,localhost,root,,; -connection default; -drop table if exists t1; -# First test case which is supposed trigger the execution -# path on which problem was discovered. -create table t1 (a int not null); -insert into t1 values (1); -handler t1 open; -connection con1; -lock table t1 write; -alter table t1 engine=csv; -connection con2; -connection default; -handler t1 read a next; -ERROR HY000: Storage engine CSV of the table `test`.`t1` doesn't have this option -handler t1 close; -connection con1; -unlock tables; -drop table t1; # Now test case which was reported originally but which no longer # triggers execution path which has caused the problem. connection default; diff --git a/mysql-test/suite/handler/interface.test b/mysql-test/suite/handler/interface.test index a82412799eb..2f576c9b291 100644 --- a/mysql-test/suite/handler/interface.test +++ b/mysql-test/suite/handler/interface.test @@ -298,32 +298,6 @@ handler t1 read a next; connect(con1,localhost,root,,); connect(con2,localhost,root,,); -connection default; ---disable_warnings -drop table if exists t1; ---enable_warnings ---echo # First test case which is supposed trigger the execution ---echo # path on which problem was discovered. -create table t1 (a int not null); -insert into t1 values (1); -handler t1 open; -connection con1; -lock table t1 write; -send alter table t1 engine=csv; -connection con2; -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table metadata lock" and - info = "alter table t1 engine=csv"; ---source include/wait_condition.inc -connection default; ---error ER_ILLEGAL_HA -handler t1 read a next; -handler t1 close; -connection con1; ---reap -unlock tables; -drop table t1; --echo # Now test case which was reported originally but which no longer --echo # triggers execution path which has caused the problem. connection default; diff --git a/mysql-test/suite/handler/myisam.result b/mysql-test/suite/handler/myisam.result index fca75f3b7a6..90e1767a1f3 100644 --- a/mysql-test/suite/handler/myisam.result +++ b/mysql-test/suite/handler/myisam.result @@ -545,7 +545,6 @@ optimize table t1; connection default; handler t1 read next; c1 -1 handler t1 close; connection con2; Table Op Msg_type Msg_text @@ -1296,19 +1295,27 @@ commit; # an open HANDLER, ER_LOCK_DEADLOCK is reported. # create table t1 (a int, key a(a)); -create table t2 like t1; handler t1 open; connection con1; -lock table t1 write, t2 write; +select get_lock('lock1', 10); +get_lock('lock1', 10) +1 connection default; -drop table t2; +select get_lock('lock1', 10); connection con2; -# Waiting for 'drop table t2' to get blocked... +# Waiting for 'select get_lock('lock1', 10)' to get blocked... connection con1; drop table t1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -unlock tables; +select release_lock('lock1'); +release_lock('lock1') +1 connection default; +get_lock('lock1', 10) +1 +select release_lock('lock1'); +release_lock('lock1') +1 # Demonstrate that there is no deadlock with FLUSH TABLE, # even though it is waiting for the other table to go away create table t2 like t1; @@ -1347,6 +1354,10 @@ handler t1 read a next; a 1 # Unblock 'lock tables t1 write'. +select * from t1; +a +1 +2 commit; connection con1; # Reap 'lock tables t1 write'. @@ -1516,10 +1527,6 @@ handler t1 read a last; a b 7 7 commit; -connection con1; -# Demonstrate that the HANDLER doesn't hold MDL_SHARED_WRITE. -lock table t1 write; -unlock tables; connection default; handler t1 read a prev; a b |