Skip to content
/ server Public

Commit 6892722

Browse files
MDEV-38271 Server hangs during concurrent set innodb_encryption_threads
Problem: ======= - Multiple user threads waits for all encryption threads to start before returing the control to user. But in fil_crypt_thread(), InnoDB signals that thread is started after incrementing srv_n_fil_crypt_threads_started variable. For multiple waiters, pthread_cond_broadcast() would be more appropriate as it wakes all waiting threads. Solution: ======== fil_crypt_thread(): Use pthread_cond_broadcast instead of pthread_cond_signal(fil_crypt_cond) to wake multiple waiter threads
1 parent 5d2da8e commit 6892722

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

storage/innobase/fil/fil0crypt.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,7 @@ static void fil_crypt_thread()
20212021
#endif /* UNIV_PFS_THREAD */
20222022
mysql_mutex_lock(&fil_crypt_threads_mutex);
20232023
rotate_thread_t thr(srv_n_fil_crypt_threads_started++);
2024-
pthread_cond_signal(&fil_crypt_cond); /* signal that we started */
2024+
pthread_cond_broadcast(&fil_crypt_cond);
20252025

20262026
if (!thr.should_shutdown()) {
20272027
/* if we find a tablespace that is starting, skip over it
@@ -2093,7 +2093,7 @@ static void fil_crypt_thread()
20932093

20942094
fil_crypt_return_iops(&thr);
20952095
srv_n_fil_crypt_threads_started--;
2096-
pthread_cond_signal(&fil_crypt_cond); /* signal that we stopped */
2096+
pthread_cond_broadcast(&fil_crypt_cond);
20972097
mysql_mutex_unlock(&fil_crypt_threads_mutex);
20982098

20992099
my_thread_end();

0 commit comments

Comments
 (0)