diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-01-06 13:53:14 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-01-06 13:53:14 +0200 |
commit | a9933105938d4d809ea33ac3196e681cd581374f (patch) | |
tree | 153be157e073fe09bf6d6298f4c27c1ffb0ec79b | |
parent | 02e7bff882c5169ba3e1ce7e9a93d4c28fe3afd1 (diff) | |
download | mariadb-git-a9933105938d4d809ea33ac3196e681cd581374f.tar.gz |
MDEV-24537 innodb_max_dirty_pages_pct_lwm=0 lost its special meaning
In commit 3a9a3be1c64b14c05648e87ebe0f1dd96457de41 (MDEV-23855)
some previous logic was replaced with the condition
dirty_pct < srv_max_dirty_pages_pct_lwm, which caused
the default value of the parameter innodb_max_dirty_pages_pct_lwm=0
to lose its special meaning: 'refer to innodb_max_dirty_pages_pct instead'.
This implicit special meaning was visible in the function
af_get_pct_for_dirty(), which was removed in
commit f0c295e2de8c074c2ca72e19ff06e1d0e3ee6d2b (MDEV-24369).
page_cleaner_flush_pages_recommendation(): Restore the special
meaning that was removed in MDEV-24369.
buf_flush_page_cleaner(): If srv_max_dirty_pages_pct_lwm==0.0,
refer to srv_max_buf_pool_modified_pct. This fixes the observed
performance regression due to excessive page flushing.
buf_pool_t::page_cleaner_wakeup(): Revise the wakeup condition.
innodb_init(): Do initialize srv_max_io_capacity in Mariabackup.
It was previously constantly 0, which caused mariadb-backup --prepare
to hang in buf_flush_sync(), making no progress.
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 10 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/sysvars_innodb.result | 2 | ||||
-rw-r--r-- | storage/innobase/buf/buf0flu.cc | 24 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 3 | ||||
-rw-r--r-- | storage/innobase/include/srv0srv.h | 6 |
5 files changed, 30 insertions, 15 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 217976e637c..b8cdf4cd9db 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -4,7 +4,7 @@ MariaBackup: hot backup tool for InnoDB Originally Created 3/3/2009 Yasufumi Kinoshita Written by Alexey Kopytov, Aleksandr Kuzminsky, Stewart Smith, Vadim Tkachenko, Yasufumi Kinoshita, Ignacio Nin and Baron Schwartz. -(c) 2017, 2020, MariaDB Corporation. +(c) 2017, 2021, MariaDB Corporation. Portions written by Marko Mäkelä. This program is free software; you can redistribute it and/or modify @@ -2183,6 +2183,14 @@ error: static bool innodb_init() { bool create_new_db = false; + + if (srv_io_capacity >= SRV_MAX_IO_CAPACITY_LIMIT / 2) { + /* Avoid overflow. */ + srv_max_io_capacity = SRV_MAX_IO_CAPACITY_LIMIT; + } else { + srv_max_io_capacity = std::max(2 * srv_io_capacity, 2000UL); + } + /* Check if the data files exist or not. */ dberr_t err = srv_sys_space.check_file_spec(&create_new_db, 5U << 20); diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 591471cbbff..2a7d7b9a246 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -1322,7 +1322,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0.000000 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE DOUBLE -VARIABLE_COMMENT Percentage of dirty pages at which flushing kicks in. +VARIABLE_COMMENT Percentage of dirty pages at which flushing kicks in. The value 0 (default) means 'refer to innodb_max_dirty_pages_pct'. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 99.999 NUMERIC_BLOCK_SIZE NULL diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 81095a6d0d2..934feadb437 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2020, MariaDB Corporation. +Copyright (c) 2013, 2021, MariaDB Corporation. Copyright (c) 2013, 2014, Fusion-io This program is free software; you can redistribute it and/or modify it under @@ -129,11 +129,13 @@ static void buf_flush_validate_skip() /** Wake up the page cleaner if needed */ inline void buf_pool_t::page_cleaner_wakeup() { - if (page_cleaner_idle() && - (srv_max_dirty_pages_pct_lwm == 0.0 || - srv_max_dirty_pages_pct_lwm <= - double(UT_LIST_GET_LEN(buf_pool.flush_list)) * 100.0 / - double(UT_LIST_GET_LEN(buf_pool.LRU) + UT_LIST_GET_LEN(buf_pool.free)))) + if (!page_cleaner_idle()) + return; + double dirty_pct= double(UT_LIST_GET_LEN(buf_pool.flush_list)) * 100.0 / + double(UT_LIST_GET_LEN(buf_pool.LRU) + UT_LIST_GET_LEN(buf_pool.free)); + double pct_lwm= srv_max_dirty_pages_pct_lwm; + if ((pct_lwm != 0.0 && pct_lwm <= dirty_pct) || + srv_max_buf_pool_modified_pct <= dirty_pct) { page_cleaner_is_idle= false; mysql_cond_signal(&do_flush_list); @@ -1989,7 +1991,9 @@ static ulint page_cleaner_flush_pages_recommendation(ulint last_pages_in, sum_pages = 0; } - const ulint pct_for_dirty = static_cast<ulint> + const ulint pct_for_dirty = srv_max_dirty_pages_pct_lwm == 0 + ? (dirty_pct >= max_pct ? 100 : 0) + : static_cast<ulint> (max_pct > 0.0 ? dirty_pct / max_pct : dirty_pct); ulint pct_total = std::max(pct_for_dirty, pct_for_lsn); @@ -2129,7 +2133,11 @@ unemployed: const double dirty_pct= double(dirty_blocks) * 100.0 / double(UT_LIST_GET_LEN(buf_pool.LRU) + UT_LIST_GET_LEN(buf_pool.free)); - if (dirty_pct < srv_max_dirty_pages_pct_lwm && !lsn_limit) + if (lsn_limit); + else if (dirty_pct < srv_max_buf_pool_modified_pct) + goto unemployed; + else if (srv_max_dirty_pages_pct_lwm == 0.0 || + dirty_pct < srv_max_dirty_pages_pct_lwm) goto unemployed; const lsn_t oldest_lsn= buf_pool.get_oldest_modified() diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 227b63674b9..92cfd81e97b 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -19032,7 +19032,8 @@ static MYSQL_SYSVAR_DOUBLE(max_dirty_pages_pct, srv_max_buf_pool_modified_pct, static MYSQL_SYSVAR_DOUBLE(max_dirty_pages_pct_lwm, srv_max_dirty_pages_pct_lwm, PLUGIN_VAR_RQCMDARG, - "Percentage of dirty pages at which flushing kicks in.", + "Percentage of dirty pages at which flushing kicks in. " + "The value 0 (default) means 'refer to innodb_max_dirty_pages_pct'.", NULL, innodb_max_dirty_pages_pct_lwm_update, 0, 0, 99.999, 0); static MYSQL_SYSVAR_DOUBLE(adaptive_flushing_lwm, diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 7c90c7f8864..adb679dfa3c 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -3,7 +3,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2008, 2009, Google Inc. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2020, MariaDB Corporation. +Copyright (c) 2013, 2021, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -373,7 +373,7 @@ extern ulong srv_innodb_stats_method; extern ulint srv_max_n_open_files; -extern double srv_max_dirty_pages_pct; +extern double srv_max_buf_pool_modified_pct; extern double srv_max_dirty_pages_pct_lwm; extern double srv_adaptive_flushing_lwm; @@ -400,10 +400,8 @@ extern my_bool srv_stats_sample_traditional; extern my_bool srv_use_doublewrite_buf; extern ulong srv_checksum_algorithm; -extern double srv_max_buf_pool_modified_pct; extern my_bool srv_force_primary_key; -extern double srv_max_buf_pool_modified_pct; extern ulong srv_max_purge_lag; extern ulong srv_max_purge_lag_delay; |