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

Function plugin_load

sql/sql_plugin.cc:1891–2000  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1889*/
1890
1891static void plugin_load(MEM_ROOT *tmp_root)
1892{
1893 TABLE_LIST tables;
1894 TABLE *table;
1895 READ_RECORD read_record_info;
1896 int error;
1897 THD *new_thd= new THD(0);
1898 bool result;
1899 unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE] =
1900 { MYSQL_AUDIT_GENERAL_CLASSMASK };
1901 DBUG_ENTER("plugin_load");
1902
1903 if (global_system_variables.log_warnings >= 9)
1904 sql_print_information("Initializing installed plugins");
1905
1906 new_thd->thread_stack= (void*) &tables; // Big stack
1907 new_thd->store_globals();
1908 new_thd->set_query_inner((char*) STRING_WITH_LEN("intern:plugin_load"),
1909 default_charset_info);
1910 new_thd->db= MYSQL_SCHEMA_NAME;
1911 bzero((char*) &new_thd->net, sizeof(new_thd->net));
1912 tables.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_PLUGIN_NAME, 0, TL_READ);
1913 tables.open_strategy= TABLE_LIST::OPEN_NORMAL;
1914
1915 result= open_and_lock_tables(new_thd, &tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT);
1916
1917 table= tables.table;
1918 if (result)
1919 {
1920 DBUG_PRINT("error",("Can't open plugin table"));
1921 if (!opt_silent_startup)
1922 sql_print_error("Could not open mysql.plugin table: \"%s\". "
1923 "Some plugins may be not loaded",
1924 new_thd->get_stmt_da()->message());
1925 goto end;
1926 }
1927
1928 if (!plugin_table_is_valid(table))
1929 goto end2;
1930
1931 if (init_read_record(&read_record_info, new_thd, table, NULL, NULL, 1, 0,
1932 FALSE))
1933 {
1934 sql_print_error("Could not initialize init_read_record; Plugins not "
1935 "loaded");
1936 goto end;
1937 }
1938 table->use_all_columns();
1939 while (!(error= read_record_info.read_record()))
1940 {
1941 DBUG_PRINT("info", ("init plugin record"));
1942 static_assert(PLUGIN_NAME == 0, "");
1943 static_assert(PLUGIN_SONAME == 1, "");
1944 DBUG_ASSERT(new_thd == table->field[0]->get_thd());
1945 DBUG_ASSERT(new_thd == table->field[1]->get_thd());
1946 DBUG_ASSERT(!(new_thd->variables.sql_mode & MODE_PAD_CHAR_TO_FULL_LENGTH));
1947 LEX_CSTRING name= table->field[0]->val_lex_string_strmake(tmp_root);
1948 LEX_CSTRING dl= table->field[1]->val_lex_string_strmake(tmp_root);

Callers 1

plugin_initFunction · 0.85

Calls 15

plugin_table_is_validFunction · 0.85
init_read_recordFunction · 0.85
plugin_addFunction · 0.85
free_rootFunction · 0.85
end_read_recordFunction · 0.85
close_mysql_tablesFunction · 0.85
set_query_innerMethod · 0.80
init_one_tableMethod · 0.80
get_stmt_daMethod · 0.80
use_all_columnsMethod · 0.80

Tested by

no test coverage detected