From: Date: September 19 2007 5:53pm Subject: bk commit into 5.1 tree (mskold:1.2636) BUG#31097 List-Archive: http://lists.mysql.com/commits/34411 X-Bug: 31097 Message-Id: <20070919155329.6DFC132C073@linux.site> Below is the list of changes that have just been committed into a local 5.1 repository of marty. When marty 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-09-19 17:53:18+02:00, mskold@stripped +6 -0 Bug #31097 ALTER ONLINE of a data type with implicit default value leaves tmp frm: only remove frm file if file type is TMP_TABLE_FRM_FILE_ONLY mysql-test/suite/ndb/r/ndb_alter_table_online.result@stripped, 2007-09-19 17:52:48+02:00, mskold@stripped +18 -0 Bug #31097 ALTER ONLINE of a data type with implicit default value leaves tmp frm: only remove frm file if file type is TMP_TABLE_FRM_FILE_ONLY mysql-test/suite/ndb/t/ndb_alter_table_online.test@stripped, 2007-09-19 17:52:48+02:00, mskold@stripped +28 -0 Bug #31097 ALTER ONLINE of a data type with implicit default value leaves tmp frm: only remove frm file if file type is TMP_TABLE_FRM_FILE_ONLY sql/mysql_priv.h@stripped, 2007-09-19 17:52:48+02:00, mskold@stripped +1 -1 Bug #31097 ALTER ONLINE of a data type with implicit default value leaves tmp frm: only remove frm file if file type is TMP_TABLE_FRM_FILE_ONLY sql/sql_base.cc@stripped, 2007-09-19 17:52:48+02:00, mskold@stripped +5 -4 Bug #31097 ALTER ONLINE of a data type with implicit default value leaves tmp frm: only remove frm file if file type is TMP_TABLE_FRM_FILE_ONLY sql/sql_delete.cc@stripped, 2007-09-19 17:52:48+02:00, mskold@stripped +3 -1 Bug #31097 ALTER ONLINE of a data type with implicit default value leaves tmp frm: only remove frm file if file type is TMP_TABLE_FRM_FILE_ONLY sql/sql_table.cc@stripped, 2007-09-19 17:52:48+02:00, mskold@stripped +4 -2 Bug #31097 ALTER ONLINE of a data type with implicit default value leaves tmp frm: only remove frm file if file type is TMP_TABLE_FRM_FILE_ONLY diff -Nrup a/mysql-test/suite/ndb/r/ndb_alter_table_online.result b/mysql-test/suite/ndb/r/ndb_alter_table_online.result --- a/mysql-test/suite/ndb/r/ndb_alter_table_online.result 2007-09-19 14:35:51 +02:00 +++ b/mysql-test/suite/ndb/r/ndb_alter_table_online.result 2007-09-19 17:52:48 +02:00 @@ -159,6 +159,24 @@ INSERT INTO t1 values (1,1); LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables; set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%'); truncate ndb_show_tables; +ALTER ONLINE TABLE t1 ADD c TIMESTAMP; +ERROR 42000: This version of MySQL doesn't yet support 'ALTER ONLINE TABLE t1 ADD c TIMESTAMP' +ALTER TABLE t1 ADD c TIMESTAMP; +LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables; +select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%'; +name +truncate ndb_show_tables; +INSERT INTO t1 values (2,1,NULL); +SELECT * FROM t1 ORDER BY a; +a b c +1 1 0000-00-00 00:00:00 +2 1 2007-09-19 18:46:02 +DROP TABLE t1; +CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB; +INSERT INTO t1 values (1,1); +LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables; +set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%'); +truncate ndb_show_tables; ALTER ONLINE TABLE t1 ADD c CHAR(19) NOT NULL; ERROR 42000: This version of MySQL doesn't yet support 'ALTER ONLINE TABLE t1 ADD c CHAR(19) NOT NULL' ALTER TABLE t1 ADD c CHAR(19) NOT NULL; diff -Nrup a/mysql-test/suite/ndb/t/ndb_alter_table_online.test b/mysql-test/suite/ndb/t/ndb_alter_table_online.test --- a/mysql-test/suite/ndb/t/ndb_alter_table_online.test 2007-09-19 14:35:51 +02:00 +++ b/mysql-test/suite/ndb/t/ndb_alter_table_online.test 2007-09-19 17:52:48 +02:00 @@ -229,6 +229,34 @@ set @t1_id = (select id from ndb_show_ta truncate ndb_show_tables; --error ER_NOT_SUPPORTED_YET +ALTER ONLINE TABLE t1 ADD c TIMESTAMP; +ALTER TABLE t1 ADD c TIMESTAMP; + +--disable_warnings +--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat +LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables; +--enable_warnings + +select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%'; + +truncate ndb_show_tables; + +INSERT INTO t1 values (2,1,NULL); +SELECT * FROM t1 ORDER BY a; +DROP TABLE t1; + +CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB; +INSERT INTO t1 values (1,1); + +--disable_warnings +--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat +LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables; +--enable_warnings + +set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%'); +truncate ndb_show_tables; + +--error ER_NOT_SUPPORTED_YET ALTER ONLINE TABLE t1 ADD c CHAR(19) NOT NULL; ALTER TABLE t1 ADD c CHAR(19) NOT NULL; diff -Nrup a/sql/mysql_priv.h b/sql/mysql_priv.h --- a/sql/mysql_priv.h 2007-08-23 15:22:00 +02:00 +++ b/sql/mysql_priv.h 2007-09-19 17:52:48 +02:00 @@ -1412,7 +1412,7 @@ int decide_logging_format(THD *thd, TABL TABLE *open_temporary_table(THD *thd, const char *path, const char *db, const char *table_name, bool link_in_list, open_table_mode open_mode); -bool rm_temporary_table(handlerton *base, char *path); +bool rm_temporary_table(handlerton *base, char *path, bool frm_only); void free_io_cache(TABLE *entry); void intern_close_table(TABLE *entry); bool close_thread_table(THD *thd, TABLE **table_ptr); diff -Nrup a/sql/sql_base.cc b/sql/sql_base.cc --- a/sql/sql_base.cc 2007-08-31 16:34:44 +02:00 +++ b/sql/sql_base.cc 2007-09-19 17:52:48 +02:00 @@ -1766,8 +1766,9 @@ void close_temporary(TABLE *table, bool Check that temporary table has not been created with frm_only because it has then not been created in any storage engine */ - if (table->s->tmp_table != TMP_TABLE_FRM_FILE_ONLY && delete_table) - rm_temporary_table(table_type, table->s->path.str); + if (delete_table) + rm_temporary_table(table_type, table->s->path.str, + table->s->tmp_table == TMP_TABLE_FRM_FILE_ONLY); if (free_share) { free_table_share(table->s); @@ -4413,7 +4414,7 @@ TABLE *open_temporary_table(THD *thd, co } -bool rm_temporary_table(handlerton *base, char *path) +bool rm_temporary_table(handlerton *base, char *path, bool frm_only) { bool error=0; handler *file; @@ -4425,7 +4426,7 @@ bool rm_temporary_table(handlerton *base error=1; /* purecov: inspected */ *ext= 0; // remove extension file= get_new_handler((TABLE_SHARE*) 0, current_thd->mem_root, base); - if (file && file->delete_table(path)) + if (!frm_only && file && file->delete_table(path)) { error=1; sql_print_warning("Could not remove temporary table: '%s', error: %d", diff -Nrup a/sql/sql_delete.cc b/sql/sql_delete.cc --- a/sql/sql_delete.cc 2007-08-23 15:22:01 +02:00 +++ b/sql/sql_delete.cc 2007-09-19 17:52:48 +02:00 @@ -926,6 +926,8 @@ bool mysql_truncate(THD *thd, TABLE_LIST { handlerton *table_type= table->s->db_type(); TABLE_SHARE *share= table->s; + bool frm_only= (share->tmp_table == TMP_TABLE_FRM_FILE_ONLY); + if (!ha_check_storage_engine_flag(table_type, HTON_CAN_RECREATE)) goto trunc_by_del; @@ -939,7 +941,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST share->db.str, share->table_name.str, 1, OTM_OPEN)))) - (void) rm_temporary_table(table_type, path); + (void) rm_temporary_table(table_type, path, frm_only); free_table_share(share); my_free((char*) table,MYF(0)); /* diff -Nrup a/sql/sql_table.cc b/sql/sql_table.cc --- a/sql/sql_table.cc 2007-09-10 12:20:52 +02:00 +++ b/sql/sql_table.cc 2007-09-19 17:52:48 +02:00 @@ -3419,7 +3419,7 @@ bool mysql_create_table_no_lock(THD *thd /* Open table and put in temporary table list */ if (!(open_temporary_table(thd, path, db, table_name, 1, OTM_OPEN))) { - (void) rm_temporary_table(create_info->db_type, path); + (void) rm_temporary_table(create_info->db_type, path, false); goto unlock_and_end; } thd->thread_specific_used= TRUE; @@ -4639,7 +4639,7 @@ bool mysql_create_like_table(THD* thd, T OTM_OPEN)) { (void) rm_temporary_table(create_info->db_type, - dst_path); /* purecov: inspected */ + dst_path, false); /* purecov: inspected */ goto err; /* purecov: inspected */ } } @@ -6549,12 +6549,14 @@ view_err: if (alter_info->build_method == HA_BUILD_ONLINE) { my_error(ER_NOT_SUPPORTED_YET, MYF(0), thd->query); + close_temporary_table(thd, altered_table, 1, 1); goto err; } need_copy_table= TRUE; break; case HA_ALTER_ERROR: default: + close_temporary_table(thd, altered_table, 1, 1); goto err; } #ifndef DBUG_OFF