From: Date: July 26 2007 12:24pm Subject: bk commit into 5.0 tree (svoj:1.2531) BUG#29957 List-Archive: http://lists.mysql.com/commits/31610 X-Bug: 29957 Message-Id: <20070726102412.0675141CEC6@june.myoffice.izhnet.ru> Below is the list of changes that have just been committed into a local 5.0 repository of svoj. When svoj 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-26 15:24:09+05:00, svoj@stripped +3 -0 BUG#29957 - alter_table.test fails INSERT/DELETE/UPDATE followed by ALTER TABLE within LOCK TABLES may cause table corruption on Windows. That happens because ALTER TABLE writes outdated shared state info into index file. Fixed by updating shared state info prior to actually writing it to disk. Affects MyISAM tables on Windows only. myisam/mi_extra.c@stripped, 2007-07-26 15:24:07+05:00, svoj@stripped +1 -0 On windows when mi_extra(HA_EXTRA_PREPARE_FOR_DELETE) is called, we release external lock and close index file. If we're in LOCK TABLES, MyISAM state info doesn't get updated until UNLOCK TABLES. That means when we release external lock and we're in LOCK TABLES, we may write outdated state info. Fixed by updating state info prior to releasing external lock. mysql-test/r/alter_table.result@stripped, 2007-07-26 15:24:07+05:00, svoj@stripped +12 -0 A test case for BUG#29957. mysql-test/t/alter_table.test@stripped, 2007-07-26 15:24:07+05:00, svoj@stripped +12 -0 A test case for BUG#29957. diff -Nrup a/myisam/mi_extra.c b/myisam/mi_extra.c --- a/myisam/mi_extra.c 2006-12-31 00:02:04 +04:00 +++ b/myisam/mi_extra.c 2007-07-26 15:24:07 +05:00 @@ -298,6 +298,7 @@ int mi_extra(MI_INFO *info, enum ha_extr if (info->lock_type != F_UNLCK && ! info->was_locked) { info->was_locked=info->lock_type; + mi_update_status((void*) info); if (mi_lock_database(info,F_UNLCK)) error=my_errno; info->lock_type = F_UNLCK; diff -Nrup a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result --- a/mysql-test/r/alter_table.result 2007-05-22 01:20:29 +05:00 +++ b/mysql-test/r/alter_table.result 2007-07-26 15:24:07 +05:00 @@ -903,3 +903,15 @@ f1 f2 f21 f4 f41 1 2000-01-01 00:00:00 2000-01-01 2002-02-02 00:00:00 2002-02-02 drop table t1; set sql_mode= @orig_sql_mode; +create table t1 (c char(10) default "Two"); +lock table t1 write; +insert into t1 values (); +alter table t1 modify c char(10) default "Three"; +unlock tables; +select * from t1; +c +Two +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; diff -Nrup a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test --- a/mysql-test/t/alter_table.test 2007-05-22 01:18:34 +05:00 +++ b/mysql-test/t/alter_table.test 2007-07-26 15:24:07 +05:00 @@ -684,3 +684,15 @@ alter table t1 add column f4 datetime no select * from t1; drop table t1; set sql_mode= @orig_sql_mode; + +# +# BUG#29957 - alter_table.test fails +# +create table t1 (c char(10) default "Two"); +lock table t1 write; +insert into t1 values (); +alter table t1 modify c char(10) default "Three"; +unlock tables; +select * from t1; +check table t1; +drop table t1;