From e9b3d44c6eef3d7b4944d724ba597035798324ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 11 Nov 2020 09:11:34 +0200 Subject: [PATCH] MDEV-24190 Accessing INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION may break innodb_open_files logic If the function i_s_tablespaces_encryption_fill_table() was not able to report all content to the SQL layer, it would fail to decrement fil_system.freeze_space_list that it had incremented. This would prevent the not-frequently-used logic from working, potentially causing frequently used files to be closed and reopened whenever innodb_open_files is exceeded. This regression was caused by commit 45ed9dd957eebc7fc84feb2509f4aa6baa908a95 (part of MDEV-23855). --- storage/innobase/handler/i_s.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index ecc0905de56..2d659d9f9a3 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -7049,6 +7049,7 @@ i_s_tablespaces_encryption_fill_table( DBUG_RETURN(0); } + int err = 0; mutex_enter(&fil_system.mutex); fil_system.freeze_space_list++; @@ -7058,19 +7059,19 @@ i_s_tablespaces_encryption_fill_table( && !space->is_stopping()) { space->reacquire(); mutex_exit(&fil_system.mutex); - if (int err = i_s_dict_fill_tablespaces_encryption( - thd, space, tables->table)) { - space->release(); - DBUG_RETURN(err); - } + err = i_s_dict_fill_tablespaces_encryption( + thd, space, tables->table); mutex_enter(&fil_system.mutex); space->release(); + if (err) { + break; + } } } fil_system.freeze_space_list--; mutex_exit(&fil_system.mutex); - DBUG_RETURN(0); + DBUG_RETURN(err); } /*******************************************************************//** Bind the dynamic table INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION