summaryrefslogtreecommitdiff
path: root/mysql-test/t/innodb_mysql.test
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2007-07-20 14:17:15 +0300
committerunknown <gkodinov/kgeorge@magare.gmz>2007-07-20 14:17:15 +0300
commiteea5c2a3c5968c458d872484d9afe9ca228e6700 (patch)
treeb31b9272fad8de457dd5a3331d22d1846ec85185 /mysql-test/t/innodb_mysql.test
parent8b59beaebef6528f748bad02541636b02a087b93 (diff)
downloadmariadb-git-eea5c2a3c5968c458d872484d9afe9ca228e6700.tar.gz
Bug #29644: alter table hangs if records locked in share mode
by long running transaction On Windows opened files can't be deleted. There was a special upgraded lock mode (TL_WRITE instead of TL_WRITE_ALLOW_READ) in ALTER TABLE to make sure nobody has the table opened when deleting the old table in ALTER TABLE. This special mode was causing ALTER TABLE to hang waiting on a lock inside InnoDB. This special lock is no longer necessary as the server is closing the tables it needs to delete in ALTER TABLE. Fixed by removing the special lock. Note that this also reverses the fix for bug 17264 that deals with another consequence of this special lock mode being used. mysql-test/r/innodb_mysql.result: Bug #29644: test case mysql-test/t/innodb_mysql.test: Bug #29644: test case sql/ha_innodb.cc: Bug #29644: reverse the (now excessive) fix for bug 17264 (but leave the test case). sql/sql_base.cc: Bug #29644: don't need a special lock mode for Win32 anymore: the table is closed before the drop.
Diffstat (limited to 'mysql-test/t/innodb_mysql.test')
-rw-r--r--mysql-test/t/innodb_mysql.test51
1 files changed, 51 insertions, 0 deletions
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index d4ce997ddb1..a8724d2e7d5 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -741,4 +741,55 @@ set @@sort_buffer_size=default;
DROP TABLE t1,t2;
+#
+# Bug #29644: alter table hangs if records locked in share mode by long
+# running transaction
+#
+
+CREATE TABLE t1 (a INT, PRIMARY KEY (a)) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+INSERT INTO t1 SELECT a + 8 FROM t1;
+INSERT INTO t1 SELECT a + 16 FROM t1;
+
+DELIMITER |;
+CREATE PROCEDURE p1 ()
+BEGIN
+ DECLARE i INT DEFAULT 50;
+ DECLARE cnt INT;
+ START TRANSACTION;
+ ALTER TABLE t1 ENGINE=InnoDB;
+ COMMIT;
+ START TRANSACTION;
+ WHILE (i > 0) DO
+ SET i = i - 1;
+ SELECT COUNT(*) INTO cnt FROM t1 LOCK IN SHARE MODE;
+ END WHILE;
+ COMMIT;
+END;|
+
+DELIMITER ;|
+
+CONNECT (con1,localhost,root,,);
+CONNECT (con2,localhost,root,,);
+
+CONNECTION con1;
+SEND CALL p1();
+CONNECTION con2;
+SEND CALL p1();
+CONNECTION default;
+CALL p1();
+
+CONNECTION con1;
+REAP;
+CONNECTION con2;
+REAP;
+CONNECTION default;
+DISCONNECT con1;
+DISCONNECT con2;
+
+DROP PROCEDURE p1;
+DROP TABLE t1;
+
+
--echo End of 5.0 tests