List:Commits« Previous MessageNext Message »
From:kgeorge Date:July 20 2007 10:14am
Subject:bk commit into 5.0 tree (gkodinov:1.2536) BUG#29644
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-07-20 13:14:57+03:00, gkodinov@stripped +4 -0
  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 remedy 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@stripped, 2007-07-20 13:14:55+03:00, gkodinov@stripped +23 -0
    Bug #29644: test case

  mysql-test/t/innodb_mysql.test@stripped, 2007-07-20 13:14:55+03:00, gkodinov@stripped +51 -0
    Bug #29644: test case

  sql/ha_innodb.cc@stripped, 2007-07-20 13:14:55+03:00, gkodinov@stripped +0 -11
    Bug #29644: reverse the (now excessive) fix
    for bug 17264 (but leave the test case).

  sql/sql_base.cc@stripped, 2007-07-20 13:14:55+03:00, gkodinov@stripped +0 -7
    Bug #29644: don't need a special lock mode for Win32 anymore: 
    the table is closed before the drop.

diff -Nrup a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
--- a/mysql-test/r/innodb_mysql.result	2007-07-07 22:17:02 +03:00
+++ b/mysql-test/r/innodb_mysql.result	2007-07-20 13:14:55 +03:00
@@ -735,4 +735,27 @@ COUNT(*)
 3072
 set @@sort_buffer_size=default;
 DROP TABLE t1,t2;
+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;
+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;|
+CALL p1();
+CALL p1();
+CALL p1();
+DROP PROCEDURE p1;
+DROP TABLE t1;
 End of 5.0 tests
diff -Nrup a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
--- a/mysql-test/t/innodb_mysql.test	2007-07-07 22:19:29 +03:00
+++ b/mysql-test/t/innodb_mysql.test	2007-07-20 13:14:55 +03:00
@@ -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
diff -Nrup a/sql/ha_innodb.cc b/sql/ha_innodb.cc
--- a/sql/ha_innodb.cc	2007-06-20 19:22:25 +03:00
+++ b/sql/ha_innodb.cc	2007-07-20 13:14:55 +03:00
@@ -6702,17 +6702,6 @@ ha_innobase::store_lock(
 		    && !thd->tablespace_op
 		    && thd->lex->sql_command != SQLCOM_TRUNCATE
 		    && thd->lex->sql_command != SQLCOM_OPTIMIZE
-
-#ifdef __WIN__
-                /* For alter table on win32 for succesful operation
-                completion it is used TL_WRITE(=10) lock instead of
-                TL_WRITE_ALLOW_READ(=6), however here in innodb handler
-                TL_WRITE is lifted to TL_WRITE_ALLOW_WRITE, which causes
-                race condition when several clients do alter table
-                simultaneously (bug #17264). This fix avoids the problem. */
-		    && thd->lex->sql_command != SQLCOM_ALTER_TABLE
-#endif
-
 		    && thd->lex->sql_command != SQLCOM_CREATE_TABLE) {
 
 			lock_type = TL_WRITE_ALLOW_WRITE;
diff -Nrup a/sql/sql_base.cc b/sql/sql_base.cc
--- a/sql/sql_base.cc	2007-06-03 10:03:12 +03:00
+++ b/sql/sql_base.cc	2007-07-20 13:14:55 +03:00
@@ -2938,13 +2938,6 @@ TABLE *open_ltable(THD *thd, TABLE_LIST 
 
   if (table)
   {
-#if defined( __WIN__) || defined(OS2)
-    /* Win32 can't drop a file that is open */
-    if (lock_type == TL_WRITE_ALLOW_READ)
-    {
-      lock_type= TL_WRITE;
-    }
-#endif /* __WIN__ || OS2 */
     table_list->lock_type= lock_type;
     table_list->table=	   table;
     table->grant= table_list->grant;
Thread
bk commit into 5.0 tree (gkodinov:1.2536) BUG#29644kgeorge20 Jul
  • Re: bk commit into 5.0 tree (gkodinov:1.2536) BUG#29644Konstantin Osipov20 Jul
    • Re: bk commit into 5.0 tree (gkodinov:1.2536) BUG#29644Georgi Kodinov20 Jul