MDEV-24544 innodb_buffer_pool_wait_free is not protected by mutex
buf_LRU_get_free_block(): Increment the counter after acquiring buf_pool.mutex. buf_pool.stat.LRU_waits: Replaces export_vars.innodb_buffer_pool_wait_free and srv_stats.buf_pool_wait_free. Reads of the counter will remain dirty, not acquiring the mutex.
This commit is contained in:
parent
a993310593
commit
fae87e0c74
@ -1,7 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
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, 2020, MariaDB Corporation.
|
Copyright (c) 2017, 2021, 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
|
||||||
@ -410,7 +410,6 @@ buf_block_t* buf_LRU_get_free_block(bool have_mutex)
|
|||||||
mysql_mutex_assert_owner(&buf_pool.mutex);
|
mysql_mutex_assert_owner(&buf_pool.mutex);
|
||||||
goto got_mutex;
|
goto got_mutex;
|
||||||
}
|
}
|
||||||
loop:
|
|
||||||
mysql_mutex_lock(&buf_pool.mutex);
|
mysql_mutex_lock(&buf_pool.mutex);
|
||||||
got_mutex:
|
got_mutex:
|
||||||
buf_LRU_check_size_of_non_data_objects();
|
buf_LRU_check_size_of_non_data_objects();
|
||||||
@ -493,11 +492,10 @@ not_found:
|
|||||||
++flush_failures;
|
++flush_failures;
|
||||||
}
|
}
|
||||||
|
|
||||||
srv_stats.buf_pool_wait_free.inc();
|
|
||||||
|
|
||||||
n_iterations++;
|
n_iterations++;
|
||||||
|
mysql_mutex_lock(&buf_pool.mutex);
|
||||||
goto loop;
|
buf_pool.stat.LRU_waits++;
|
||||||
|
goto got_mutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Move the LRU_old pointer so that the length of the old blocks list
|
/** Move the LRU_old pointer so that the length of the old blocks list
|
||||||
|
@ -4,7 +4,7 @@ Copyright (c) 2000, 2020, Oracle and/or its affiliates. All Rights Reserved.
|
|||||||
Copyright (c) 2008, 2009 Google Inc.
|
Copyright (c) 2008, 2009 Google Inc.
|
||||||
Copyright (c) 2009, Percona Inc.
|
Copyright (c) 2009, Percona Inc.
|
||||||
Copyright (c) 2012, Facebook Inc.
|
Copyright (c) 2012, Facebook Inc.
|
||||||
Copyright (c) 2013, 2020, MariaDB Corporation.
|
Copyright (c) 2013, 2021, MariaDB Corporation.
|
||||||
|
|
||||||
Portions of this file contain modifications contributed and copyrighted by
|
Portions of this file contain modifications contributed and copyrighted by
|
||||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||||
@ -919,8 +919,7 @@ static SHOW_VAR innodb_status_variables[]= {
|
|||||||
&export_vars.innodb_buffer_pool_read_requests, SHOW_SIZE_T},
|
&export_vars.innodb_buffer_pool_read_requests, SHOW_SIZE_T},
|
||||||
{"buffer_pool_reads",
|
{"buffer_pool_reads",
|
||||||
&export_vars.innodb_buffer_pool_reads, SHOW_SIZE_T},
|
&export_vars.innodb_buffer_pool_reads, SHOW_SIZE_T},
|
||||||
{"buffer_pool_wait_free",
|
{"buffer_pool_wait_free", &buf_pool.stat.LRU_waits, SHOW_SIZE_T},
|
||||||
&export_vars.innodb_buffer_pool_wait_free, SHOW_SIZE_T},
|
|
||||||
{"buffer_pool_write_requests",
|
{"buffer_pool_write_requests",
|
||||||
&export_vars.innodb_buffer_pool_write_requests, SHOW_SIZE_T},
|
&export_vars.innodb_buffer_pool_write_requests, SHOW_SIZE_T},
|
||||||
{"checkpoint_age", &export_vars.innodb_checkpoint_age, SHOW_SIZE_T},
|
{"checkpoint_age", &export_vars.innodb_checkpoint_age, SHOW_SIZE_T},
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
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) 2013, 2020, MariaDB Corporation.
|
Copyright (c) 2013, 2021, 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
|
||||||
@ -1355,6 +1355,8 @@ struct buf_pool_stat_t{
|
|||||||
young because the first access
|
young because the first access
|
||||||
was not long enough ago, in
|
was not long enough ago, in
|
||||||
buf_page_peek_if_too_old() */
|
buf_page_peek_if_too_old() */
|
||||||
|
/** number of waits for eviction; writes protected by buf_pool.mutex */
|
||||||
|
ulint LRU_waits;
|
||||||
ulint LRU_bytes; /*!< LRU size in bytes */
|
ulint LRU_bytes; /*!< LRU size in bytes */
|
||||||
ulint flush_list_bytes;/*!< flush_list size in bytes */
|
ulint flush_list_bytes;/*!< flush_list size in bytes */
|
||||||
};
|
};
|
||||||
@ -1789,7 +1791,7 @@ public:
|
|||||||
static constexpr uint32_t READ_AHEAD_PAGES= 64;
|
static constexpr uint32_t READ_AHEAD_PAGES= 64;
|
||||||
|
|
||||||
/** Buffer pool mutex */
|
/** Buffer pool mutex */
|
||||||
mysql_mutex_t mutex;
|
MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) mysql_mutex_t mutex;
|
||||||
/** Number of pending LRU flush. */
|
/** Number of pending LRU flush. */
|
||||||
Atomic_counter<ulint> n_flush_LRU;
|
Atomic_counter<ulint> n_flush_LRU;
|
||||||
/** broadcast when n_flush_LRU reaches 0; protected by mutex */
|
/** broadcast when n_flush_LRU reaches 0; protected by mutex */
|
||||||
@ -1936,7 +1938,7 @@ public:
|
|||||||
|
|
||||||
/** mutex protecting flush_list, buf_page_t::set_oldest_modification()
|
/** mutex protecting flush_list, buf_page_t::set_oldest_modification()
|
||||||
and buf_page_t::list pointers when !oldest_modification() */
|
and buf_page_t::list pointers when !oldest_modification() */
|
||||||
mysql_mutex_t flush_list_mutex;
|
MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) mysql_mutex_t flush_list_mutex;
|
||||||
/** "hazard pointer" for flush_list scans; protected by flush_list_mutex */
|
/** "hazard pointer" for flush_list scans; protected by flush_list_mutex */
|
||||||
FlushHp flush_hp;
|
FlushHp flush_hp;
|
||||||
/** modified blocks (a subset of LRU) */
|
/** modified blocks (a subset of LRU) */
|
||||||
|
@ -88,11 +88,6 @@ struct srv_stats_t
|
|||||||
/** Store the number of write requests issued */
|
/** Store the number of write requests issued */
|
||||||
ulint_ctr_1_t buf_pool_write_requests;
|
ulint_ctr_1_t buf_pool_write_requests;
|
||||||
|
|
||||||
/** Store the number of times when we had to wait for a free page
|
|
||||||
in the buffer pool. It happens when the buffer pool is full and we
|
|
||||||
need to make a flush, in order to be able to read or create a page. */
|
|
||||||
ulint_ctr_1_t buf_pool_wait_free;
|
|
||||||
|
|
||||||
/** Number of buffer pool reads that led to the reading of
|
/** Number of buffer pool reads that led to the reading of
|
||||||
a disk page */
|
a disk page */
|
||||||
ulint_ctr_1_t buf_pool_reads;
|
ulint_ctr_1_t buf_pool_reads;
|
||||||
@ -736,8 +731,7 @@ struct export_var_t{
|
|||||||
ulint innodb_buffer_pool_pages_old;
|
ulint innodb_buffer_pool_pages_old;
|
||||||
ulint innodb_buffer_pool_read_requests; /*!< buf_pool.stat.n_page_gets */
|
ulint innodb_buffer_pool_read_requests; /*!< buf_pool.stat.n_page_gets */
|
||||||
ulint innodb_buffer_pool_reads; /*!< srv_buf_pool_reads */
|
ulint innodb_buffer_pool_reads; /*!< srv_buf_pool_reads */
|
||||||
ulint innodb_buffer_pool_wait_free; /*!< srv_buf_pool_wait_free */
|
ulint innodb_buffer_pool_write_requests;/*!< srv_stats.buf_pool_write_requests */
|
||||||
ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */
|
|
||||||
ulint innodb_buffer_pool_read_ahead_rnd;/*!< srv_read_ahead_rnd */
|
ulint innodb_buffer_pool_read_ahead_rnd;/*!< srv_read_ahead_rnd */
|
||||||
ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */
|
ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */
|
||||||
ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
|
ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
Copyright (c) 2012, Facebook Inc.
|
Copyright (c) 2012, Facebook Inc.
|
||||||
Copyright (c) 2013, 2020, MariaDB Corporation.
|
Copyright (c) 2013, 2021, 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
|
||||||
@ -1565,7 +1565,7 @@ srv_mon_process_existing_counter(
|
|||||||
|
|
||||||
/* innodb_buffer_pool_wait_free */
|
/* innodb_buffer_pool_wait_free */
|
||||||
case MONITOR_OVLD_BUF_POOL_WAIT_FREE:
|
case MONITOR_OVLD_BUF_POOL_WAIT_FREE:
|
||||||
value = srv_stats.buf_pool_wait_free;
|
value = buf_pool.stat.LRU_waits;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* innodb_buffer_pool_read_ahead */
|
/* innodb_buffer_pool_read_ahead */
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
Copyright (c) 2008, 2009 Google Inc.
|
Copyright (c) 2008, 2009 Google Inc.
|
||||||
Copyright (c) 2009, Percona 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
|
Portions of this file contain modifications contributed and copyrighted by
|
||||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||||
@ -1111,9 +1111,6 @@ srv_export_innodb_status(void)
|
|||||||
export_vars.innodb_buffer_pool_write_requests =
|
export_vars.innodb_buffer_pool_write_requests =
|
||||||
srv_stats.buf_pool_write_requests;
|
srv_stats.buf_pool_write_requests;
|
||||||
|
|
||||||
export_vars.innodb_buffer_pool_wait_free =
|
|
||||||
srv_stats.buf_pool_wait_free;
|
|
||||||
|
|
||||||
export_vars.innodb_buffer_pool_reads = srv_stats.buf_pool_reads;
|
export_vars.innodb_buffer_pool_reads = srv_stats.buf_pool_reads;
|
||||||
|
|
||||||
export_vars.innodb_buffer_pool_read_ahead_rnd =
|
export_vars.innodb_buffer_pool_read_ahead_rnd =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user