1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-32537 Name threads to improve debugging experience and diagnostics.

Use SetThreadDescription/pthread_setname_np to give threads a name.
This commit is contained in:
Vladislav Vaintroub
2024-06-09 14:01:24 +02:00
parent 584fc85e21
commit 5bd0516488
14 changed files with 131 additions and 36 deletions

View File

@@ -1624,6 +1624,12 @@ typedef void (*set_thread_os_id_v1_t)(struct PSI_thread *thread);
*/
typedef struct PSI_thread* (*get_thread_v1_t)(void);
/**
Get name of the thread, according to the thread class.
The name is returns without the thread/subsystem prefix.
*/
typedef const char* (*get_thread_class_name_v1_t)(void);
/**
Assign a user name to the instrumented thread.
@param user the user name
@@ -2538,6 +2544,8 @@ struct PSI_v1
set_thread_os_id_v1_t set_thread_os_id;
/** @sa get_thread_v1_t. */
get_thread_v1_t get_thread;
/** @sa get_thread_name_v1_t. */
get_thread_class_name_v1_t get_thread_class_name;
/** @sa set_thread_user_v1_t. */
set_thread_user_v1_t set_thread_user;
/** @sa set_thread_account_v1_t. */

View File

@@ -449,6 +449,7 @@ typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread,
ulonglong id);
typedef void (*set_thread_os_id_v1_t)(struct PSI_thread *thread);
typedef struct PSI_thread* (*get_thread_v1_t)(void);
typedef const char* (*get_thread_class_name_v1_t)(void);
typedef void (*set_thread_user_v1_t)(const char *user, int user_len);
typedef void (*set_thread_account_v1_t)(const char *user, int user_len,
const char *host, int host_len);
@@ -725,6 +726,7 @@ struct PSI_v1
set_thread_THD_v1_t set_thread_THD;
set_thread_os_id_v1_t set_thread_os_id;
get_thread_v1_t get_thread;
get_thread_class_name_v1_t get_thread_class_name;
set_thread_user_v1_t set_thread_user;
set_thread_account_v1_t set_thread_account;
set_thread_db_v1_t set_thread_db;