Commit e0d672f3 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-30089 Metrics not incremented for 1st iteration in buf_LRU_free_from_common_LRU_list()

In commit a03dd94b as well as
mysql/mysql-server@6ef8c343445a26aaf9ebd76d72cf57db44b481f5
the iterations were changed so that the variable "scanned"
would remain 0 when the first list item qualifies for eviction.

buf_LRU_free_from_unzip_LRU_list(), buf_LRU_free_from_common_LRU_list():
Increment "scanned" when a block can be freed.

buf_LRU_free_from_common_LRU_list(): Remove a redundant condition.
Whenever this function is invoked, buf_pool.LRU should be nonempty,
hence something should always be scanned.

Thanks to Jean-François Gagné for reporting this.
parent 183ca823
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2021, MariaDB Corporation. Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -189,8 +189,6 @@ LRU list. The compressed page is preserved, and it need not be clean. ...@@ -189,8 +189,6 @@ LRU list. The compressed page is preserved, and it need not be clean.
@return true if freed */ @return true if freed */
static bool buf_LRU_free_from_unzip_LRU_list(ulint limit) static bool buf_LRU_free_from_unzip_LRU_list(ulint limit)
{ {
mysql_mutex_assert_owner(&buf_pool.mutex);
if (!buf_LRU_evict_from_unzip_LRU()) { if (!buf_LRU_evict_from_unzip_LRU()) {
return(false); return(false);
} }
...@@ -208,6 +206,7 @@ static bool buf_LRU_free_from_unzip_LRU_list(ulint limit) ...@@ -208,6 +206,7 @@ static bool buf_LRU_free_from_unzip_LRU_list(ulint limit)
freed = buf_LRU_free_page(&block->page, false); freed = buf_LRU_free_page(&block->page, false);
if (freed) { if (freed) {
scanned++;
break; break;
} }
...@@ -252,17 +251,16 @@ static bool buf_LRU_free_from_common_LRU_list(ulint limit) ...@@ -252,17 +251,16 @@ static bool buf_LRU_free_from_common_LRU_list(ulint limit)
} }
freed = true; freed = true;
scanned++;
break; break;
} }
} }
if (scanned) { MONITOR_INC_VALUE_CUMULATIVE(
MONITOR_INC_VALUE_CUMULATIVE( MONITOR_LRU_SEARCH_SCANNED,
MONITOR_LRU_SEARCH_SCANNED, MONITOR_LRU_SEARCH_SCANNED_NUM_CALL,
MONITOR_LRU_SEARCH_SCANNED_NUM_CALL, MONITOR_LRU_SEARCH_SCANNED_PER_CALL,
MONITOR_LRU_SEARCH_SCANNED_PER_CALL, scanned);
scanned);
}
return(freed); return(freed);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment