From db677cc6efbb8a58969e83843890c72e2441a6e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 31 May 2018 22:52:56 +0300 Subject: [PATCH] Follow-up to MDEV-14168: Correct INNOBASE_DEFAULTS INNOBASE_DEFAULTS: Replace ALTER_ADD_COLUMN with the more appropriate ALTER_ADD_STORED_BASE_COLUMN. This clean-up causes no change of behaviour, because ALGORITHM=INPLACE would be refused for ALTER_ADD_STORED_GENERATED_COLUMN, and default values are not computed nor substituted for ALTER_ADD_VIRTUAL_COLUMN. --- storage/innobase/handler/handler0alter.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 21857a8c043..769eced242c 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -72,6 +72,11 @@ static const alter_table_operations INNOBASE_ONLINE_CREATE = ALTER_ADD_NON_UNIQUE_NON_PRIM_INDEX | ALTER_ADD_UNIQUE_INDEX; +/** Operations that require filling in default values for columns */ +static const alter_table_operations INNOBASE_DEFAULTS + = ALTER_COLUMN_NOT_NULLABLE + | ALTER_ADD_STORED_BASE_COLUMN; + /** Operations for rebuilding a table in place */ static const alter_table_operations INNOBASE_ALTER_REBUILD = ALTER_ADD_PK_INDEX @@ -79,10 +84,9 @@ static const alter_table_operations INNOBASE_ALTER_REBUILD | ALTER_CHANGE_CREATE_OPTION /* CHANGE_CREATE_OPTION needs to check create_option_need_rebuild() */ | ALTER_COLUMN_NULLABLE - | ALTER_COLUMN_NOT_NULLABLE + | INNOBASE_DEFAULTS | ALTER_STORED_COLUMN_ORDER | ALTER_DROP_STORED_COLUMN - | ALTER_ADD_STORED_BASE_COLUMN | ALTER_RECREATE_TABLE /* | ALTER_STORED_COLUMN_TYPE @@ -130,10 +134,6 @@ static const alter_table_operations INNOBASE_ALTER_INSTANT | ALTER_COLUMN_EQUAL_PACK_LENGTH | ALTER_DROP_VIRTUAL_COLUMN; -static const alter_table_operations INNOBASE_DEFAULTS - = ALTER_COLUMN_NOT_NULLABLE - | ALTER_ADD_COLUMN; - struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx { /** Dummy query graph */ @@ -3309,8 +3309,7 @@ innobase_build_col_map( + dict_table_get_n_v_cols(old_table) >= table->s->fields + DATA_N_SYS_COLS); DBUG_ASSERT(!!defaults == !!(ha_alter_info->handler_flags - & (ALTER_ADD_COLUMN - | ALTER_COLUMN_NOT_NULLABLE))); + & INNOBASE_DEFAULTS)); DBUG_ASSERT(!defaults || dtuple_get_n_fields(defaults) == dict_table_get_n_cols(new_table));