Commit 1216244e authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-11703 InnoDB background threads show up in the processlist

give threads more descriptive names
parent 98a5ee9d
......@@ -20,7 +20,7 @@ SELECT COUNT(DISTINCT f1) FROM t1;
COUNT(DISTINCT f1)
30000
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE
USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
COUNT(*)
5
connection default;
......
......@@ -13,7 +13,7 @@ SELECT @@wsrep_slave_threads = 1;
1
SET GLOBAL wsrep_slave_threads = 1;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
COUNT(*)
2
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
......@@ -27,7 +27,7 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
1
SELECT COUNT(*) - @@wsrep_slave_threads FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
COUNT(*) - @@wsrep_slave_threads
1
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
......@@ -104,7 +104,7 @@ SELECT COUNT(*) FROM t2;
COUNT(*)
64
SELECT COUNT(*) - @@wsrep_slave_threads FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
COUNT(*) - @@wsrep_slave_threads
1
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
......
......@@ -7,7 +7,7 @@
--connection node_1
--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`
--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`
--disable_query_log
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
......
......@@ -40,7 +40,7 @@ SET GLOBAL wsrep_slave_threads = 4;
SELECT COUNT(*) FROM t1;
SELECT COUNT(DISTINCT f1) FROM t1;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE
USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
--disable_query_log
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
......
......@@ -23,7 +23,7 @@ SELECT @@wsrep_slave_threads = 1;
SET GLOBAL wsrep_slave_threads = 1;
# There is a separate wsrep_aborter thread at all times
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
#
......@@ -40,7 +40,7 @@ INSERT INTO t1 VALUES (1);
SELECT COUNT(*) FROM t1;
SELECT COUNT(*) - @@wsrep_slave_threads FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
#
......@@ -63,7 +63,7 @@ while ($count)
SELECT COUNT(*) FROM t2;
SELECT COUNT(*) - @@wsrep_slave_threads FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
......
......@@ -326,7 +326,7 @@ thd_destructor_proxy(void *)
st_my_thread_var *myvar= _my_thread_var();
THD *thd= create_thd();
thd_proc_info(thd, "InnoDB background thread");
thd_proc_info(thd, "InnoDB shutdown handler");
myvar->current_mutex = &thd_destructor_mutex;
myvar->current_cond = &thd_destructor_cond;
......@@ -1708,14 +1708,15 @@ static MYSQL_THDVAR_BOOL(background_thread,
"Internal (not user visible) flag to mark "
"background purge threads", NULL, NULL, 0);
/** Create a MYSQL_THD for background purge threads and mark it as such.
@returns new MYSQL_THD */
/** Create a MYSQL_THD for a background thread and mark it as such.
@param name thread info for SHOW PROCESSLIST
@return new MYSQL_THD */
MYSQL_THD
innobase_create_background_thd()
innobase_create_background_thd(const char* name)
/*============================*/
{
MYSQL_THD thd= create_thd();
thd_proc_info(thd, "InnoDB background thread");
thd_proc_info(thd, name);
THDVAR(thd, background_thread) = true;
return thd;
}
......
......@@ -610,10 +610,11 @@ buffer pool size.
void
innodb_set_buf_pool_size(ulonglong buf_pool_size);
/** Create a MYSQL_THD for background purge threads and mark it as such.
@returns new MYSQL_THD */
/** Create a MYSQL_THD for a background thread and mark it as such.
@param name thread info for SHOW PROCESSLIST
@return new MYSQL_THD */
MYSQL_THD
innobase_create_background_thd();
innobase_create_background_thd(const char* name);
/** Destroy a background purge thread THD.
@param[in] thd MYSQL_THD to destroy */
......
......@@ -2681,7 +2681,7 @@ DECLARE_THREAD(srv_worker_thread)(
ut_ad(!srv_read_only_mode);
ut_a(srv_force_recovery < SRV_FORCE_NO_BACKGROUND);
my_thread_init();
THD* thd = innobase_create_background_thd();
THD* thd = innobase_create_background_thd("InnoDB purge worker");
#ifdef UNIV_DEBUG_THREAD_CREATION
ib::info() << "Worker thread starting, id "
......@@ -2910,7 +2910,7 @@ DECLARE_THREAD(srv_purge_coordinator_thread)(
required by os_thread_create */
{
my_thread_init();
THD* thd = innobase_create_background_thd();
THD* thd = innobase_create_background_thd("InnoDB purge coordinator");
srv_slot_t* slot;
ulint n_total_purged = ULINT_UNDEFINED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment