MCPcopy Create free account
hub / github.com/MariaDB/server / plugin_shutdown

Function plugin_shutdown

sql/sql_plugin.cc:2092–2225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2090
2091
2092void plugin_shutdown(void)
2093{
2094 size_t i, count= plugin_array.elements;
2095 struct st_plugin_int **plugins, *plugin;
2096 struct st_plugin_dl **dl;
2097 DBUG_ENTER("plugin_shutdown");
2098
2099 if (initialized)
2100 {
2101 if (opt_gtid_pos_auto_plugins)
2102 {
2103 free_engine_list(opt_gtid_pos_auto_plugins);
2104 opt_gtid_pos_auto_plugins= NULL;
2105 }
2106
2107 mysql_mutex_lock(&LOCK_plugin);
2108
2109 reap_needed= true;
2110
2111 /*
2112 We want to shut down plugins in a reasonable order, this will
2113 become important when we have plugins which depend upon each other.
2114 Circular references cannot be reaped so they are forced afterwards.
2115 TODO: Have an additional step here to notify all active plugins that
2116 shutdown is requested to allow plugins to deinitialize in parallel.
2117 */
2118 while (reap_needed && (count= plugin_array.elements))
2119 {
2120 reap_plugins();
2121 for (i= 0; i < count; i++)
2122 {
2123 plugin= *dynamic_element(&plugin_array, i, struct st_plugin_int **);
2124 if (plugin->state == PLUGIN_IS_READY)
2125 {
2126 plugin->state= PLUGIN_IS_DELETED;
2127 reap_needed= true;
2128 }
2129 }
2130 if (!reap_needed)
2131 {
2132 /*
2133 release any plugin references held.
2134 */
2135 unlock_variables(NULL, &global_system_variables);
2136 unlock_variables(NULL, &max_system_variables);
2137 }
2138 }
2139
2140 plugins= (struct st_plugin_int **) my_alloca(sizeof(void*) * (count+1));
2141
2142 /*
2143 If we have any plugins which did not die cleanly, we force shutdown.
2144 Don't re-deinit() plugins that failed deinit() earlier (already dying)
2145 */
2146 for (i= 0; i < count; i++)
2147 {
2148 plugins[i]= *dynamic_element(&plugin_array, i, struct st_plugin_int **);
2149 if (plugins[i]->state == PLUGIN_IS_DYING)

Callers 2

clean_upFunction · 0.85
mainFunction · 0.85

Calls 11

free_engine_listFunction · 0.85
reap_pluginsFunction · 0.85
unlock_variablesFunction · 0.85
plugin_deinitializeFunction · 0.85
plugin_delFunction · 0.85
cleanup_variablesFunction · 0.85
my_hash_freeFunction · 0.85
delete_dynamicFunction · 0.85
free_plugin_memFunction · 0.85
free_rootFunction · 0.85
sql_print_errorFunction · 0.70

Tested by

no test coverage detected