From aa0e3805681552cff5dced141f695c96a4da872f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 4 Dec 2020 14:11:48 +0200 Subject: MDEV-24348 InnoDB shutdown hang with innodb_flush_sync=0 This hang was caused by MDEV-23855, and we failed to fix it in MDEV-24109 (commit 4cbfdeca840098b9ed0d8147d43288c36743a328). When buf_flush_ahead() is invoked soon before server shutdown and the non-default setting innodb_flush_sync=OFF is in effect and the buffer pool contains dirty pages of temporary tables, the page cleaner thread may remain in an infinite loop without completing its work, thus causing the shutdown to hang. buf_flush_page_cleaner(): If the buffer pool contains no unmodified persistent pages, ensure that buf_flush_sync_lsn= 0 will be assigned, so that shutdown will proceed. The test case is not deterministic. On my system, it reproduced the hang with 95% probability when running multiple instances of the test in parallel, and 4% when running single-threaded. Thanks to Eugene Kosov for debugging and testing this. --- mysql-test/suite/innodb/r/autoinc_debug.result | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mysql-test/suite/innodb/r/autoinc_debug.result') diff --git a/mysql-test/suite/innodb/r/autoinc_debug.result b/mysql-test/suite/innodb/r/autoinc_debug.result index 5856c75f784..e82695ede43 100644 --- a/mysql-test/suite/innodb/r/autoinc_debug.result +++ b/mysql-test/suite/innodb/r/autoinc_debug.result @@ -1,6 +1,12 @@ CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY)ENGINE=INNODB; # SETTING auto_increment_increment IN CONNECTION DEFAULT SET AUTO_INCREMENT_INCREMENT = 1; +# MDEV-24348 InnoDB shutdown hang with innodb_flush_sync=0 +SET GLOBAL innodb_flush_sync=OFF; +# For the server to hang, we must have pages for temporary tables +# (and this is only effective as long as MDEV-12227 is not fixed). +CREATE TEMPORARY TABLE t (id SERIAL) ENGINE=InnoDB; +SET debug_dbug= '+d,ib_log_flush_ahead'; INSERT INTO t1 VALUES(NULL); SELECT * FROM t1; id -- cgit v1.2.1