From: Konstantin Osipov Date: July 20 2007 11:11am Subject: Re: bk commit into 5.0 tree (gkodinov:1.2536) BUG#29644 List-Archive: http://lists.mysql.com/commits/31222 Message-Id: <20070720111150.GM26969@bodhi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii * kgeorge@stripped [07/07/20 14:28]: OK to push. > 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 ^^^^^^^^^^^^ Please proof-read the changeset comments before pushing. > 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. > > --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 Don't forget to send this patch to dev-innodb@stripped and dev@stripped -- -- Konstantin Osipov Software Developer, Moscow, Russia -- MySQL AB, www.mysql.com The best DATABASE COMPANY in the GALAXY