summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-11-03 12:41:41 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-11-03 12:41:41 +0200
commit90f43d260e407c650aa8a7885d674c717618cc37 (patch)
treebdba4334b5b21403a278036211eeda86ff1f93f1
parent95fcd567bdc4f9cdbe6b75ea6047982500b45c2f (diff)
downloadmariadb-git-mariadb-10.5.7.tar.gz
MDEV-24101 innodb_random_read_ahead=ON causes hang on DDL or shutdownmariadb-10.5.7
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.
-rw-r--r--mysql-test/suite/innodb/t/foreign_key.combinations5
-rw-r--r--storage/innobase/buf/buf0rea.cc2
2 files changed, 6 insertions, 1 deletions
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 */