mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-6858: enforce_storage_engine option
Merge from Percona Server enforced use of a specific storage engine authored by Stewart Smith. Modified to be session variable and modifiable only by SUPER. Use similar implementation as default_storage_engine.
This commit is contained in:
@ -9745,12 +9745,24 @@ static bool check_engine(THD *thd, const char *db_name,
|
||||
DBUG_ENTER("check_engine");
|
||||
handlerton **new_engine= &create_info->db_type;
|
||||
handlerton *req_engine= *new_engine;
|
||||
handlerton *enf_engine= thd->variables.enforced_table_plugin ? plugin_hton(thd->variables.enforced_table_plugin) : NULL;
|
||||
bool no_substitution= thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION;
|
||||
*new_engine= ha_checktype(thd, req_engine, no_substitution);
|
||||
DBUG_ASSERT(*new_engine);
|
||||
if (!*new_engine)
|
||||
DBUG_RETURN(true);
|
||||
|
||||
if (enf_engine && enf_engine != *new_engine)
|
||||
{
|
||||
if (no_substitution)
|
||||
{
|
||||
const char *engine_name= ha_resolve_storage_engine_name(req_engine);
|
||||
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), engine_name, engine_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
*new_engine= enf_engine;
|
||||
}
|
||||
|
||||
if (req_engine && req_engine != *new_engine)
|
||||
{
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
|
||||
|
Reference in New Issue
Block a user