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

Function plugin_init

sql/sql_plugin.cc:1591–1848  ·  view source on GitHub ↗

The logic is that we first load and initialize all compiled in plugins. From there we load up the dynamic types (assuming we have not been told to skip this part). Finally we initialize everything, aka the dynamic that have yet to initialize. */

Source from the content-addressed store, hash-verified

1589 Finally we initialize everything, aka the dynamic that have yet to initialize.
1590*/
1591int plugin_init(int *argc, char **argv, int flags)
1592{
1593 size_t i;
1594 struct st_maria_plugin **builtins;
1595 struct st_maria_plugin *plugin;
1596 struct st_plugin_int tmp, *plugin_ptr, **reap, **retry_end, **retry_start;
1597 MEM_ROOT tmp_root;
1598 bool reaped_mandatory_plugin= false;
1599 bool mandatory= true;
1600 I_List_iterator<i_string> opt_plugin_load_list_iter(opt_plugin_load_list);
1601 char plugin_table_engine_name_buf[NAME_CHAR_LEN + 1];
1602 LEX_CSTRING plugin_table_engine_name= { plugin_table_engine_name_buf, 0 };
1603 LEX_CSTRING MyISAM= { STRING_WITH_LEN("MyISAM") };
1604 DBUG_ENTER("plugin_init");
1605
1606 if (initialized)
1607 DBUG_RETURN(0);
1608
1609 dlopen_count =0;
1610
1611 init_plugin_psi_keys();
1612
1613 init_alloc_root(key_memory_plugin_mem_root, &plugin_mem_root, 4096, 16384, MYF(0));
1614 init_alloc_root(key_memory_plugin_mem_root, &plugin_vars_mem_root, 4096, 32768, MYF(0));
1615 init_alloc_root(PSI_NOT_INSTRUMENTED, &tmp_root, 16384, 32768, MYF(0));
1616
1617 if (my_hash_init(key_memory_plugin_bookmark, &bookmark_hash, &my_charset_bin, 32, 0, 0,
1618 get_bookmark_hash_key, NULL, HASH_UNIQUE))
1619 goto err;
1620
1621 /*
1622 The 80 is from 2016-04-27 when we had 71 default plugins
1623 Big enough to avoid many mallocs even in future
1624 */
1625 if (my_init_dynamic_array(key_memory_mysql_plugin_dl, &plugin_dl_array,
1626 sizeof(struct st_plugin_dl *), 16, 16, MYF(0)) ||
1627 my_init_dynamic_array(key_memory_mysql_plugin, &plugin_array,
1628 sizeof(struct st_plugin_int *), 80, 32, MYF(0)))
1629 goto err;
1630
1631 for (i= 0; i < MYSQL_MAX_PLUGIN_TYPE_NUM; i++)
1632 {
1633 if (my_hash_init(key_memory_plugin_mem_root, &plugin_hash[i],
1634 Lex_ident_plugin::charset_info(),
1635 32, 0, 0,
1636 get_plugin_hash_key, NULL, HASH_UNIQUE))
1637 goto err;
1638 }
1639
1640 /* prepare debug_sync service */
1641 DBUG_ASSERT(strcmp(list_of_services[1].name, "debug_sync_service") == 0);
1642 list_of_services[1].service= *(void**)&debug_sync_C_callback_ptr;
1643
1644 /* prepare encryption_keys service */
1645 finalize_encryption_plugin(0);
1646
1647 mysql_mutex_lock(&LOCK_plugin);
1648

Callers 2

mysqld.ccFile · 0.70
encryption_plugin_initFunction · 0.50

Calls 15

init_plugin_psi_keysFunction · 0.85
init_alloc_rootFunction · 0.85
Lex_cstring_strlenClass · 0.85
register_builtinFunction · 0.85
plugin_find_internalFunction · 0.85
plugin_initializeFunction · 0.85
intern_plugin_lockFunction · 0.85
plugin_load_listFunction · 0.85
build_table_filenameFunction · 0.85
dd_frm_typeFunction · 0.85
my_hash_elementFunction · 0.85

Tested by

no test coverage detected