mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-23295 ROW_FORMAT mismatch in instant ALTER TABLE
An instant ADD/DROP/reorder column could create a dummy table object with the wrong ROW_FORMAT when innodb_default_row_format was changed between CREATE TABLE and ALTER TABLE. prepare_inplace_alter_table_dict(): If we had promised that ALGORITHM=INPLACE is supported, we must preserve the ROW_FORMAT. dict_table_t::prepare_instant(): Add debug assertions to catch ROW_FORMAT mismatch. The rest of the changes are related to adding Alter_inplace_info::inplace_supported to cache the return value of handler::check_if_supported_inplace_alter().
This commit is contained in:
@ -7560,7 +7560,6 @@ static bool is_inplace_alter_impossible(TABLE *table,
|
||||
@param ha_alter_info Structure describing ALTER TABLE to be carried
|
||||
out and serving as a storage place for data
|
||||
used during different phases.
|
||||
@param inplace_supported Enum describing the locking requirements.
|
||||
@param target_mdl_request Metadata request/lock on the target table name.
|
||||
@param alter_ctx ALTER TABLE runtime context.
|
||||
|
||||
@ -7585,7 +7584,6 @@ static bool mysql_inplace_alter_table(THD *thd,
|
||||
TABLE *table,
|
||||
TABLE *altered_table,
|
||||
Alter_inplace_info *ha_alter_info,
|
||||
enum_alter_inplace_result inplace_supported,
|
||||
MDL_request *target_mdl_request,
|
||||
Alter_table_ctx *alter_ctx)
|
||||
{
|
||||
@ -7595,6 +7593,8 @@ static bool mysql_inplace_alter_table(THD *thd,
|
||||
Alter_info *alter_info= ha_alter_info->alter_info;
|
||||
bool reopen_tables= false;
|
||||
bool res;
|
||||
const enum_alter_inplace_result inplace_supported=
|
||||
ha_alter_info->inplace_supported;
|
||||
|
||||
DBUG_ENTER("mysql_inplace_alter_table");
|
||||
|
||||
@ -10121,19 +10121,19 @@ do_continue:;
|
||||
if (alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_NONE)
|
||||
ha_alter_info.online= true;
|
||||
// Ask storage engine whether to use copy or in-place
|
||||
enum_alter_inplace_result inplace_supported=
|
||||
ha_alter_info.inplace_supported=
|
||||
table->file->check_if_supported_inplace_alter(&altered_table,
|
||||
&ha_alter_info);
|
||||
|
||||
if (alter_info->supports_algorithm(thd, inplace_supported, &ha_alter_info) ||
|
||||
alter_info->supports_lock(thd, inplace_supported, &ha_alter_info))
|
||||
if (alter_info->supports_algorithm(thd, &ha_alter_info) ||
|
||||
alter_info->supports_lock(thd, &ha_alter_info))
|
||||
{
|
||||
cleanup_table_after_inplace_alter(&altered_table);
|
||||
goto err_new_table_cleanup;
|
||||
}
|
||||
|
||||
// If SHARED lock and no particular algorithm was requested, use COPY.
|
||||
if (inplace_supported == HA_ALTER_INPLACE_EXCLUSIVE_LOCK &&
|
||||
if (ha_alter_info.inplace_supported == HA_ALTER_INPLACE_EXCLUSIVE_LOCK &&
|
||||
alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_SHARED &&
|
||||
alter_info->algorithm(thd) ==
|
||||
Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT &&
|
||||
@ -10141,7 +10141,7 @@ do_continue:;
|
||||
Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT)
|
||||
use_inplace= false;
|
||||
|
||||
if (inplace_supported == HA_ALTER_INPLACE_NOT_SUPPORTED)
|
||||
if (ha_alter_info.inplace_supported == HA_ALTER_INPLACE_NOT_SUPPORTED)
|
||||
use_inplace= false;
|
||||
|
||||
if (use_inplace)
|
||||
@ -10154,7 +10154,7 @@ do_continue:;
|
||||
*/
|
||||
thd->count_cuted_fields = CHECK_FIELD_WARN;
|
||||
int res= mysql_inplace_alter_table(thd, table_list, table, &altered_table,
|
||||
&ha_alter_info, inplace_supported,
|
||||
&ha_alter_info,
|
||||
&target_mdl_request, &alter_ctx);
|
||||
thd->count_cuted_fields= save_count_cuted_fields;
|
||||
my_free(const_cast<uchar*>(frm.str));
|
||||
|
Reference in New Issue
Block a user