From bf49e7cfc78999aaaaf549bc44ba8548cc98bab8 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Tue, 26 Mar 2024 15:29:33 +0530 Subject: [PATCH] MDEV-33770 Alter operation hangs when encryption thread works on the same tablespace - Background encryption threads wait for stop flag to exit early from the tablespace. Alter operation fails to set the stop flag before waiting for the encryption thread to stop using the tablespace. --- storage/innobase/fil/fil0crypt.cc | 2 +- storage/innobase/fil/fil0fil.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 49cb8ee6024..ad02f1c3393 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -2755,7 +2755,7 @@ fil_space_crypt_close_tablespace( << " seconds to drop space: " << space->name << " (" << space->id << ") active threads " - << cnt << "flushing=" + << cnt << " flushing=" << flushing << "."; last = now; } diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 45f8c341ee2..44e061b9400 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -2288,13 +2288,13 @@ fil_check_pending_operations( fil_space_t* sp = fil_space_get_by_id(id); if (sp) { + sp->set_stopping(true); if (sp->crypt_data && sp->acquire()) { mutex_exit(&fil_system.mutex); fil_space_crypt_close_tablespace(sp); mutex_enter(&fil_system.mutex); sp->release(); } - sp->set_stopping(true); } /* Check for pending operations. */