summaryrefslogtreecommitdiff
path: root/sql/sql_plugin.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-06-22 17:17:03 +0200
committerSergei Golubchik <serg@mariadb.org>2015-06-27 09:40:55 +0200
commitbfabaf64866203b79b6ef251c89e31219ec05d9d (patch)
tree44f4c801f13945f23216ac6d12f11c74d1ee7f71 /sql/sql_plugin.cc
parentff7a1ff6d74d124e0b7f4bd8cf080ba1f894a62d (diff)
downloadmariadb-git-bfabaf64866203b79b6ef251c89e31219ec05d9d.tar.gz
Deinitialize plugins in the reverse plugin_type_initialization_order
Old code worked because plugin locking guaranteed that encryption plugin is deinitialized last. But compiled-in plugins are never locked. This fixes encryption failures on fulltest builder
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r--sql/sql_plugin.cc22
1 files changed, 13 insertions, 9 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 847669d84ea..e9547d805e2 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1252,7 +1252,7 @@ static void plugin_del(struct st_plugin_int *plugin)
static void reap_plugins(void)
{
- uint count, idx;
+ uint count;
struct st_plugin_int *plugin, **reap, **list;
mysql_mutex_assert_owner(&LOCK_plugin);
@@ -1265,14 +1265,18 @@ static void reap_plugins(void)
reap= (struct st_plugin_int **)my_alloca(sizeof(plugin)*(count+1));
*(reap++)= NULL;
- for (idx= 0; idx < count; idx++)
+ for (uint i=0; i < MYSQL_MAX_PLUGIN_TYPE_NUM; i++)
{
- plugin= *dynamic_element(&plugin_array, idx, struct st_plugin_int **);
- if (plugin->state == PLUGIN_IS_DELETED && !plugin->ref_count)
+ HASH *hash= plugin_hash + plugin_type_initialization_order[i];
+ for (uint j= 0; j < hash->records; j++)
{
- /* change the status flag to prevent reaping by another thread */
- plugin->state= PLUGIN_IS_DYING;
- *(reap++)= plugin;
+ plugin= (struct st_plugin_int *) my_hash_element(hash, j);
+ if (plugin->state == PLUGIN_IS_DELETED && !plugin->ref_count)
+ {
+ /* change the status flag to prevent reaping by another thread */
+ plugin->state= PLUGIN_IS_DYING;
+ *(reap++)= plugin;
+ }
}
}
@@ -3359,9 +3363,9 @@ bool sys_var_pluginvar::session_is_default(THD *thd)
}
case PLUGIN_VAR_DOUBLE:
return getopt_ulonglong2double(option.def_value) == *(double*)value;
- default:
- DBUG_ASSERT(0);
}
+ DBUG_ASSERT(0);
+ return 0;
}