Commit 6418c24c authored by Monty's avatar Monty Committed by Sergei Petrunia

Set thd->query() for internal (startup) transactions

This helps with debugging as 'Query: ' in DBUG traces will show something
useful, for internal transactions, instead of just "".
parent 0ba47126
......@@ -2741,6 +2741,8 @@ int ddl_log_execute_recovery()
thd->thread_stack= (char*) &thd;
thd->store_globals();
thd->init(); // Needed for error messages
thd->set_query_inner((char*) STRING_WITH_LEN("intern:ddl_log_execute_recovery"),
default_charset_info);
thd->log_all_errors= (global_system_variables.log_warnings >= 3);
recovery_state.drop_table.free();
......
......@@ -906,6 +906,8 @@ Events::init(THD *thd, bool opt_noacl_or_bootstrap)
*/
thd->thread_stack= (char*) &thd;
thd->store_globals();
thd->set_query_inner((char*) STRING_WITH_LEN("intern:Events::init"),
default_charset_info);
/*
Set current time for the thread that handles events.
Current time is stored in data member start_time of THD class.
......
......@@ -2533,6 +2533,8 @@ bool acl_init(bool dont_read_acl_tables)
DBUG_RETURN(1); /* purecov: inspected */
thd->thread_stack= (char*) &thd;
thd->store_globals();
thd->set_query_inner((char*) STRING_WITH_LEN("intern:acl_init"),
default_charset_info);
/*
It is safe to call acl_reload() since acl_* arrays and hashes which
will be freed there are global static objects and thus are initialized
......@@ -8001,6 +8003,9 @@ bool grant_init()
DBUG_RETURN(1); /* purecov: deadcode */
thd->thread_stack= (char*) &thd;
thd->store_globals();
thd->set_query_inner((char*) STRING_WITH_LEN("intern:grant_init"),
default_charset_info);
return_val= grant_reload(thd);
delete thd;
DBUG_RETURN(return_val);
......
......@@ -1830,6 +1830,7 @@ static bool register_builtin(struct st_maria_plugin *plugin,
/*
called only by plugin_init()
*/
static void plugin_load(MEM_ROOT *tmp_root)
{
TABLE_LIST tables;
......@@ -1847,6 +1848,8 @@ static void plugin_load(MEM_ROOT *tmp_root)
new_thd->thread_stack= (char*) &tables;
new_thd->store_globals();
new_thd->set_query_inner((char*) STRING_WITH_LEN("intern:plugin_load"),
default_charset_info);
new_thd->db= MYSQL_SCHEMA_NAME;
bzero((char*) &new_thd->net, sizeof(new_thd->net));
tables.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_PLUGIN_NAME, 0, TL_READ);
......
......@@ -83,6 +83,8 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
{
thd->thread_stack= (char*) &tmp_thd;
thd->store_globals();
thd->set_query_inner((char*) STRING_WITH_LEN("intern:reload_acl"),
default_charset_info);
}
if (likely(thd))
......
......@@ -254,6 +254,8 @@ bool servers_init(bool dont_read_servers_table)
DBUG_RETURN(TRUE);
thd->thread_stack= (char*) &thd;
thd->store_globals();
thd->set_query_inner((char*) STRING_WITH_LEN("intern:servers_init"),
default_charset_info);
/*
It is safe to call servers_reload() since servers_* arrays and hashes which
will be freed there are global static objects and thus are initialized
......
......@@ -181,6 +181,8 @@ void udf_init()
initialized = 1;
new_thd->thread_stack= (char*) &new_thd;
new_thd->store_globals();
new_thd->set_query_inner((char*) STRING_WITH_LEN("intern:udf_init"),
default_charset_info);
new_thd->set_db(&MYSQL_SCHEMA_NAME);
tables.init_one_table(&new_thd->db, &MYSQL_FUNC_NAME, 0, TL_READ);
......
......@@ -1623,6 +1623,8 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
DBUG_RETURN(1);
thd->thread_stack= (char*) &thd;
thd->store_globals();
thd->set_query_inner((char*) STRING_WITH_LEN("intern:my_tz_init"),
default_charset_info);
/* Init all memory structures that require explicit destruction */
if (my_hash_init(key_memory_tz_storage, &tz_names, &my_charset_latin1, 20, 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment