Hi, Jan! On Aug 08, Jan Lindström wrote:
MDEV-8577: With enforce-storage-engine mysql_upgrade corrupts the schema: ALTER TABLE should either bypass enforce-storage-engine, or mysql_upgrade should refuse to run
Allow user to alter contents of existing table without enforcing storage engine. However, enforce storage engine on ALTER TABLE x ENGINE=y;
Good idea, I like this behavior.
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 69c87dd..60c4407 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -9801,8 +9801,12 @@ static bool check_engine(THD *thd, const char *db_name, *new_engine= ha_checktype(thd, req_engine, no_substitution); DBUG_ASSERT(*new_engine);
- /* Enforced storage engine should not be used on bootstrap */ - if (!in_bootstrap) + /* Enforced storage engine should not be used on bootstrap + and in ALTER TABLE that does not use explicit ENGINE = x to + avoid unwanted unrelated changes.*/ + if (!in_bootstrap &&
Note that !in_bootstrap belongs to another bug fix, please don't accidentally push it together with this one.
+ !(thd->lex->sql_command == SQLCOM_ALTER_TABLE && + !(create_info->used_fields & HA_CREATE_USED_ENGINE))) enf_engine= thd->variables.enforced_table_plugin ? plugin_hton(thd->variables.enforced_table_plugin) : NULL;
Looks good, ok to push! Regards, Sergei