summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-12-14 13:11:44 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-12-14 13:11:44 +0200
commit17d3f8560bf6680074924d0ca2cf42d4706ea741 (patch)
treeaefeeafbb5a2938cea414a3b868985372422d267
parent8677c14e65f436db00be5aedb1f644fcffc70f7e (diff)
downloadmariadb-git-17d3f8560bf6680074924d0ca2cf42d4706ea741.tar.gz
MDEV-24313 (1 of 2): Hang with innodb_write_io_threads=1
After commit a5a2ef079cec378340d8b575aef05974b0b3442e (part of MDEV-23855) implemented asynchronous doublewrite, it is possible that the server will hang when the following parametes are in effect: innodb_doublewrite=1 (default) innodb_write_io_threads=1 innodb_use_native_aio=0 Note: In commit 5e62b6a5e06eb02cbde1e34e95e26f42d87fce02 (MDEV-16264) the logic of os_aio_init() was changed so that it will never fail, but instead automatically disable innodb_use_native_aio (which is enabled by default) if the io_setup() system call would fail due to resource limits being exceeded. Before commit a5a2ef079cec378340d8b575aef05974b0b3442e, we used a synchronous write for the doublewrite buffer batches, always at most 64 pages at a time. So, upon completing a doublewrite batch, a single thread would submit at most 64 page writes (for the individual pages that were first written to the doublewrite buffer). With that commit, we may submit up to 128 page writes at a time. The maximum number of outstanding requests per thread is 256. Because the maximum number of asynchronous write submissions per thread was roughly doubled, it is now possible that buf_dblwr_t::flush_buffered_writes_completed() will hang in io_slots::acquire(), called via os_aio() and fil_space_t::io(), when submitting writes of the individual blocks. We will prevent this type of hang by increasing the minimum number of innodb_write_io_threads from 1 to 2, so that this type of hang would only become possible when 512 outstanding write requests are exceeded.
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff2
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result2
-rw-r--r--storage/innobase/handler/ha_innodb.cc2
3 files changed, 3 insertions, 3 deletions
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
index ea9f47d8f3a..78d3689e69d 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
@@ -436,5 +436,5 @@
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of background write I/O threads in InnoDB.
- NUMERIC_MIN_VALUE 1
+ NUMERIC_MIN_VALUE 2
NUMERIC_MAX_VALUE 64
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index 49e168930cc..ef4c337d471 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -2067,7 +2067,7 @@ DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Number of background write I/O threads in InnoDB.
-NUMERIC_MIN_VALUE 1
+NUMERIC_MIN_VALUE 2
NUMERIC_MAX_VALUE 64
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 9a47fb6b30f..a93e4284452 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -19439,7 +19439,7 @@ static MYSQL_SYSVAR_ULONG(read_io_threads, srv_n_read_io_threads,
static MYSQL_SYSVAR_ULONG(write_io_threads, srv_n_write_io_threads,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of background write I/O threads in InnoDB.",
- NULL, NULL, 4, 1, 64, 0);
+ NULL, NULL, 4, 2, 64, 0);
static MYSQL_SYSVAR_ULONG(force_recovery, srv_force_recovery,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,