summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2022-11-09 19:11:08 +0200
committerMonty <monty@mariadb.org>2022-11-15 18:54:00 +0200
commit8852eff8176e6851fd3f2632fd14bfdaa59c6d4a (patch)
treecf5cad61ce0ba7cf0a7280f6d0548669b99c41a7
parentd8fe0f359269a6d11589f8324435fe6e9b7f917a (diff)
downloadmariadb-git-8852eff8176e6851fd3f2632fd14bfdaa59c6d4a.tar.gz
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 "".
-rw-r--r--sql/ddl_log.cc2
-rw-r--r--sql/events.cc2
-rw-r--r--sql/sql_acl.cc5
-rw-r--r--sql/sql_plugin.cc3
-rw-r--r--sql/sql_reload.cc2
-rw-r--r--sql/sql_servers.cc2
-rw-r--r--sql/sql_udf.cc2
-rw-r--r--sql/tztime.cc2
8 files changed, 20 insertions, 0 deletions
diff --git a/sql/ddl_log.cc b/sql/ddl_log.cc
index afcf2e6497e..2a49cef153e 100644
--- a/sql/ddl_log.cc
+++ b/sql/ddl_log.cc
@@ -2787,6 +2787,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();
diff --git a/sql/events.cc b/sql/events.cc
index 6ecdf975178..01a11461655 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -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.
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index f4295efc424..b5dad580d76 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2491,6 +2491,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
@@ -7888,6 +7890,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);
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index a47fefc13f6..f8b4948a3ac 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -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);
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index 8f0f15a982a..8104806af71 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -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))
diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc
index d52d6071e89..10a32abe716 100644
--- a/sql/sql_servers.cc
+++ b/sql/sql_servers.cc
@@ -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
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index b55bbc7ffac..26437eed3e6 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -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);
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 4b5f1d1f6d6..09c8ac91cb7 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -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,