While actually trying to analyze something else I found that PERFORMANCE_SCHEMA.THREADS does not list all server threads.
In my case I was originally looking for InnoDB background encryption threads, of which I had four configured, but found that there were actually five threads missing.
ps showed:
$ pgrep -w mariadbd | xargs ps -Lo pid,lwp,cmd
|
PID LWP CMD
|
14728 14728 /usr/sbin/mariadbd
|
14728 14729 /usr/sbin/mariadbd
|
14728 14730 /usr/sbin/mariadbd
|
14728 14731 /usr/sbin/mariadbd
|
14728 14732 /usr/sbin/mariadbd
|
14728 14735 /usr/sbin/mariadbd
|
14728 14736 /usr/sbin/mariadbd
|
14728 14737 /usr/sbin/mariadbd
|
14728 14738 /usr/sbin/mariadbd
|
14728 14739 /usr/sbin/mariadbd
|
14728 14740 /usr/sbin/mariadbd
|
14728 14742 /usr/sbin/mariadbd
|
14728 15299 /usr/sbin/mariadbd
|
14728 15383 /usr/sbin/mariadbd
|
But the THREADS table only had:
MariaDB [test]> select name, thread_os_id from performance_schema.threads order by thread_os_id;
|
+-----------------------------------+--------------+
|
| name | thread_os_id |
|
+-----------------------------------+--------------+
|
| thread/sql/main | 14728 |
|
| thread/mysys/statement_timer | 14729 |
|
| thread/aria/checkpoint_background | 14730 |
|
| thread/innodb/page_cleaner_thread | 14732 |
|
| thread/sql/manager | 14739 |
|
| thread/sql/binlog_background | 14740 |
|
| thread/sql/signal_handler | 14742 |
|
| thread/innodb/thread_pool_thread | 15299 |
|
| thread/sql/one_connection | 15383 |
|
+-----------------------------------+--------------+
|
So LWP ides 14731 and 14835-14738 were missing. The later four are the background encryption threads, and 14731 was running this according to gdb:
Thread 4 (Thread 0x7fa945118700 (LWP 14731)):
|
#0 syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
|
#1 0x000055faa5f1213d in my_getevents (min_nr=1, nr=256, ev=0x7fa945115d60, ctx=<optimized out>) at ./tpool/aio_linux.cc:105
|
#2 tpool::aio_linux::getevent_thread_routine (aio=0x55faa8c4e650) at ./tpool/aio_linux.cc:105
|
#3 0x00007fa96107bdf4 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
|
#4 0x00007fa961195609 in start_thread (arg=<optimized out>) at pthread_create.c:477
|
#5 0x00007fa960d81353 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
Not sure whether it is only these threads that do not show, or whether there are also other candidates that were just not running in this setup to begin with.