Skip to content

Commit 1216244

Browse files
committed
MDEV-11703 InnoDB background threads show up in the processlist
give threads more descriptive names
1 parent 98a5ee9 commit 1216244

File tree

8 files changed

+21
-19
lines changed

8 files changed

+21
-19
lines changed

mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ SELECT COUNT(DISTINCT f1) FROM t1;
2020
COUNT(DISTINCT f1)
2121
30000
2222
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE
23-
USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
23+
USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
2424
COUNT(*)
2525
5
2626
connection default;

mysql-test/suite/galera/r/galera_var_slave_threads.result

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SELECT @@wsrep_slave_threads = 1;
1313
1
1414
SET GLOBAL wsrep_slave_threads = 1;
1515
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
16-
WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
16+
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
1717
COUNT(*)
1818
2
1919
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
@@ -27,7 +27,7 @@ SELECT COUNT(*) FROM t1;
2727
COUNT(*)
2828
1
2929
SELECT COUNT(*) - @@wsrep_slave_threads FROM INFORMATION_SCHEMA.PROCESSLIST
30-
WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
30+
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
3131
COUNT(*) - @@wsrep_slave_threads
3232
1
3333
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
@@ -104,7 +104,7 @@ SELECT COUNT(*) FROM t2;
104104
COUNT(*)
105105
64
106106
SELECT COUNT(*) - @@wsrep_slave_threads FROM INFORMATION_SCHEMA.PROCESSLIST
107-
WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
107+
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
108108
COUNT(*) - @@wsrep_slave_threads
109109
1
110110
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';

mysql-test/suite/galera/t/galera_kill_applier.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
--connection node_1
99

10-
--let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND NOT STATE <=> 'wsrep aborter idle' AND NOT STATE <=> 'InnoDB background thread' LIMIT 1`
10+
--let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND NOT STATE <=> 'wsrep aborter idle' AND STATE NOT LIKE 'InnoDB%' LIMIT 1`
1111

1212
--disable_query_log
1313
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR

mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ SET GLOBAL wsrep_slave_threads = 4;
4040
SELECT COUNT(*) FROM t1;
4141
SELECT COUNT(DISTINCT f1) FROM t1;
4242
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE
43-
USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
43+
USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
4444

4545
--disable_query_log
4646
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;

mysql-test/suite/galera/t/galera_var_slave_threads.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ SELECT @@wsrep_slave_threads = 1;
2323
SET GLOBAL wsrep_slave_threads = 1;
2424
# There is a separate wsrep_aborter thread at all times
2525
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
26-
WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
26+
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
2727
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
2828

2929
#
@@ -40,7 +40,7 @@ INSERT INTO t1 VALUES (1);
4040
SELECT COUNT(*) FROM t1;
4141

4242
SELECT COUNT(*) - @@wsrep_slave_threads FROM INFORMATION_SCHEMA.PROCESSLIST
43-
WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
43+
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
4444
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
4545

4646
#
@@ -63,7 +63,7 @@ while ($count)
6363
SELECT COUNT(*) FROM t2;
6464

6565
SELECT COUNT(*) - @@wsrep_slave_threads FROM INFORMATION_SCHEMA.PROCESSLIST
66-
WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
66+
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
6767
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
6868

6969

storage/innobase/handler/ha_innodb.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ thd_destructor_proxy(void *)
326326

327327
st_my_thread_var *myvar= _my_thread_var();
328328
THD *thd= create_thd();
329-
thd_proc_info(thd, "InnoDB background thread");
329+
thd_proc_info(thd, "InnoDB shutdown handler");
330330

331331
myvar->current_mutex = &thd_destructor_mutex;
332332
myvar->current_cond = &thd_destructor_cond;
@@ -1708,14 +1708,15 @@ static MYSQL_THDVAR_BOOL(background_thread,
17081708
"Internal (not user visible) flag to mark "
17091709
"background purge threads", NULL, NULL, 0);
17101710

1711-
/** Create a MYSQL_THD for background purge threads and mark it as such.
1712-
@returns new MYSQL_THD */
1711+
/** Create a MYSQL_THD for a background thread and mark it as such.
1712+
@param name thread info for SHOW PROCESSLIST
1713+
@return new MYSQL_THD */
17131714
MYSQL_THD
1714-
innobase_create_background_thd()
1715+
innobase_create_background_thd(const char* name)
17151716
/*============================*/
17161717
{
17171718
MYSQL_THD thd= create_thd();
1718-
thd_proc_info(thd, "InnoDB background thread");
1719+
thd_proc_info(thd, name);
17191720
THDVAR(thd, background_thread) = true;
17201721
return thd;
17211722
}

storage/innobase/include/ha_prototypes.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,10 +610,11 @@ buffer pool size.
610610
void
611611
innodb_set_buf_pool_size(ulonglong buf_pool_size);
612612

613-
/** Create a MYSQL_THD for background purge threads and mark it as such.
614-
@returns new MYSQL_THD */
613+
/** Create a MYSQL_THD for a background thread and mark it as such.
614+
@param name thread info for SHOW PROCESSLIST
615+
@return new MYSQL_THD */
615616
MYSQL_THD
616-
innobase_create_background_thd();
617+
innobase_create_background_thd(const char* name);
617618

618619
/** Destroy a background purge thread THD.
619620
@param[in] thd MYSQL_THD to destroy */

storage/innobase/srv/srv0srv.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,7 +2681,7 @@ DECLARE_THREAD(srv_worker_thread)(
26812681
ut_ad(!srv_read_only_mode);
26822682
ut_a(srv_force_recovery < SRV_FORCE_NO_BACKGROUND);
26832683
my_thread_init();
2684-
THD* thd = innobase_create_background_thd();
2684+
THD* thd = innobase_create_background_thd("InnoDB purge worker");
26852685

26862686
#ifdef UNIV_DEBUG_THREAD_CREATION
26872687
ib::info() << "Worker thread starting, id "
@@ -2910,7 +2910,7 @@ DECLARE_THREAD(srv_purge_coordinator_thread)(
29102910
required by os_thread_create */
29112911
{
29122912
my_thread_init();
2913-
THD* thd = innobase_create_background_thd();
2913+
THD* thd = innobase_create_background_thd("InnoDB purge coordinator");
29142914
srv_slot_t* slot;
29152915
ulint n_total_purged = ULINT_UNDEFINED;
29162916

0 commit comments

Comments
 (0)