Skip to content

Commit

Permalink
MDEV-33978 P_S.THREADS is not showing all server threads
Browse files Browse the repository at this point in the history
page_encrypt_thread_key: The key for fil_crypt_thread().

All other InnoDB threads should already have been registered for
performance_schema ever since
commit a2f510f
  • Loading branch information
dr-m committed Jan 27, 2025
1 parent dffe3d1 commit 746471b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions mysql-test/suite/perfschema/r/threads_innodb.result
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ 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/page_encrypt_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
1 change: 1 addition & 0 deletions mysql-test/suite/perfschema/t/threads_innodb.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--innodb-encryption-threads=2
9 changes: 9 additions & 0 deletions storage/innobase/fil/fil0crypt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ static uint n_fil_crypt_iops_allocated = 0;

#define DEBUG_KEYROTATION_THROTTLING 0

#ifdef UNIV_PFS_THREAD
mysql_pfs_key_t page_encrypt_thread_key;
#endif /* UNIV_PFS_THREAD */

/** Statistics variables */
static fil_crypt_stat_t crypt_stat;
static ib_mutex_t crypt_stat_mutex;
Expand Down Expand Up @@ -2145,6 +2149,10 @@ extern "C" UNIV_INTERN
os_thread_ret_t
DECLARE_THREAD(fil_crypt_thread)(void*)
{
my_thread_init();
#ifdef UNIV_PFS_THREAD
pfs_register_thread(page_encrypt_thread_key);
#endif /* UNIV_PFS_THREAD */
mutex_enter(&fil_crypt_threads_mutex);
uint thread_no = srv_n_fil_crypt_threads_started;
srv_n_fil_crypt_threads_started++;
Expand Down Expand Up @@ -2242,6 +2250,7 @@ DECLARE_THREAD(fil_crypt_thread)(void*)
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */

my_thread_end();
return os_thread_exit();
}

Expand Down
1 change: 1 addition & 0 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ performance schema instrumented if "UNIV_PFS_THREAD"
is defined */
static PSI_thread_info all_innodb_threads[] = {
PSI_KEY(page_cleaner_thread),
PSI_KEY(page_encrypt_thread),
PSI_KEY(trx_rollback_clean_thread),
PSI_KEY(thread_pool_thread)
};
Expand Down
1 change: 1 addition & 0 deletions storage/innobase/include/srv0srv.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ extern ulong srv_buf_dump_status_frequency;

# ifdef UNIV_PFS_THREAD
extern mysql_pfs_key_t page_cleaner_thread_key;
extern mysql_pfs_key_t page_encrypt_thread_key;
extern mysql_pfs_key_t trx_rollback_clean_thread_key;
extern mysql_pfs_key_t thread_pool_thread_key;

Expand Down

0 comments on commit 746471b

Please sign in to comment.