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

Function do_uninstall

sql/sql_plugin.cc:2377–2439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2375
2376
2377static bool do_uninstall(THD *thd, TABLE *table, const LEX_CSTRING *name)
2378{
2379 struct st_plugin_int *plugin;
2380 mysql_mutex_assert_owner(&LOCK_plugin);
2381
2382 if (!(plugin= plugin_find_internal(name, MYSQL_ANY_PLUGIN)) ||
2383 plugin->state & (PLUGIN_IS_UNINITIALIZED | PLUGIN_IS_DYING))
2384 {
2385 // maybe plugin is present in mysql.plugin; postpone the error
2386 plugin= nullptr;
2387 }
2388
2389 if (plugin)
2390 {
2391 if (!plugin->plugin_dl)
2392 {
2393 my_error(ER_PLUGIN_DELETE_BUILTIN, MYF(0));
2394 return 1;
2395 }
2396 if (plugin->load_option == PLUGIN_FORCE_PLUS_PERMANENT)
2397 {
2398 my_error(ER_PLUGIN_IS_PERMANENT, MYF(0), name->str);
2399 return 1;
2400 }
2401
2402 plugin->state= PLUGIN_IS_DELETED;
2403 if (plugin->ref_count)
2404 push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
2405 WARN_PLUGIN_BUSY, ER_THD(thd, WARN_PLUGIN_BUSY));
2406 else
2407 reap_needed= true;
2408 }
2409
2410 uchar user_key[MAX_KEY_LENGTH];
2411 table->use_all_columns();
2412 table->field[PLUGIN_NAME]->store(name->str, name->length, system_charset_info);
2413 key_copy(user_key, table->record[0], table->key_info,
2414 table->key_info->key_length);
2415 if (! table->file->ha_index_read_idx_map(table->record[0], 0, user_key,
2416 HA_WHOLE_KEY, HA_READ_KEY_EXACT))
2417 {
2418 int error;
2419 /*
2420 We do not replicate the UNINSTALL PLUGIN statement. Disable binlogging
2421 of the delete from the plugin table, so that it is not replicated in
2422 row based mode.
2423 */
2424 table->file->row_logging= 0; // No logging
2425 error= table->file->ha_delete_row(table->record[0]);
2426 if (unlikely(error))
2427 {
2428 table->file->print_error(error, MYF(0));
2429 return 1;
2430 }
2431 }
2432 else if (!plugin)
2433 {
2434 const myf MyFlags= thd->lex->if_exists() ? ME_NOTE : 0;

Callers 1

mysql_uninstall_pluginFunction · 0.85

Calls 10

plugin_find_internalFunction · 0.85
my_errorFunction · 0.85
push_warningFunction · 0.85
key_copyFunction · 0.85
use_all_columnsMethod · 0.80
ha_index_read_idx_mapMethod · 0.80
ha_delete_rowMethod · 0.80
storeMethod · 0.45
print_errorMethod · 0.45
if_existsMethod · 0.45

Tested by

no test coverage detected