diff options
Diffstat (limited to 'mysql-test/r/innodb_mysql_lock.result')
-rw-r--r-- | mysql-test/r/innodb_mysql_lock.result | 75 |
1 files changed, 47 insertions, 28 deletions
diff --git a/mysql-test/r/innodb_mysql_lock.result b/mysql-test/r/innodb_mysql_lock.result index 70b86017008..a7f45d355f1 100644 --- a/mysql-test/r/innodb_mysql_lock.result +++ b/mysql-test/r/innodb_mysql_lock.result @@ -5,29 +5,38 @@ set session innodb_lock_wait_timeout=300; # Bug #22876 Four-way deadlock # DROP TABLE IF EXISTS t1; -# Connection 1 +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connect con3,localhost,root,,; +connection con1; set @@autocommit=0; CREATE TABLE t1(s1 INT UNIQUE) ENGINE=innodb; INSERT INTO t1 VALUES (1); -# Connection 2 +connection con2; set @@autocommit=0; INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (1); -# Connection 3 +connection con3; set @@autocommit=0; DROP TABLE t1; -# Connection 1 +connection con1; # Connection 1 is now holding the lock. # Issuing insert from connection 1 while connection 2&3 # is waiting for the lock should give a deadlock error. INSERT INTO t1 VALUES (2); ERROR 40001: Deadlock found when trying to get lock; try restarting transaction # Cleanup +connection con2; commit; set @@autocommit=1; +connection con1; commit; set @@autocommit=1; +connection con3; set @@autocommit=1; +connection default; +disconnect con1; +disconnect con3; # # Test for bug #37346 "innodb does not detect deadlock between update # and alter table". @@ -39,14 +48,15 @@ begin; # Run statement which acquires X-lock on one of table's rows. update t1 set c3=c3+1 where c2=3; # -# Switching to connection 'con37346'. +connect con37346,localhost,root,,test,,; +connection con37346; # The below ALTER TABLE statement should wait till transaction # in connection 'default' is complete and then succeed. # It should not deadlock or fail with ER_LOCK_DEADLOCK error. # Sending: alter table t1 add column c4 int;; # -# Switching to connection 'default'. +connection default; # Wait until the above ALTER TABLE gets blocked because this # connection holds SW metadata lock on table to be altered. # The below statement should succeed. It should not @@ -55,10 +65,11 @@ update t1 set c3=c3+1 where c2=4; # Unblock ALTER TABLE by committing transaction. commit; # -# Switching to connection 'con37346'. +connection con37346; # Reaping ALTER TABLE. # -# Switching to connection 'default'. +connection default; +disconnect con37346; drop table t1; # # Bug #42147 Concurrent DML and LOCK TABLE ... READ for InnoDB @@ -72,22 +83,23 @@ drop table t1; # DROP TABLE IF EXISTS t1; CREATE TABLE t1 (i INT) engine= innodb; -# Connection 2 # Get user-level lock +connection con2; SELECT get_lock('bug42147_lock', 60); get_lock('bug42147_lock', 60) 1 -# Connection 1 +connection default; INSERT INTO t1 SELECT get_lock('bug42147_lock', 60); -# Connection 2 +connection con2; LOCK TABLES t1 READ; SELECT release_lock('bug42147_lock'); release_lock('bug42147_lock') 1 -# Connection 1 -# Connection 2 +connection default; +connection con2; UNLOCK TABLES; -# Connection 1 +connection default; +disconnect con2; DROP TABLE t1; # # Bug#53798 OPTIMIZE TABLE breaks repeatable read @@ -95,29 +107,30 @@ DROP TABLE t1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a INT) engine=innodb; INSERT INTO t1 VALUES (1), (2), (3); -# Connection con1 +connect con1, localhost, root; START TRANSACTION WITH CONSISTENT SNAPSHOT; SELECT * FROM t1; a 1 2 3 -# Connection default +connection default; # This should block # Sending: OPTIMIZE TABLE t1; -# Connection con1 +connection con1; SELECT * FROM t1; a 1 2 3 COMMIT; -# Connection default +connection default; # Reaping OPTIMIZE TABLE t1 Table Op Msg_type Msg_text test.t1 optimize note Table does not support optimize, doing recreate + analyze instead test.t1 optimize status OK +disconnect con1; DROP TABLE t1; # # Bug#49891 View DDL breaks REPEATABLE READ @@ -127,52 +140,58 @@ DROP VIEW IF EXISTS v2; CREATE TABLE t1 ( f1 INTEGER ) ENGINE = innodb; CREATE TABLE t2 ( f1 INTEGER ); CREATE VIEW v1 AS SELECT 1 FROM t1; -# Connection con3 +connect con2, localhost, root; +connect con3, localhost, root; +connection con3; LOCK TABLE t1 WRITE; -# Connection default +connection default; START TRANSACTION; # Sending: SELECT * FROM v1; -# Connection con2 +connection con2; # Waiting for 'SELECT * FROM v1' to sync in. # Sending: ALTER VIEW v1 AS SELECT 2 FROM t2; -# Connection con3 +connection con3; # Waiting for 'ALTER VIEW v1 AS SELECT 2 FROM t2' to sync in. UNLOCK TABLES; -# Connection default; +connection default; # Reaping: SELECT * FROM v1 1 SELECT * FROM v1; 1 COMMIT; -# Connection con2 +connection con2; # Reaping: ALTER VIEW v1 AS SELECT 2 FROM t2 -# Connection default +connection default; DROP TABLE t1, t2; DROP VIEW v1; +disconnect con2; +disconnect con3; # # Bug#11815600 [ERROR] INNODB COULD NOT FIND INDEX PRIMARY # KEY NO 0 FOR TABLE IN ERROR LOG # DROP TABLE IF EXISTS t1; -# Connection default +connect con1,localhost,root; +connection default; CREATE TABLE t1 (id INT PRIMARY KEY, value INT) ENGINE = InnoDB; INSERT INTO t1 VALUES (1, 12345); START TRANSACTION; SELECT * FROM t1; id value 1 12345 -# Connection con1 +connection con1; SET lock_wait_timeout=1; ALTER TABLE t1 ADD INDEX idx(value); ERROR HY000: Lock wait timeout exceeded; try restarting transaction ALTER TABLE t1 ADD INDEX idx(value); ERROR HY000: Lock wait timeout exceeded; try restarting transaction -# Connection default +connection default; SELECT * FROM t1; id value 1 12345 COMMIT; DROP TABLE t1; +disconnect con1; set global innodb_lock_wait_timeout=@old_innodb_lock_wait_timeout; |