diff options
author | Krunal Bauskar <mysqlonarm@gmail.com> | 2021-03-29 13:14:02 +0800 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-04-28 17:03:07 +0300 |
commit | 3f4b7ed95a4f5599fe41ab0ebe83e5cc123b5e80 (patch) | |
tree | f06d6a06517c02197ce0d1aec9d72af7e4a8ab54 | |
parent | 559efad44eac9055921e7cd14c8423dd9c507395 (diff) | |
download | mariadb-git-3f4b7ed95a4f5599fe41ab0ebe83e5cc123b5e80.tar.gz |
MDEV-25093: Adaptive flushing fails to kick in even if
innodb_adaptive_flushing_lwm is hit. (possible regression)
adaptive flushing should kick in if
a. dirty_pct (dirty pages in buffer pool) > innodb_max_dirty_pages_pct_lwm
OR
b. innodb_adaptive_flushing_lwm limit is reached (default to 10%)
both conditions are mutually exclusive and whichever is first to evaluate
true should kick-start the adaptive flushing.
After recent changes to simplify the flushing algorithm logic, (b) got ignored
that introduced the said regression.
-rw-r--r-- | storage/innobase/buf/buf0flu.cc | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 339b30659fe..fb3a9687cfc 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1898,6 +1898,20 @@ ATTRIBUTE_COLD static void buf_flush_sync_for_checkpoint(lsn_t lsn) } } +/** Check if the adpative flushing threshold is recommended based on +redo log capacity filled threshold. +@param oldest_lsn buf_pool.get_oldest_modification() +@return true if adaptive flushing is recommended. */ +static bool af_needed_for_redo(lsn_t oldest_lsn) +{ + lsn_t age= (log_sys.get_lsn() - oldest_lsn); + lsn_t af_lwm= static_cast<lsn_t>(srv_adaptive_flushing_lwm * + static_cast<double>(log_sys.log_capacity) / 100); + + /* if age > af_lwm adaptive flushing is recommended */ + return (age > af_lwm); +} + /*********************************************************************//** Calculates if flushing is required based on redo generation rate. @return percent of io_capacity to flush to manage redo space */ @@ -2148,9 +2162,14 @@ 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)); + const lsn_t oldest_lsn= buf_pool.get_oldest_modified() + ->oldest_modification(); + ut_ad(oldest_lsn); + bool idle_flush= false; if (lsn_limit); + else if (af_needed_for_redo(oldest_lsn)); else if (srv_max_dirty_pages_pct_lwm != 0.0) { const ulint activity_count= srv_get_activity_count(); @@ -2173,10 +2192,6 @@ unemployed: else if (dirty_pct < srv_max_buf_pool_modified_pct) goto unemployed; - const lsn_t oldest_lsn= buf_pool.get_oldest_modified() - ->oldest_modification(); - ut_ad(oldest_lsn); - if (UNIV_UNLIKELY(lsn_limit != 0) && oldest_lsn >= lsn_limit) buf_flush_sync_lsn= 0; |