1
0
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:
Jan Lindström
2015-03-10 08:28:51 +02:00
parent ba3573cae8
commit 8249dcaaeb
16 changed files with 351 additions and 2 deletions

View File

@ -3089,11 +3089,13 @@ void plugin_thdvar_init(THD *thd)
{
plugin_ref old_table_plugin= thd->variables.table_plugin;
plugin_ref old_tmp_table_plugin= thd->variables.tmp_table_plugin;
plugin_ref old_enforced_table_plugin= thd->variables.enforced_table_plugin;
DBUG_ENTER("plugin_thdvar_init");
// This function may be called many times per THD (e.g. on COM_CHANGE_USER)
thd->variables.table_plugin= NULL;
thd->variables.tmp_table_plugin= NULL;
thd->variables.enforced_table_plugin= NULL;
cleanup_variables(&thd->variables);
thd->variables= global_system_variables;
@ -3113,12 +3115,14 @@ void plugin_thdvar_init(THD *thd)
intern_plugin_lock(NULL, global_system_variables.tmp_table_plugin);
intern_plugin_unlock(NULL, old_table_plugin);
intern_plugin_unlock(NULL, old_tmp_table_plugin);
intern_plugin_unlock(NULL, old_enforced_table_plugin);
mysql_mutex_unlock(&LOCK_plugin);
}
else
{
thd->variables.table_plugin= NULL;
thd->variables.tmp_table_plugin= NULL;
thd->variables.enforced_table_plugin= NULL;
}
DBUG_VOID_RETURN;
@ -3132,7 +3136,8 @@ static void unlock_variables(THD *thd, struct system_variables *vars)
{
intern_plugin_unlock(NULL, vars->table_plugin);
intern_plugin_unlock(NULL, vars->tmp_table_plugin);
vars->table_plugin= vars->tmp_table_plugin= NULL;
intern_plugin_unlock(NULL, vars->enforced_table_plugin);
vars->table_plugin= vars->tmp_table_plugin= vars->enforced_table_plugin= NULL;
}
@ -3170,6 +3175,7 @@ static void cleanup_variables(struct system_variables *vars)
DBUG_ASSERT(vars->table_plugin == NULL);
DBUG_ASSERT(vars->tmp_table_plugin == NULL);
DBUG_ASSERT(vars->enforced_table_plugin == NULL);
my_free(vars->dynamic_variables_ptr);
vars->dynamic_variables_ptr= NULL;