Skip to content

Commit

Permalink
MDEV-30089 Metrics not incremented for 1st iteration in buf_LRU_free_…
Browse files Browse the repository at this point in the history
…from_common_LRU_list()

In commit a03dd94 as well as
mysql/mysql-server@6ef8c34
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.
  • Loading branch information
dr-m committed Nov 28, 2022
1 parent 183ca82 commit e0d672f
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions storage/innobase/buf/buf0lru.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
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
the terms of the GNU General Public License as published by the Free Software
Expand Down Expand Up @@ -189,8 +189,6 @@ LRU list. The compressed page is preserved, and it need not be clean.
@return true if freed */
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()) {
return(false);
}
Expand All @@ -208,6 +206,7 @@ static bool buf_LRU_free_from_unzip_LRU_list(ulint limit)

freed = buf_LRU_free_page(&block->page, false);
if (freed) {
scanned++;
break;
}

Expand Down Expand Up @@ -252,17 +251,16 @@ static bool buf_LRU_free_from_common_LRU_list(ulint limit)
}

freed = true;
scanned++;
break;
}
}

if (scanned) {
MONITOR_INC_VALUE_CUMULATIVE(
MONITOR_LRU_SEARCH_SCANNED,
MONITOR_LRU_SEARCH_SCANNED_NUM_CALL,
MONITOR_LRU_SEARCH_SCANNED_PER_CALL,
scanned);
}
MONITOR_INC_VALUE_CUMULATIVE(
MONITOR_LRU_SEARCH_SCANNED,
MONITOR_LRU_SEARCH_SCANNED_NUM_CALL,
MONITOR_LRU_SEARCH_SCANNED_PER_CALL,
scanned);

return(freed);
}
Expand Down

0 comments on commit e0d672f

Please sign in to comment.