Commit bfabaf64 authored by Sergei Golubchik's avatar Sergei Golubchik

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
parent ff7a1ff6
...@@ -1252,7 +1252,7 @@ static void plugin_del(struct st_plugin_int *plugin) ...@@ -1252,7 +1252,7 @@ static void plugin_del(struct st_plugin_int *plugin)
static void reap_plugins(void) static void reap_plugins(void)
{ {
uint count, idx; uint count;
struct st_plugin_int *plugin, **reap, **list; struct st_plugin_int *plugin, **reap, **list;
mysql_mutex_assert_owner(&LOCK_plugin); mysql_mutex_assert_owner(&LOCK_plugin);
...@@ -1265,14 +1265,18 @@ static void reap_plugins(void) ...@@ -1265,14 +1265,18 @@ static void reap_plugins(void)
reap= (struct st_plugin_int **)my_alloca(sizeof(plugin)*(count+1)); reap= (struct st_plugin_int **)my_alloca(sizeof(plugin)*(count+1));
*(reap++)= NULL; *(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 **); HASH *hash= plugin_hash + plugin_type_initialization_order[i];
if (plugin->state == PLUGIN_IS_DELETED && !plugin->ref_count) for (uint j= 0; j < hash->records; j++)
{ {
/* change the status flag to prevent reaping by another thread */ plugin= (struct st_plugin_int *) my_hash_element(hash, j);
plugin->state= PLUGIN_IS_DYING; if (plugin->state == PLUGIN_IS_DELETED && !plugin->ref_count)
*(reap++)= plugin; {
/* 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) ...@@ -3359,9 +3363,9 @@ bool sys_var_pluginvar::session_is_default(THD *thd)
} }
case PLUGIN_VAR_DOUBLE: case PLUGIN_VAR_DOUBLE:
return getopt_ulonglong2double(option.def_value) == *(double*)value; return getopt_ulonglong2double(option.def_value) == *(double*)value;
default:
DBUG_ASSERT(0);
} }
DBUG_ASSERT(0);
return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment