diff --git a/mysql-test/suite/perfschema/r/dml_replication_applier_status_by_worker.result b/mysql-test/suite/perfschema/r/dml_replication_applier_status_by_worker.result index e61e5a2d0b4..b5e6851a6b1 100644 --- a/mysql-test/suite/perfschema/r/dml_replication_applier_status_by_worker.result +++ b/mysql-test/suite/perfschema/r/dml_replication_applier_status_by_worker.result @@ -31,7 +31,7 @@ from information_schema.columns where table_schema='performance_schema' and table_name='replication_applier_status_by_worker'; column_name column_comment CHANNEL_NAME Name of replication channel through which the transaction is received. -THREAD_ID Thread_Id as displayed in the performance_schema.threads table for thread with name 'thread/sql/rpl_parallel_thread'. THREAD_ID will be NULL when worker threads are stopped due to error/force stop. +THREAD_ID Thread_Id as displayed in the performance_schema.threads table for thread with name 'thread/sql/rpl_parallel'. THREAD_ID will be NULL when worker threads are stopped due to error/force stop. SERVICE_STATE Whether or not the thread is running. LAST_SEEN_TRANSACTION Last GTID executed by worker LAST_ERROR_NUMBER Last Error that occurred on a particular worker. diff --git a/mysql-test/suite/perfschema/r/table_schema.result b/mysql-test/suite/perfschema/r/table_schema.result index 96d2dfbe156..31f7f2669f5 100644 --- a/mysql-test/suite/perfschema/r/table_schema.result +++ b/mysql-test/suite/perfschema/r/table_schema.result @@ -868,7 +868,7 @@ def performance_schema replication_applier_status_by_coordinator LAST_ERROR_TIME def performance_schema replication_applier_status_by_coordinator LAST_SEEN_TRANSACTION 7 NULL NO char 57 171 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(57) select,insert,update,references The transaction the worker has last seen. NEVER NULL NO NO def performance_schema replication_applier_status_by_coordinator LAST_TRANS_RETRY_COUNT 8 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references Total number of retries attempted by last transaction. NEVER NULL NO NO def performance_schema replication_applier_status_by_worker CHANNEL_NAME 1 NULL NO varchar 256 768 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(256) select,insert,update,references Name of replication channel through which the transaction is received. NEVER NULL NO NO -def performance_schema replication_applier_status_by_worker THREAD_ID 2 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references Thread_Id as displayed in the performance_schema.threads table for thread with name 'thread/sql/rpl_parallel_thread'. THREAD_ID will be NULL when worker threads are stopped due to error/force stop. NEVER NULL NO NO +def performance_schema replication_applier_status_by_worker THREAD_ID 2 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references Thread_Id as displayed in the performance_schema.threads table for thread with name 'thread/sql/rpl_parallel'. THREAD_ID will be NULL when worker threads are stopped due to error/force stop. NEVER NULL NO NO def performance_schema replication_applier_status_by_worker SERVICE_STATE 3 NULL NO enum 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci enum('ON','OFF') select,insert,update,references Whether or not the thread is running. NEVER NULL NO NO def performance_schema replication_applier_status_by_worker LAST_SEEN_TRANSACTION 4 NULL NO char 57 171 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(57) select,insert,update,references Last GTID executed by worker NEVER NULL NO NO def performance_schema replication_applier_status_by_worker LAST_ERROR_NUMBER 5 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references Last Error that occurred on a particular worker. NEVER NULL NO NO diff --git a/mysql-test/suite/perfschema/r/threads_innodb.result b/mysql-test/suite/perfschema/r/threads_innodb.result index d79420f6fb5..8b9512d161c 100644 --- a/mysql-test/suite/perfschema/r/threads_innodb.result +++ b/mysql-test/suite/perfschema/r/threads_innodb.result @@ -5,5 +5,5 @@ FROM performance_schema.threads WHERE name LIKE 'thread/innodb/%' GROUP BY name; name type processlist_user processlist_host processlist_db processlist_command processlist_time processlist_state processlist_info parent_thread_id role instrumented -thread/innodb/page_cleaner_thread BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL NULL YES -thread/innodb/thread_pool_thread BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL NULL YES +thread/innodb/ib_tpool_worker BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL NULL YES +thread/innodb/page_cleaner BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL NULL YES diff --git a/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_worker.test b/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_worker.test index 72559fc4090..4539e395591 100644 --- a/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_worker.test +++ b/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_worker.test @@ -68,7 +68,7 @@ source include/assert.inc; # the thread. let $thread_name= `select name from performance_schema.threads where thread_id= (select Thread_Id from performance_schema.replication_applier_status_by_worker)`; let $assert_text= thread_name should should indicate worker thread.; -let $assert_cond= "$thread_name" = "thread/sql/rpl_parallel_thread"; +let $assert_cond= "$thread_name" = "thread/sql/rpl_parallel"; source include/assert.inc; let $ps_value= query_get_value(select Service_State from performance_schema.replication_applier_status_by_worker, Service_State, 1); diff --git a/mysql-test/suite/sysschema/r/pr_ps_setup_show_enabled.result b/mysql-test/suite/sysschema/r/pr_ps_setup_show_enabled.result index 261ccb191ed..92b11ddf31f 100644 --- a/mysql-test/suite/sysschema/r/pr_ps_setup_show_enabled.result +++ b/mysql-test/suite/sysschema/r/pr_ps_setup_show_enabled.result @@ -14,7 +14,8 @@ UPDATE performance_schema.threads SET INSTRUMENTED = 'NO' WHERE NAME LIKE 'thread/innodb/srv\_%' OR NAME LIKE '%con\_%' - OR NAME LIKE '%signal_handler%'; + OR NAME LIKE '%signal_handler%' + OR NAME LIKE '%worker%'; CALL sys.ps_setup_show_enabled(FALSE, FALSE); performance_schema_enabled 1 @@ -203,8 +204,8 @@ global_instrumentation statements_digest thread_instrumentation enabled_threads thread_type -aria/checkpoint_background BACKGROUND -innodb/page_cleaner_thread BACKGROUND +aria/checkpoint_bg BACKGROUND +innodb/page_cleaner BACKGROUND mysys/statement_timer BACKGROUND root@localhost FOREGROUND sql/main BACKGROUND @@ -234,8 +235,8 @@ global_instrumentation statements_digest thread_instrumentation enabled_threads thread_type -aria/checkpoint_background BACKGROUND -innodb/page_cleaner_thread BACKGROUND +aria/checkpoint_bg BACKGROUND +innodb/page_cleaner BACKGROUND mysys/statement_timer BACKGROUND root@localhost FOREGROUND sql/main BACKGROUND diff --git a/mysql-test/suite/sysschema/t/pr_ps_setup_show_enabled.test b/mysql-test/suite/sysschema/t/pr_ps_setup_show_enabled.test index b8ef622b2e9..acb029522a3 100644 --- a/mysql-test/suite/sysschema/t/pr_ps_setup_show_enabled.test +++ b/mysql-test/suite/sysschema/t/pr_ps_setup_show_enabled.test @@ -26,7 +26,8 @@ UPDATE performance_schema.threads SET INSTRUMENTED = 'NO' WHERE NAME LIKE 'thread/innodb/srv\_%' OR NAME LIKE '%con\_%' - OR NAME LIKE '%signal_handler%'; + OR NAME LIKE '%signal_handler%' + OR NAME LIKE '%worker%'; # Show limited info (no thread or instrument info) CALL sys.ps_setup_show_enabled(FALSE, FALSE); diff --git a/mysys/my_thread_name.cc b/mysys/my_thread_name.cc index d52d7360158..9f32dae269a 100644 --- a/mysys/my_thread_name.cc +++ b/mysys/my_thread_name.cc @@ -53,10 +53,17 @@ static void dbug_verify_thread_name(const char *name) } if (psi_name && strcmp(psi_name, name)) { - fprintf(stderr, "my_thread_set_name() mismatch: PSI name '%s' != '%s'\n", + fprintf(stderr, "ERROR: my_thread_set_name() mismatch: PSI name '%s' != '%s'\n", psi_name, name); abort(); } + size_t len= strlen(name); + if (len > 15) + { + /* Linux can' handle "long" (> 15 chars) names */ + fprintf(stderr, "ERROR: my_thread_set_name() name too long: '%s'\n", name); + abort(); + } } #else #define dbug_verify_thread_name(name) do {} while (0) diff --git a/scripts/sys_schema/README.md b/scripts/sys_schema/README.md index e06f78e1510..aff0949c402 100644 --- a/scripts/sys_schema/README.md +++ b/scripts/sys_schema/README.md @@ -680,7 +680,7 @@ mysql> select * from io_by_thread_by_latency; +---------------------+-------+---------------+-------------+-------------+-------------+-----------+----------------+ | root@localhost | 11580 | 18.01 s | 429.78 ns | 1.12 ms | 181.07 ms | 25 | 6 | | main | 1358 | 1.31 s | 475.02 ns | 2.27 ms | 350.70 ms | 1 | NULL | -| page_cleaner_thread | 654 | 147.44 ms | 588.12 ns | 225.44 us | 46.41 ms | 18 | NULL | +| page_cleaner | 654 | 147.44 ms | 588.12 ns | 225.44 us | 46.41 ms | 18 | NULL | | io_write_thread | 131 | 107.75 ms | 8.60 us | 822.55 us | 27.69 ms | 8 | NULL | | io_write_thread | 46 | 47.07 ms | 10.64 us | 1.02 ms | 16.90 ms | 9 | NULL | | io_write_thread | 71 | 46.99 ms | 9.11 us | 661.81 us | 17.04 ms | 11 | NULL | @@ -4904,7 +4904,7 @@ mysql> CALL sys.ps_setup_show_enabled(TRUE, TRUE); | innodb/io_read_thread | BACKGROUND | | innodb/io_write_thread | BACKGROUND | | innodb/io_write_thread | BACKGROUND | -| innodb/page_cleaner_thread | BACKGROUND | +| innodb/page_cleaner | BACKGROUND | | innodb/srv_lock_timeout_thread | BACKGROUND | | innodb/srv_error_monitor_thread | BACKGROUND | | innodb/srv_monitor_thread | BACKGROUND | diff --git a/scripts/sys_schema/procedures/ps_setup_show_enabled.sql b/scripts/sys_schema/procedures/ps_setup_show_enabled.sql index 8e7c0506677..6be0073c475 100644 --- a/scripts/sys_schema/procedures/ps_setup_show_enabled.sql +++ b/scripts/sys_schema/procedures/ps_setup_show_enabled.sql @@ -86,7 +86,7 @@ CREATE DEFINER='mariadb.sys'@'localhost' PROCEDURE ps_setup_show_enabled ( | innodb/io_read_thread | BACKGROUND | | innodb/io_write_thread | BACKGROUND | | innodb/io_write_thread | BACKGROUND | - | innodb/page_cleaner_thread | BACKGROUND | + | innodb/page_cleaner | BACKGROUND | | innodb/srv_lock_timeout_thread | BACKGROUND | | innodb/srv_error_monitor_thread | BACKGROUND | | innodb/srv_monitor_thread | BACKGROUND | diff --git a/scripts/sys_schema/views/p_s/io_by_thread_by_latency.sql b/scripts/sys_schema/views/p_s/io_by_thread_by_latency.sql index a4e87dd7ace..074a2499de4 100644 --- a/scripts/sys_schema/views/p_s/io_by_thread_by_latency.sql +++ b/scripts/sys_schema/views/p_s/io_by_thread_by_latency.sql @@ -24,7 +24,7 @@ -- +---------------------+-------+---------------+-------------+-------------+-------------+-----------+----------------+ -- | root@localhost | 11580 | 18.01 s | 429.78 ns | 1.12 ms | 181.07 ms | 25 | 6 | -- | main | 1358 | 1.31 s | 475.02 ns | 2.27 ms | 350.70 ms | 1 | NULL | --- | page_cleaner_thread | 654 | 147.44 ms | 588.12 ns | 225.44 us | 46.41 ms | 18 | NULL | +-- | page_cleaner | 654 | 147.44 ms | 588.12 ns | 225.44 us | 46.41 ms | 18 | NULL | -- | io_write_thread | 131 | 107.75 ms | 8.60 us | 822.55 us | 27.69 ms | 8 | NULL | -- | io_write_thread | 46 | 47.07 ms | 10.64 us | 1.02 ms | 16.90 ms | 9 | NULL | -- | io_write_thread | 71 | 46.99 ms | 9.11 us | 661.81 us | 17.04 ms | 11 | NULL | diff --git a/scripts/sys_schema/views/p_s/x_io_by_thread_by_latency.sql b/scripts/sys_schema/views/p_s/x_io_by_thread_by_latency.sql index 5e02f528f3d..e85c27bc145 100644 --- a/scripts/sys_schema/views/p_s/x_io_by_thread_by_latency.sql +++ b/scripts/sys_schema/views/p_s/x_io_by_thread_by_latency.sql @@ -24,7 +24,7 @@ -- +---------------------+-------+----------------+-------------+-----------------+--------------+-----------+----------------+ -- | root@localhost | 11587 | 18007539905680 | 429780 | 1120831681.6667 | 181065665560 | 25 | 6 | -- | main | 1358 | 1309001741320 | 475020 | 2269581997.8000 | 350700491310 | 1 | NULL | --- | page_cleaner_thread | 654 | 147435455960 | 588120 | 225436198.0000 | 46412043990 | 18 | NULL | +-- | page_cleaner | 654 | 147435455960 | 588120 | 225436198.0000 | 46412043990 | 18 | NULL | -- | io_write_thread | 131 | 107754483070 | 8603140 | 822553303.0000 | 27691592500 | 8 | NULL | -- | io_write_thread | 46 | 47074926860 | 10642710 | 1023367631.0000 | 16899745070 | 9 | NULL | -- | io_write_thread | 71 | 46988801210 | 9108320 | 661814075.0000 | 17042760020 | 11 | NULL | diff --git a/sql/log.cc b/sql/log.cc index 24950b2d9a4..1cc0fa77f08 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -11129,7 +11129,7 @@ binlog_background_thread(void *arg __attribute__((unused))) Binlog_background_job **freelist_endptr= &freelist; THD *thd; my_thread_init(); - my_thread_set_name("binlog_background"); + my_thread_set_name("binlog_bg"); DBUG_ENTER("binlog_background_thread"); thd= new THD(next_thread_id()); @@ -11306,7 +11306,7 @@ static PSI_thread_key key_thread_binlog; static PSI_thread_info all_binlog_threads[]= { - { &key_thread_binlog, "binlog_background", PSI_FLAG_GLOBAL}, + { &key_thread_binlog, "binlog_bg", PSI_FLAG_GLOBAL}, }; #endif /* HAVE_PSI_INTERFACE */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 475947492a2..5aa25c16a20 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1183,9 +1183,9 @@ static PSI_thread_info all_server_threads[]= { &key_thread_main, "main", PSI_FLAG_GLOBAL}, { &key_thread_one_connection, "one_connection", 0}, { &key_thread_signal_hand, "signal_handler", PSI_FLAG_GLOBAL}, - { &key_thread_slave_background, "slave_background", PSI_FLAG_GLOBAL}, + { &key_thread_slave_background, "slave_bg", PSI_FLAG_GLOBAL}, { &key_thread_ack_receiver, "Ack_receiver", PSI_FLAG_GLOBAL}, - { &key_rpl_parallel_thread, "rpl_parallel_thread", 0} + { &key_rpl_parallel_thread, "rpl_parallel", 0} }; #ifdef HAVE_MMAP diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index 2c0303a2bbc..51ca3b183ec 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -1223,7 +1223,7 @@ handle_rpl_parallel_thread(void *arg) struct rpl_parallel_thread *rpt= (struct rpl_parallel_thread *)arg; my_thread_init(); - my_thread_set_name("rpl_parallel_thread"); + my_thread_set_name("rpl_parallel"); thd = new THD(next_thread_id()); thd->thread_stack = (char*)&thd; server_threads.insert(thd); diff --git a/sql/threadpool_win.cc b/sql/threadpool_win.cc index 158185c6662..2a920ee7d00 100644 --- a/sql/threadpool_win.cc +++ b/sql/threadpool_win.cc @@ -244,7 +244,7 @@ void tp_win_callback_prolog() thread_created++; tp_stats.num_worker_threads++; my_thread_init(); - my_thread_set_name("connection_worker"); + my_thread_set_name("worker_thread"); } } diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index c8d4a476fcd..8046fd80150 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -2362,10 +2362,10 @@ pools. As of now we'll have only one coordinator. */ static void buf_flush_page_cleaner() { my_thread_init(); - my_thread_set_name("ib_page_cleaner"); #ifdef UNIV_PFS_THREAD pfs_register_thread(page_cleaner_thread_key); #endif /* UNIV_PFS_THREAD */ + my_thread_set_name("page_cleaner"); ut_ad(!srv_read_only_mode); ut_ad(buf_page_cleaner_is_active); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 67aac36879b..f83120f4076 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -612,9 +612,9 @@ static PSI_rwlock_info all_innodb_rwlocks[] = performance schema instrumented if "UNIV_PFS_THREAD" is defined */ static PSI_thread_info all_innodb_threads[] = { - PSI_KEY(page_cleaner_thread), - PSI_KEY(trx_rollback_clean_thread), - PSI_KEY(thread_pool_thread) + {&page_cleaner_thread_key, "page_cleaner", 0}, + {&trx_rollback_clean_thread_key, "trx_rollback", 0}, + {&thread_pool_thread_key,"ib_tpool_worker", 0} }; # endif /* UNIV_PFS_THREAD */ diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 5a647abcd47..ee1524debc9 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -530,8 +530,8 @@ srv_print_master_thread_info( static void thread_pool_thread_init() { my_thread_init(); - my_thread_set_name("ib_tpool_worker"); pfs_register_thread(thread_pool_thread_key); + my_thread_set_name("ib_tpool_worker"); } static void thread_pool_thread_end() { diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 703a2d082ca..6c86d32f188 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -346,9 +346,9 @@ static PSI_rwlock_info all_aria_rwlocks[]= static PSI_thread_info all_aria_threads[]= { - { &key_thread_checkpoint, "checkpoint_background", PSI_FLAG_GLOBAL}, - { &key_thread_soft_sync, "soft_sync_background", PSI_FLAG_GLOBAL}, - { &key_thread_find_all_keys, "thr_find_all_keys", 0} + { &key_thread_checkpoint, "checkpoint_bg", PSI_FLAG_GLOBAL}, + { &key_thread_soft_sync, "soft_sync_bg", PSI_FLAG_GLOBAL}, + { &key_thread_find_all_keys, "find_all_keys", 0} }; static PSI_file_info all_aria_files[]= diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c index 14325a50296..c387f808785 100644 --- a/storage/maria/ma_checkpoint.c +++ b/storage/maria/ma_checkpoint.c @@ -577,7 +577,7 @@ pthread_handler_t ma_checkpoint_background(void *arg) PAGECACHE_FILE *UNINIT_VAR(kfile); /**< index file currently being flushed */ my_thread_init(); - my_thread_set_name("checkpoint_background"); + my_thread_set_name("checkpoint_bg"); DBUG_PRINT("info",("Maria background checkpoint thread starts")); DBUG_ASSERT(interval > 0); diff --git a/storage/perfschema/table_replication_applier_status_by_worker.cc b/storage/perfschema/table_replication_applier_status_by_worker.cc index 94aa305af02..f990227638b 100644 --- a/storage/perfschema/table_replication_applier_status_by_worker.cc +++ b/storage/perfschema/table_replication_applier_status_by_worker.cc @@ -58,7 +58,7 @@ table_replication_applier_status_by_worker::m_share= &m_table_lock, { C_STRING_WITH_LEN("CREATE TABLE replication_applier_status_by_worker(" "CHANNEL_NAME VARCHAR(256) collate utf8_general_ci not null comment 'Name of replication channel through which the transaction is received.'," - "THREAD_ID BIGINT UNSIGNED comment 'Thread_Id as displayed in the performance_schema.threads table for thread with name ''thread/sql/rpl_parallel_thread''. THREAD_ID will be NULL when worker threads are stopped due to error/force stop.'," + "THREAD_ID BIGINT UNSIGNED comment 'Thread_Id as displayed in the performance_schema.threads table for thread with name ''thread/sql/rpl_parallel''. THREAD_ID will be NULL when worker threads are stopped due to error/force stop.'," "SERVICE_STATE ENUM('ON','OFF') not null comment 'Whether or not the thread is running.'," "LAST_SEEN_TRANSACTION CHAR(57) not null comment 'Last GTID executed by worker'," "LAST_ERROR_NUMBER INTEGER not null comment 'Last Error that occurred on a particular worker.',"