Skip to content

Commit 186a1af

Browse files
committed
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.
1 parent 5bd0516 commit 186a1af

21 files changed

+42
-33
lines changed

mysql-test/suite/perfschema/r/dml_replication_applier_status_by_worker.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ from information_schema.columns
3131
where table_schema='performance_schema' and table_name='replication_applier_status_by_worker';
3232
column_name column_comment
3333
CHANNEL_NAME Name of replication channel through which the transaction is received.
34-
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.
34+
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.
3535
SERVICE_STATE Whether or not the thread is running.
3636
LAST_SEEN_TRANSACTION Last GTID executed by worker
3737
LAST_ERROR_NUMBER Last Error that occurred on a particular worker.

mysql-test/suite/perfschema/r/table_schema.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ def performance_schema replication_applier_status_by_coordinator LAST_ERROR_TIME
868868
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
869869
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
870870
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
871-
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
871+
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
872872
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
873873
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
874874
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

mysql-test/suite/perfschema/r/threads_innodb.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ FROM performance_schema.threads
55
WHERE name LIKE 'thread/innodb/%'
66
GROUP BY name;
77
name type processlist_user processlist_host processlist_db processlist_command processlist_time processlist_state processlist_info parent_thread_id role instrumented
8-
thread/innodb/page_cleaner_threadBACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL NULL YES
9-
thread/innodb/thread_pool_threadBACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL NULL YES
8+
thread/innodb/ib_tpool_workerBACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL NULL YES
9+
thread/innodb/page_cleanerBACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL NULL YES

mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_worker.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ source include/assert.inc;
6868
# the thread.
6969
let $thread_name= `select name from performance_schema.threads where thread_id= (select Thread_Id from performance_schema.replication_applier_status_by_worker)`;
7070
let $assert_text= thread_name should should indicate worker thread.;
71-
let $assert_cond= "$thread_name" = "thread/sql/rpl_parallel_thread";
71+
let $assert_cond= "$thread_name" = "thread/sql/rpl_parallel";
7272
source include/assert.inc;
7373

7474
let $ps_value= query_get_value(select Service_State from performance_schema.replication_applier_status_by_worker, Service_State, 1);

mysql-test/suite/sysschema/r/pr_ps_setup_show_enabled.result

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ UPDATE performance_schema.threads
1414
SET INSTRUMENTED = 'NO'
1515
WHERE NAME LIKE 'thread/innodb/srv\_%'
1616
OR NAME LIKE '%con\_%'
17-
OR NAME LIKE '%signal_handler%';
17+
OR NAME LIKE '%signal_handler%'
18+
OR NAME LIKE '%worker%';
1819
CALL sys.ps_setup_show_enabled(FALSE, FALSE);
1920
performance_schema_enabled
2021
1
@@ -203,8 +204,8 @@ global_instrumentation
203204
statements_digest
204205
thread_instrumentation
205206
enabled_threads thread_type
206-
aria/checkpoint_backgroundBACKGROUND
207-
innodb/page_cleaner_threadBACKGROUND
207+
aria/checkpoint_bgBACKGROUND
208+
innodb/page_cleanerBACKGROUND
208209
mysys/statement_timer BACKGROUND
209210
root@localhost FOREGROUND
210211
sql/main BACKGROUND
@@ -234,8 +235,8 @@ global_instrumentation
234235
statements_digest
235236
thread_instrumentation
236237
enabled_threads thread_type
237-
aria/checkpoint_backgroundBACKGROUND
238-
innodb/page_cleaner_threadBACKGROUND
238+
aria/checkpoint_bgBACKGROUND
239+
innodb/page_cleanerBACKGROUND
239240
mysys/statement_timer BACKGROUND
240241
root@localhost FOREGROUND
241242
sql/main BACKGROUND

mysql-test/suite/sysschema/t/pr_ps_setup_show_enabled.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ UPDATE performance_schema.threads
2626
SET INSTRUMENTED = 'NO'
2727
WHERE NAME LIKE 'thread/innodb/srv\_%'
2828
OR NAME LIKE '%con\_%'
29-
OR NAME LIKE '%signal_handler%';
29+
OR NAME LIKE '%signal_handler%'
30+
OR NAME LIKE '%worker%';
3031

3132
# Show limited info (no thread or instrument info)
3233
CALL sys.ps_setup_show_enabled(FALSE, FALSE);

