From 841e905f200be403d10bbaffad0698f0baef4b90 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Fri, 9 Jun 2023 17:56:04 +0530 Subject: [PATCH] MDEV-31442 page_cleaner thread aborts while releasing the tablespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After further I/O on a tablespace has been stopped (for example due to DROP TABLE or an operation that rebuilds a table), page cleaner thread tries to flush the pending writes for the tablespace and releases the tablespace reference even though it was not acquired. fil_space_t::flush(): Don't release the tablespace when it is being stopped and closed Thanks to Marko Mäkelä for suggesting this patch. --- storage/innobase/include/fil0fil.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 10365d167b7..053fe7a68e0 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1526,9 +1526,11 @@ template inline void fil_space_t::flush() flush_low(); else { - if (!(acquire_low() & (STOPPING | CLOSING))) + if (!(acquire_low(STOPPING & CLOSING) & (STOPPING | CLOSING))) + { flush_low(); - release(); + release(); + } } }