From 90f43d260e407c650aa8a7885d674c717618cc37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 3 Nov 2020 12:41:41 +0200 Subject: [PATCH] MDEV-24101 innodb_random_read_ahead=ON causes hang on DDL or shutdown buf_read_ahead_random(): Do not leak a tablespace reference. The reference was already acquired in fil_space_t::get(), and we must only check that operations were not stopped. This error was introduced when commit 118e258aaac5da75a2ac4556201aaea3688fac67 merged n_pending_ios, n_pending_ops into a single n_pending. This was not noticed earlier, because innodb_random_read_ahead is OFF by default and our regression tests did not vary that parameter at all. --- mysql-test/suite/innodb/t/foreign_key.combinations | 5 +++++ storage/innobase/buf/buf0rea.cc | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/innodb/t/foreign_key.combinations diff --git a/mysql-test/suite/innodb/t/foreign_key.combinations b/mysql-test/suite/innodb/t/foreign_key.combinations new file mode 100644 index 00000000000..53d4cff5ca7 --- /dev/null +++ b/mysql-test/suite/innodb/t/foreign_key.combinations @@ -0,0 +1,5 @@ +[read-ahead] +--innodb-random-read-ahead=ON + +[normal] +--innodb-random-read-ahead=OFF diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index 2f59f1ae4d5..3b49525502a 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -431,7 +431,7 @@ no_read_ahead: return 0; read_ahead: - if (!space->acquire_if_not_stopped()) + if (space->is_stopping()) goto no_read_ahead; /* Read all the suitable blocks within the area */