summaryrefslogtreecommitdiff
path: root/sql/sql_plugin.cc
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2015-03-10 08:28:51 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2015-03-12 12:17:14 +0200
commit8249dcaaebf8cd1944bd4ab7ccaa8b199e76d6f9 (patch)
tree66a9b1c65f0f220e305681fa41811886fa05d908 /sql/sql_plugin.cc
parentba3573cae8f0d269452cc6213f1a8243e455830e (diff)
downloadmariadb-git-8249dcaaebf8cd1944bd4ab7ccaa8b199e76d6f9.tar.gz
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.
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r--sql/sql_plugin.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 2fe22ea5d43..fe020d36f93 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -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;