From: Jon Olav Hauglid Date: November 16 2011 2:13pm Subject: bzr push into mysql-trunk-wl5534 branch (jon.hauglid:3423 to 3424) WL#5534 List-Archive: http://lists.mysql.com/commits/141991 Message-Id: <201111161413.pAGEDAas001188@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3424 Jon Olav Hauglid 2011-11-16 WL#5534 Online ALTER, Phase 1. Patch #48: Review fixes, part 5. - Move tmp_table check to is_inplace_alter_impossible() - Move ignore check to default implementation of handler::check_if_supported_inplace_alter() - Added ignore flag to Alter_inplace_info. modified: sql/handler.cc sql/handler.h sql/sql_table.cc 3423 Jon Olav Hauglid 2011-11-16 WL#5534 Online ALTER, Phase 1. Patch #47: Review requests from Marko - Add separate flags for ADD/DROP FOREIGN KEY - Change handler flags to be of HA_ALTER_FLAGS type modified: sql/handler.h sql/sql_alter.h sql/sql_partition.cc sql/sql_table.cc sql/sql_yacc.yy === modified file 'sql/handler.cc' --- a/sql/handler.cc 2011-11-16 11:29:51 +0000 +++ b/sql/handler.cc 2011-11-16 14:12:49 +0000 @@ -3830,6 +3830,16 @@ handler::check_if_supported_inplace_alte /* We now know that it's only inplace_online_operations. */ enum_alter_inplace_result result= HA_ALTER_ERROR; + /* + Bug#11750045 - 40344: ALTER IGNORE TABLE T ADD INDEX DOES NOT IGNORE + IN FAST INDEX CREATION. + Supporting IGNORE for in-place ALTER is problematic as IGNORE requires + that offending rows are deleted, which complicates locking. + Use copy instead. + */ + if (ha_alter_info->ignore) + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + /* Add index */ if (ha_alter_info->handler_flags & Alter_inplace_info::ADD_INDEX) { === modified file 'sql/handler.h' --- a/sql/handler.h 2011-11-16 12:27:09 +0000 +++ b/sql/handler.h 2011-11-16 14:12:49 +0000 @@ -1005,8 +1005,9 @@ public: uint *index_add_buffer; inplace_alter_handler_ctx *handler_ctx; HA_ALTER_FLAGS handler_flags; + const bool ignore; // ALTER TABLE ... IGNORE - Alter_inplace_info() + Alter_inplace_info(bool ignore_arg) :key_info_buffer(NULL), key_count(0), index_drop_count(0), @@ -1014,7 +1015,8 @@ public: index_add_count(0), index_add_buffer(NULL), handler_ctx(NULL), - handler_flags(0) + handler_flags(0), + ignore(ignore_arg) {} }; === modified file 'sql/sql_table.cc' --- a/sql/sql_table.cc 2011-11-16 12:27:09 +0000 +++ b/sql/sql_table.cc 2011-11-16 14:12:49 +0000 @@ -6023,6 +6023,9 @@ static bool is_inplace_alter_impossible( { DBUG_ENTER("is_inplace_alter_impossible"); + if (table->s->tmp_table) // In-place not supported for tmp tables + DBUG_RETURN(true); + if (alter_info->flags & (Alter_info::ALTER_RECREATE | Alter_info::ALTER_TABLE_REORG | Alter_info::ALTER_RENAME | @@ -7198,8 +7201,6 @@ bool mysql_alter_table(THD *thd,char *ne if ((thd->variables.old_alter_table && alter_info->requested_algorithm != Alter_info::ALTER_TABLE_ALGORITHM_INPLACE) - || table->s->tmp_table // In-place not supported for tmp tables - || ignore || is_inplace_alter_impossible(table, create_info, alter_info) #ifdef WITH_PARTITION_STORAGE_ENGINE || (partition_changed && create_info->db_type == partition_hton && @@ -7230,7 +7231,7 @@ bool mysql_alter_table(THD *thd,char *ne if (alter_info->requested_algorithm != Alter_info::ALTER_TABLE_ALGORITHM_COPY) { - Alter_inplace_info ha_alter_info; + Alter_inplace_info ha_alter_info(ignore); bool use_inplace= true; /* Fill the Alter_inplace_info structure. */ No bundle (reason: useless for push emails).