MDEV-32537 due to Linux, restrict thread name to 15 characters, also in PS.

Rename some threads to workaround this restrictions,
e.g "rpl_parallel_thread"->"rpl_parallel",
"slave_background" -> "slave_bg" etc.
This commit is contained in:
Vladislav Vaintroub 2024-06-09 14:09:33 +02:00
parent 5bd0516488
commit 186a1afe63
21 changed files with 42 additions and 33 deletions

View file

@ -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.

View file

@ -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

View file

@ -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

View file

@ -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);

View file

@ -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

View file

@ -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);

View file

@ -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)

View file

@ -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 |

View file

@ -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 |

View file

@ -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 |

View file

@ -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 |

View file

@ -11140,7 +11140,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());
@ -11317,7 +11317,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 */

View file

@ -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

View file

@ -1226,7 +1226,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);

View file

@ -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");
}
}

View file

@ -2398,10 +2398,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);

View file

@ -611,9 +611,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 */

View file

@ -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()
{

View file

@ -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[]=

View file

@ -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);

View file

@ -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.',"