Commit 2f25c653 authored by Jan Lindström's avatar Jan Lindström

MDEV-8074: Failing assertion: mutex->magic_n == MUTEX_MAGIC_N in file sync0sync.cc line 508

Problem was that e.g. on crash recovery fil_space_crypt_close_tablespace
and fil_space_crypt_mark_space_closing access mutex that is not yet
initialized. Mutex is naturally initialized only if encryption is
configured.
parent 31c069eb
...@@ -2339,7 +2339,12 @@ fil_space_crypt_mark_space_closing( ...@@ -2339,7 +2339,12 @@ fil_space_crypt_mark_space_closing(
/*===============================*/ /*===============================*/
ulint space) /*!< in: Space id */ ulint space) /*!< in: Space id */
{ {
if (!srv_encrypt_tables) {
return;
}
mutex_enter(&fil_crypt_threads_mutex); mutex_enter(&fil_crypt_threads_mutex);
fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space); fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space);
if (crypt_data == NULL) { if (crypt_data == NULL) {
...@@ -2361,7 +2366,12 @@ fil_space_crypt_close_tablespace( ...@@ -2361,7 +2366,12 @@ fil_space_crypt_close_tablespace(
/*=============================*/ /*=============================*/
ulint space) /*!< in: Space id */ ulint space) /*!< in: Space id */
{ {
if (!srv_encrypt_tables) {
return;
}
mutex_enter(&fil_crypt_threads_mutex); mutex_enter(&fil_crypt_threads_mutex);
fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space); fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space);
if (crypt_data == NULL) { if (crypt_data == NULL) {
......
...@@ -2339,7 +2339,12 @@ fil_space_crypt_mark_space_closing( ...@@ -2339,7 +2339,12 @@ fil_space_crypt_mark_space_closing(
/*===============================*/ /*===============================*/
ulint space) /*!< in: Space id */ ulint space) /*!< in: Space id */
{ {
if (!srv_encrypt_tables) {
return;
}
mutex_enter(&fil_crypt_threads_mutex); mutex_enter(&fil_crypt_threads_mutex);
fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space); fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space);
if (crypt_data == NULL) { if (crypt_data == NULL) {
...@@ -2361,7 +2366,12 @@ fil_space_crypt_close_tablespace( ...@@ -2361,7 +2366,12 @@ fil_space_crypt_close_tablespace(
/*=============================*/ /*=============================*/
ulint space) /*!< in: Space id */ ulint space) /*!< in: Space id */
{ {
if (!srv_encrypt_tables) {
return;
}
mutex_enter(&fil_crypt_threads_mutex); mutex_enter(&fil_crypt_threads_mutex);
fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space); fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space);
if (crypt_data == NULL) { if (crypt_data == NULL) {
......
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