mysys/my_thread_name.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,17 @@ static void dbug_verify_thread_name(const char *name)
5353
}
5454
if (psi_name && strcmp(psi_name, name))
5555
{
56-
fprintf(stderr, "my_thread_set_name() mismatch: PSI name '%s' != '%s'\n",
56+
fprintf(stderr, "ERROR: my_thread_set_name() mismatch: PSI name '%s' != '%s'\n",
5757
psi_name, name);
5858
abort();
5959
}
60+
size_t len= strlen(name);
61+
if (len > 15)
62+
{
63+
/* Linux can' handle "long" (> 15 chars) names */
64+
fprintf(stderr, "ERROR: my_thread_set_name() name too long: '%s'\n", name);
65+
abort();
66+
}
6067
}
6168
#else
6269
#define dbug_verify_thread_name(name) do {} while (0)

scripts/sys_schema/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ mysql> select * from io_by_thread_by_latency;
680680
+---------------------+-------+---------------+-------------+-------------+-------------+-----------+----------------+
681681
| root@localhost | 11580 | 18.01 s | 429.78 ns | 1.12 ms | 181.07 ms | 25 | 6 |
682682
| main | 1358 | 1.31 s | 475.02 ns | 2.27 ms | 350.70 ms | 1 | NULL |
683-
| page_cleaner_thread | 654 | 147.44 ms | 588.12 ns | 225.44 us | 46.41 ms | 18 | NULL |
683+
| page_cleaner | 654 | 147.44 ms | 588.12 ns | 225.44 us | 46.41 ms | 18 | NULL |
684684
| io_write_thread | 131 | 107.75 ms | 8.60 us | 822.55 us | 27.69 ms | 8 | NULL |
685685
| io_write_thread | 46 | 47.07 ms | 10.64 us | 1.02 ms | 16.90 ms | 9 | NULL |
686686
| 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);
49044904
| innodb/io_read_thread | BACKGROUND |
49054905
| innodb/io_write_thread | BACKGROUND |
49064906
| innodb/io_write_thread | BACKGROUND |
4907-
| innodb/page_cleaner_thread | BACKGROUND |
4907+
| innodb/page_cleaner | BACKGROUND |
49084908
| innodb/srv_lock_timeout_thread | BACKGROUND |
49094909
| innodb/srv_error_monitor_thread | BACKGROUND |
49104910
| innodb/srv_monitor_thread | BACKGROUND |

scripts/sys_schema/procedures/ps_setup_show_enabled.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ CREATE DEFINER='mariadb.sys'@'localhost' PROCEDURE ps_setup_show_enabled (
8686
| innodb/io_read_thread | BACKGROUND |
8787
| innodb/io_write_thread | BACKGROUND |
8888
| innodb/io_write_thread | BACKGROUND |
89-
| innodb/page_cleaner_thread | BACKGROUND |
89+
| innodb/page_cleaner | BACKGROUND |
9090
| innodb/srv_lock_timeout_thread | BACKGROUND |
9191
| innodb/srv_error_monitor_thread | BACKGROUND |
9292
| innodb/srv_monitor_thread | BACKGROUND |

scripts/sys_schema/views/p_s/io_by_thread_by_latency.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
-- +---------------------+-------+---------------+-------------+-------------+-------------+-----------+----------------+
2525
-- | root@localhost | 11580 | 18.01 s | 429.78 ns | 1.12 ms | 181.07 ms | 25 | 6 |
2626
-- | main | 1358 | 1.31 s | 475.02 ns | 2.27 ms | 350.70 ms | 1 | NULL |
27-
-- | page_cleaner_thread | 654 | 147.44 ms | 588.12 ns | 225.44 us | 46.41 ms | 18 | NULL |
27+
-- | page_cleaner | 654 | 147.44 ms | 588.12 ns | 225.44 us | 46.41 ms | 18 | NULL |
2828
-- | io_write_thread | 131 | 107.75 ms | 8.60 us | 822.55 us | 27.69 ms | 8 | NULL |
2929
-- | io_write_thread | 46 | 47.07 ms | 10.64 us | 1.02 ms | 16.90 ms | 9 | NULL |
3030
-- | io_write_thread | 71 | 46.99 ms | 9.11 us | 661.81 us | 17.04 ms | 11 | NULL |

0 commit comments

Comments
 (0)