diff options
author | Monty <monty@mariadb.org> | 2022-11-09 19:11:08 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2022-12-25 17:59:04 +0100 |
commit | ef4c23ddec95f993fd9ab9883dee29e50aeecc19 (patch) | |
tree | 155c9b192a286d7af9a892161f43ab8778313f58 | |
parent | 2d59e6ed34867e1678bc51d48c4281cc0f9240e6 (diff) | |
download | mariadb-git-ef4c23ddec95f993fd9ab9883dee29e50aeecc19.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.cc | 2 | ||||
-rw-r--r-- | sql/events.cc | 2 | ||||
-rw-r--r-- | sql/sql_acl.cc | 5 | ||||
-rw-r--r-- | sql/sql_plugin.cc | 3 | ||||
-rw-r--r-- | sql/sql_reload.cc | 2 | ||||
-rw-r--r-- | sql/sql_servers.cc | 2 | ||||
-rw-r--r-- | sql/sql_udf.cc | 2 | ||||
-rw-r--r-- | sql/tztime.cc | 2 |
8 files changed, 20 insertions, 0 deletions
diff --git a/sql/ddl_log.cc b/sql/ddl_log.cc index 67c8a8bca4f..a7920ade939 100644 --- a/sql/ddl_log.cc +++ b/sql/ddl_log.cc @@ -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(); 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 08bedd766a5..3bec971bb83 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2518,6 +2518,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 @@ -7985,6 +7987,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 02f068e9bbc..785ba2adccc 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 57f1ab872ee..4d94054541d 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, |