| 1249 | } |
| 1250 | |
| 1251 | static void plugin_deinitialize(struct st_plugin_int *plugin, bool ref_check) |
| 1252 | { |
| 1253 | /* |
| 1254 | we don't want to hold the LOCK_plugin mutex as it may cause |
| 1255 | deinitialization to deadlock if plugins have worker threads |
| 1256 | with plugin locks |
| 1257 | */ |
| 1258 | mysql_mutex_assert_not_owner(&LOCK_plugin); |
| 1259 | |
| 1260 | if (plugin->plugin->status_vars) |
| 1261 | { |
| 1262 | /* |
| 1263 | historical ndb behavior caused MySQL plugins to specify |
| 1264 | status var names in full, with the plugin name prefix. |
| 1265 | this was never fixed in MySQL. |
| 1266 | MariaDB fixes that but supports MySQL style too. |
| 1267 | */ |
| 1268 | SHOW_VAR *show_vars= plugin->plugin->status_vars; |
| 1269 | SHOW_VAR tmp_array[2]= { |
| 1270 | {plugin->plugin->name, (char*)plugin->plugin->status_vars, SHOW_ARRAY}, |
| 1271 | {0, 0, SHOW_UNDEF} |
| 1272 | }; |
| 1273 | if (strncasecmp(show_vars->name, plugin->name.str, plugin->name.length)) |
| 1274 | show_vars= tmp_array; |
| 1275 | |
| 1276 | remove_status_vars(show_vars); |
| 1277 | } |
| 1278 | |
| 1279 | plugin_type_init deinit= plugin_type_deinitialize[plugin->plugin->type]; |
| 1280 | if (!deinit) |
| 1281 | deinit= (plugin_type_init)(plugin->plugin->deinit); |
| 1282 | |
| 1283 | if (deinit && deinit(plugin)) |
| 1284 | { |
| 1285 | if (THD *thd= current_thd) |
| 1286 | push_warning(thd, Sql_condition::WARN_LEVEL_WARN, |
| 1287 | WARN_PLUGIN_BUSY, ER_THD(thd, WARN_PLUGIN_BUSY)); |
| 1288 | } |
| 1289 | else |
| 1290 | plugin->state= PLUGIN_IS_UNINITIALIZED; // free to unload |
| 1291 | |
| 1292 | if (ref_check && plugin->ref_count) |
| 1293 | sql_print_error("Plugin '%s' has ref_count=%d after deinitialization.", |
| 1294 | plugin->name.str, plugin->ref_count); |
| 1295 | plugin_variables_deinit(plugin); |
| 1296 | } |
| 1297 | |
| 1298 | static void plugin_del(struct st_plugin_int *plugin, uint del_mask) |
| 1299 | { |
no test coverage detected