Commit 1a6f708e authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-15058: Deprecate and ignore innodb_buffer_pool_instances

Our benchmarking efforts indicate that the reasons for splitting the
buf_pool in commit c18084f7
have mostly gone away, possibly as a result of
mysql/mysql-server@ce6109ebfdedfdf185e391a0c97dc6d33867ed78
or similar work.

Only in one write-heavy benchmark where the working set size is
ten times the buffer pool size, the buf_pool->mutex would be
less contended with 4 buffer pool instances than with 1 instance,
in buf_page_io_complete(). That contention could be alleviated
further by making more use of std::atomic and by splitting
buf_pool_t::mutex further (MDEV-15053).

We will deprecate and ignore the following parameters:

	innodb_buffer_pool_instances
	innodb_page_cleaners

There will be only one buffer pool and one page cleaner task.

In a number of INFORMATION_SCHEMA views, columns that indicated
the buffer pool instance will be removed:

	information_schema.innodb_buffer_page.pool_id
	information_schema.innodb_buffer_page_lru.pool_id
	information_schema.innodb_buffer_pool_stats.pool_id
	information_schema.innodb_cmpmem.buffer_pool_instance
	information_schema.innodb_cmpmem_reset.buffer_pool_instance
parent 0448c614
......@@ -1905,8 +1905,6 @@ static bool innodb_init_param()
srv_buf_pool_size = (ulint) xtrabackup_use_memory;
srv_buf_pool_chunk_unit = (ulong)srv_buf_pool_size;
srv_buf_pool_instances = 1;
srv_n_page_cleaners = 1;
srv_n_file_io_threads = (ulint) innobase_file_io_threads;
srv_n_read_io_threads = (ulint) innobase_read_io_threads;
......
......@@ -99,9 +99,9 @@ GEOMETRY_COLUMNS F_TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
INDEX_STATISTICS TABLE_SCHEMA
INNODB_BUFFER_PAGE POOL_ID
INNODB_BUFFER_PAGE_LRU POOL_ID
INNODB_BUFFER_POOL_STATS POOL_ID
INNODB_BUFFER_PAGE BLOCK_ID
INNODB_BUFFER_PAGE_LRU LRU_POSITION
INNODB_BUFFER_POOL_STATS POOL_SIZE
INNODB_CMP page_size
INNODB_CMPMEM page_size
INNODB_CMPMEM_RESET page_size
......@@ -180,9 +180,9 @@ GEOMETRY_COLUMNS F_TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
INDEX_STATISTICS TABLE_SCHEMA
INNODB_BUFFER_PAGE POOL_ID
INNODB_BUFFER_PAGE_LRU POOL_ID
INNODB_BUFFER_POOL_STATS POOL_ID
INNODB_BUFFER_PAGE BLOCK_ID
INNODB_BUFFER_PAGE_LRU LRU_POSITION
INNODB_BUFFER_POOL_STATS POOL_SIZE
INNODB_CMP page_size
INNODB_CMPMEM page_size
INNODB_CMPMEM_RESET page_size
......
......@@ -22,9 +22,9 @@ ORDER BY table1.NUMBER_RECORDS
LIMIT 0
;
CALL s1;
POOL_ID LRU_POSITION SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE COMPRESSED IO_FIX IS_OLD FREE_PAGE_CLOCK pk f0 f1 f2 f3 f4 f5 f6 f7 f8 f9
LRU_POSITION SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE COMPRESSED IO_FIX IS_OLD FREE_PAGE_CLOCK pk f0 f1 f2 f3 f4 f5 f6 f7 f8 f9
CALL s1;
POOL_ID LRU_POSITION SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE COMPRESSED IO_FIX IS_OLD FREE_PAGE_CLOCK pk f0 f1 f2 f3 f4 f5 f6 f7 f8 f9
LRU_POSITION SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE COMPRESSED IO_FIX IS_OLD FREE_PAGE_CLOCK pk f0 f1 f2 f3 f4 f5 f6 f7 f8 f9
drop table t1;
drop view view_t1;
drop procedure s1;
......
SET @saved_page_cleaners = @@GLOBAL.innodb_page_cleaners;
create table t1 (a int not null primary key auto_increment,
b bigint,
c varchar(200),
d int,
key b (b),
key d (d)) engine=INNODB;
set GLOBAL innodb_page_cleaners = 4;
connect con1,localhost,root,,;
connection con1;
update t1 set b = b + 5, d = d + 1 where a between 1 and 2000;
connect con2,localhost,root,,;
connection con2;
update t1 set b = b + 5, d = d + 1 where a between 3000 and 5000;
connect con3,localhost,root,,;
connection con3;
update t1 set b = b + 5, d = d + 1 where a between 8000 and 12000;
connection default;
set GLOBAL innodb_page_cleaners = 2;
set GLOBAL innodb_page_cleaners = 4;
set GLOBAL innodb_page_cleaners = 6;
connection con1;
connection con2;
connection con3;
connection default;
set GLOBAL innodb_page_cleaners = 4;
connection con1;
update t1 set b = b + 5, d = d + 1 where a between 1 and 2000;
connection con2;
update t1 set b = b + 5, d = d + 1 where a between 3000 and 5000;
connection con3;
update t1 set b = b + 5, d = d + 1 where a between 8000 and 12000;
connection default;
set GLOBAL innodb_page_cleaners = 3;
set GLOBAL innodb_page_cleaners = 2;
set GLOBAL innodb_page_cleaners = 1;
connection con1;
connection con2;
connection con3;
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
DROP TABLE t1;
SET GLOBAL innodb_page_cleaners=@saved_page_cleaners;
......@@ -27,11 +27,11 @@ database_name table_name index_name compress_ops compress_ops_ok compress_time u
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_cmp_per_index_reset but the InnoDB storage engine is not installed
select * from information_schema.innodb_cmpmem;
page_size buffer_pool_instance pages_used pages_free relocation_ops relocation_time
page_size pages_used pages_free relocation_ops relocation_time
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_cmpmem but the InnoDB storage engine is not installed
select * from information_schema.innodb_cmpmem_reset;
page_size buffer_pool_instance pages_used pages_free relocation_ops relocation_time
page_size pages_used pages_free relocation_ops relocation_time
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_cmpmem_reset but the InnoDB storage engine is not installed
select * from information_schema.innodb_metrics;
......@@ -344,11 +344,11 @@ KEY VALUE
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_ft_config but the InnoDB storage engine is not installed
select * from information_schema.innodb_buffer_page;
POOL_ID BLOCK_ID SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE PAGE_STATE IO_FIX IS_OLD FREE_PAGE_CLOCK
BLOCK_ID SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE PAGE_STATE IO_FIX IS_OLD FREE_PAGE_CLOCK
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_buffer_page but the InnoDB storage engine is not installed
select * from information_schema.innodb_buffer_page_lru;
POOL_ID LRU_POSITION SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE COMPRESSED IO_FIX IS_OLD FREE_PAGE_CLOCK
LRU_POSITION SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE COMPRESSED IO_FIX IS_OLD FREE_PAGE_CLOCK
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_buffer_page_lru but the InnoDB storage engine is not installed
select * from information_schema.innodb_buffer_stats;
......
--source include/have_innodb.inc
# This test is slow on buildbot.
--source include/big_test.inc
SET @saved_page_cleaners = @@GLOBAL.innodb_page_cleaners;
create table t1 (a int not null primary key auto_increment,
b bigint,
c varchar(200),
d int,
key b (b),
key d (d)) engine=INNODB;
let $rows = 15000;
--disable_query_log
begin;
while ($rows)
{
eval insert into t1 values(NULL, $rows, 'testing...', $rows+1000);
dec $rows;
}
commit;
--enable_query_log
#
# We want 4 connections: (1) - (3) to create dirty pages
# and default to modify the number of page cleaner threads
#
set GLOBAL innodb_page_cleaners = 4;
connect (con1,localhost,root,,);
connection con1;
send update t1 set b = b + 5, d = d + 1 where a between 1 and 2000;
connect (con2,localhost,root,,);
connection con2;
send update t1 set b = b + 5, d = d + 1 where a between 3000 and 5000;
connect (con3,localhost,root,,);
connection con3;
send update t1 set b = b + 5, d = d + 1 where a between 8000 and 12000;
#
# Page cleaners are increased
#
connection default;
set GLOBAL innodb_page_cleaners = 2;
set GLOBAL innodb_page_cleaners = 4;
set GLOBAL innodb_page_cleaners = 6;
connection con1;
reap;
connection con2;
reap;
connection con3;
reap;
connection default;
set GLOBAL innodb_page_cleaners = 4;
#
# Page cleaners are decreased
#
connection con1;
send update t1 set b = b + 5, d = d + 1 where a between 1 and 2000;
connection con2;
send update t1 set b = b + 5, d = d + 1 where a between 3000 and 5000;
connection con3;
send update t1 set b = b + 5, d = d + 1 where a between 8000 and 12000;
connection default;
set GLOBAL innodb_page_cleaners = 3;
set GLOBAL innodb_page_cleaners = 2;
set GLOBAL innodb_page_cleaners = 1;
connection con1;
reap;
connection con2;
reap;
connection con3;
reap;
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
DROP TABLE t1;
SET GLOBAL innodb_page_cleaners=@saved_page_cleaners;
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
Table Create Table
INNODB_BUFFER_PAGE CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE` (
`POOL_ID` int(11) unsigned NOT NULL DEFAULT 0,
`BLOCK_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
`SPACE` int(11) unsigned NOT NULL DEFAULT 0,
`PAGE_NUMBER` int(11) unsigned NOT NULL DEFAULT 0,
......
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU;
Table Create Table
INNODB_BUFFER_PAGE_LRU CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE_LRU` (
`POOL_ID` int(11) unsigned NOT NULL DEFAULT 0,
`LRU_POSITION` bigint(21) unsigned NOT NULL DEFAULT 0,
`SPACE` int(11) unsigned NOT NULL DEFAULT 0,
`PAGE_NUMBER` int(11) unsigned NOT NULL DEFAULT 0,
......
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
Table Create Table
INNODB_BUFFER_POOL_STATS CREATE TEMPORARY TABLE `INNODB_BUFFER_POOL_STATS` (
`POOL_ID` int(11) unsigned NOT NULL DEFAULT 0,
`POOL_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
`FREE_BUFFERS` bigint(21) unsigned NOT NULL DEFAULT 0,
`DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT 0,
......
......@@ -2,7 +2,6 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMPMEM;
Table Create Table
INNODB_CMPMEM CREATE TEMPORARY TABLE `INNODB_CMPMEM` (
`page_size` int(5) NOT NULL DEFAULT 0,
`buffer_pool_instance` int(11) NOT NULL DEFAULT 0,
`pages_used` int(11) NOT NULL DEFAULT 0,
`pages_free` int(11) NOT NULL DEFAULT 0,
`relocation_ops` bigint(21) NOT NULL DEFAULT 0,
......
......@@ -2,7 +2,6 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMPMEM_RESET;
Table Create Table
INNODB_CMPMEM_RESET CREATE TEMPORARY TABLE `INNODB_CMPMEM_RESET` (
`page_size` int(5) NOT NULL DEFAULT 0,
`buffer_pool_instance` int(11) NOT NULL DEFAULT 0,
`pages_used` int(11) NOT NULL DEFAULT 0,
`pages_free` int(11) NOT NULL DEFAULT 0,
`relocation_ops` bigint(21) NOT NULL DEFAULT 0,
......
......@@ -7,32 +7,40 @@ SELECT @@innodb_page_cleaners;
1
1 Expected
SET @@GLOBAL.innodb_page_cleaners=2;
Warnings:
Warning 138 The parameter innodb_page_cleaners is deprecated and has no effect.
Expected to pass
SELECT @@innodb_page_cleaners;
@@innodb_page_cleaners
2
1
2 Expected
SET @@GLOBAL.innodb_page_cleaners=1;
Warnings:
Warning 138 The parameter innodb_page_cleaners is deprecated and has no effect.
Expected to pass
SELECT @@innodb_page_cleaners;
@@innodb_page_cleaners
1
1 Expected
SET @@GLOBAL.innodb_page_cleaners=6;
Warnings:
Warning 138 The parameter innodb_page_cleaners is deprecated and has no effect.
Expected to pass
SELECT @@innodb_page_cleaners;
@@innodb_page_cleaners
6
1
6 Expected
SET @@GLOBAL.innodb_page_cleaners=4;
Warnings:
Warning 138 The parameter innodb_page_cleaners is deprecated and has no effect.
Expected to pass
SELECT @@innodb_page_cleaners;
@@innodb_page_cleaners
4
1
4 Expected
SET @@GLOBAL.innodb_page_cleaners=0;
Warnings:
Warning 1292 Truncated incorrect innodb_page_cleaners value: '0'
Warning 138 The parameter innodb_page_cleaners is deprecated and has no effect.
Warning expected
SELECT @@innodb_page_cleaners;
@@innodb_page_cleaners
......
......@@ -42,7 +42,7 @@
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Size of a single memory chunk within each buffer pool instance for resizing buffer pool. Online buffer pool resizing happens at this granularity. 0 means disable resizing buffer pool.
VARIABLE_COMMENT Size of a single memory chunk for resizing buffer pool. Online buffer pool resizing happens at this granularity. 0 means disable resizing buffer pool.
NUMERIC_MIN_VALUE 1048576
-NUMERIC_MAX_VALUE 9223372036854775807
+NUMERIC_MAX_VALUE 2147483647
......@@ -64,7 +64,7 @@
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of buffer pool instances, set to higher value on high-end machines to increase scalability
VARIABLE_COMMENT Deprecated parameter with no effect.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 64
@@ -289,7 +289,7 @@
......@@ -377,8 +377,8 @@
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Page cleaner threads can be from 1 to 64. Default is 4.
NUMERIC_MIN_VALUE 1
VARIABLE_COMMENT Deprecated parameter with no effect.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 64
@@ -1513,7 +1513,7 @@
SESSION_VALUE NULL
......
......@@ -158,7 +158,7 @@ SESSION_VALUE NULL
DEFAULT_VALUE 134217728
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Size of a single memory chunk within each buffer pool instance for resizing buffer pool. Online buffer pool resizing happens at this granularity. 0 means disable resizing buffer pool.
VARIABLE_COMMENT Size of a single memory chunk for resizing buffer pool. Online buffer pool resizing happens at this granularity. 0 means disable resizing buffer pool.
NUMERIC_MIN_VALUE 1048576
NUMERIC_MAX_VALUE 9223372036854775807
NUMERIC_BLOCK_SIZE 1048576
......@@ -230,7 +230,7 @@ SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Number of buffer pool instances, set to higher value on high-end machines to increase scalability
VARIABLE_COMMENT Deprecated parameter with no effect.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 64
NUMERIC_BLOCK_SIZE 0
......@@ -1487,11 +1487,11 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT NONE
VARIABLE_NAME INNODB_PAGE_CLEANERS
SESSION_VALUE NULL
DEFAULT_VALUE 4
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Page cleaner threads can be from 1 to 64. Default is 4.
NUMERIC_MIN_VALUE 1
VARIABLE_COMMENT Deprecated parameter with no effect.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 64
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
......
......@@ -2,5 +2,4 @@
--loose-innodb_buffer_pool_load_at_startup=0
--loose-innodb_buffer_pool_dump_at_shutdown=0
--loose-innodb-buffer-pool-size=8M
--loose-innodb-buffer-pool-instances=1
--loose-innodb-page-size=16k
......@@ -1391,7 +1391,6 @@ btr_page_reorganize_low(
mtr_t* mtr) /*!< in/out: mini-transaction */
{
buf_block_t* block = page_cur_get_block(cursor);
buf_pool_t* buf_pool = buf_pool_from_bpage(&block->page);
page_t* page = buf_block_get_frame(block);
page_zip_des_t* page_zip = buf_block_get_page_zip(block);
buf_block_t* temp_block;
......@@ -1420,7 +1419,7 @@ btr_page_reorganize_low(
/* Turn logging off */
mtr_log_t log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
temp_block = buf_block_alloc(buf_pool);
temp_block = buf_block_alloc();
MONITOR_INC(MONITOR_INDEX_REORG_ATTEMPTS);
......
......@@ -1461,7 +1461,7 @@ btr_cur_search_to_nth_level_func(
for them, when the history list is glowing huge. */
if (lock_intention == BTR_INTENTION_DELETE
&& trx_sys.rseg_history_len > BTR_CUR_FINE_HISTORY_LENGTH
&& buf_get_n_pending_read_ios()) {
&& buf_pool->n_pend_reads) {
x_latch_index:
mtr_x_lock_index(index, mtr);
} else if (index->is_spatial()
......@@ -2590,7 +2590,7 @@ btr_cur_open_at_index_side_func(
for them, when the history list is glowing huge. */
if (lock_intention == BTR_INTENTION_DELETE
&& trx_sys.rseg_history_len > BTR_CUR_FINE_HISTORY_LENGTH
&& buf_get_n_pending_read_ios()) {
&& buf_pool->n_pend_reads) {
mtr_x_lock_index(index, mtr);
} else {
mtr_sx_lock_index(index, mtr);
......@@ -2917,7 +2917,7 @@ btr_cur_open_at_rnd_pos_func(
for them, when the history list is glowing huge. */
if (lock_intention == BTR_INTENTION_DELETE
&& trx_sys.rseg_history_len > BTR_CUR_FINE_HISTORY_LENGTH
&& buf_get_n_pending_read_ios()) {
&& buf_pool->n_pend_reads) {
mtr_x_lock_index(index, mtr);
} else {
mtr_sx_lock_index(index, mtr);
......@@ -7267,7 +7267,6 @@ btr_blob_free(
if there is one */
mtr_t* mtr) /*!< in: mini-transaction to commit */
{
buf_pool_t* buf_pool = buf_pool_from_block(block);
ulint space = block->page.id.space();
ulint page_no = block->page.id.page_no();
......@@ -7275,7 +7274,7 @@ btr_blob_free(
mtr_commit(mtr);
buf_pool_mutex_enter(buf_pool);
mutex_enter(&buf_pool->mutex);
/* Only free the block if it is still allocated to
the same file page. */
......@@ -7294,7 +7293,7 @@ btr_blob_free(
}
}
buf_pool_mutex_exit(buf_pool);
mutex_exit(&buf_pool->mutex);
}
/** Helper class used while writing blob pages, during insert or update. */
......
......@@ -2,7 +2,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2017, 2019, MariaDB Corporation.
Copyright (c) 2017, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -206,7 +206,7 @@ btr_search_check_free_space_in_heap(const dict_index_t* index)
be enough free space in the hash table. */
if (heap->free_block == NULL) {
buf_block_t* block = buf_block_alloc(NULL);
buf_block_t* block = buf_block_alloc();
rw_lock_t* ahi_latch = btr_get_search_latch(index);
rw_lock_x_lock(ahi_latch);
......@@ -408,12 +408,12 @@ void btr_search_disable(bool need_mutex)
/** Enable the adaptive hash search system. */
void btr_search_enable()
{
buf_pool_mutex_enter_all();
mutex_enter(&buf_pool->mutex);
if (srv_buf_pool_old_size != srv_buf_pool_size) {
buf_pool_mutex_exit_all();
mutex_exit(&buf_pool->mutex);
return;
}
buf_pool_mutex_exit_all();
mutex_exit(&buf_pool->mutex);
btr_search_x_lock_all();
btr_search_enabled = true;
......@@ -949,7 +949,6 @@ btr_search_guess_on_hash(
}
buf_block_t* block = buf_block_from_ahi(rec);
buf_pool_t* buf_pool = buf_pool_from_block(block);
if (use_latch) {
mutex_enter(&block->mutex);
......@@ -968,7 +967,7 @@ btr_search_guess_on_hash(
buf_block_buf_fix_inc(block, __FILE__, __LINE__);
mutex_exit(&block->mutex);
buf_page_make_young_if_needed(buf_pool, &block->page);
buf_page_make_young_if_needed(&block->page);
mtr_memo_type_t fix_type;
if (latch_mode == BTR_SEARCH_LEAF) {
if (!rw_lock_s_lock_nowait(&block->lock,
......@@ -1081,7 +1080,7 @@ btr_search_guess_on_hash(
++buf_pool->stat.n_page_gets;
if (!ahi_latch) {
buf_page_make_young_if_needed(buf_pool, &block->page);
buf_page_make_young_if_needed(&block->page);
}
return true;
......@@ -1994,23 +1993,23 @@ btr_search_hash_table_validate(ulint hash_table_id)
rec_offs_init(offsets_);
btr_search_x_lock_all();
buf_pool_mutex_enter_all();
mutex_enter(&buf_pool->mutex);
cell_count = hash_get_n_cells(
btr_search_sys->hash_tables[hash_table_id]);
btr_search_sys->hash_tables[hash_table_id]);
for (i = 0; i < cell_count; i++) {
/* We release search latches every once in a while to
give other queries a chance to run. */
if ((i != 0) && ((i % chunk_size) == 0)) {
buf_pool_mutex_exit_all();
mutex_exit(&buf_pool->mutex);
btr_search_x_unlock_all();
os_thread_yield();
btr_search_x_lock_all();
buf_pool_mutex_enter_all();
mutex_enter(&buf_pool->mutex);
ulint curr_cell_count = hash_get_n_cells(
btr_search_sys->hash_tables[hash_table_id]);
......@@ -2032,11 +2031,8 @@ btr_search_hash_table_validate(ulint hash_table_id)
const buf_block_t* block
= buf_block_from_ahi((byte*) node->data);
const buf_block_t* hash_block;
buf_pool_t* buf_pool;
index_id_t page_index_id;
buf_pool = buf_pool_from_bpage((buf_page_t*) block);
if (UNIV_LIKELY(buf_block_get_state(block)
== BUF_BLOCK_FILE_PAGE)) {
......@@ -2046,7 +2042,6 @@ btr_search_hash_table_validate(ulint hash_table_id)
(BUF_BLOCK_REMOVE_HASH, see the
assertion and the comment below) */
hash_block = buf_block_hash_get(
buf_pool,
block->page.id);
} else {
hash_block = NULL;
......@@ -2120,14 +2115,13 @@ btr_search_hash_table_validate(ulint hash_table_id)
/* We release search latches every once in a while to
give other queries a chance to run. */
if (i != 0) {
buf_pool_mutex_exit_all();
mutex_exit(&buf_pool->mutex);
btr_search_x_unlock_all();
os_thread_yield();
btr_search_x_lock_all();
buf_pool_mutex_enter_all();
mutex_enter(&buf_pool->mutex);
ulint curr_cell_count = hash_get_n_cells(
btr_search_sys->hash_tables[hash_table_id]);
......@@ -2150,7 +2144,7 @@ btr_search_hash_table_validate(ulint hash_table_id)
}
}
buf_pool_mutex_exit_all();
mutex_exit(&buf_pool->mutex);
btr_search_x_unlock_all();
if (UNIV_LIKELY_NULL(heap)) {
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
/*****************************************************************************
Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation.
Copyright (c) 2017, 2020, 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
......@@ -253,7 +253,6 @@ buf_dump(
char tmp_filename[OS_FILE_MAX_PATH + sizeof "incomplete"];
char now[32];
FILE* f;
ulint i;
int ret;
buf_dump_generate_path(full_filename, sizeof(full_filename));
......@@ -284,114 +283,99 @@ buf_dump(
tmp_filename, strerror(errno));
return;
}
/* else */
const buf_page_t* bpage;
buf_dump_t* dump;
ulint n_pages;
ulint j;
mutex_enter(&buf_pool->mutex);
/* walk through each buffer pool */
for (i = 0; i < srv_buf_pool_instances && !SHOULD_QUIT(); i++) {
buf_pool_t* buf_pool;
const buf_page_t* bpage;
buf_dump_t* dump;
ulint n_pages;
ulint j;
n_pages = UT_LIST_GET_LEN(buf_pool->LRU);
buf_pool = buf_pool_from_array(i);
/* skip empty buffer pools */
if (n_pages == 0) {
mutex_exit(&buf_pool->mutex);
goto done;
}
/* obtain buf_pool mutex before allocate, since
UT_LIST_GET_LEN(buf_pool->LRU) could change */
buf_pool_mutex_enter(buf_pool);
if (srv_buf_pool_dump_pct != 100) {
ulint t_pages;
n_pages = UT_LIST_GET_LEN(buf_pool->LRU);
/* limit the number of total pages dumped to X% of the
total number of pages */
t_pages = buf_pool->curr_size * srv_buf_pool_dump_pct / 100;
if (n_pages > t_pages) {
buf_dump_status(STATUS_INFO,
"Restricted to " ULINTPF
" pages due to "
"innodb_buf_pool_dump_pct=%lu",
t_pages, srv_buf_pool_dump_pct);
n_pages = t_pages;
}
/* skip empty buffer pools */
if (n_pages == 0) {
buf_pool_mutex_exit(buf_pool);
continue;
n_pages = 1;
}
}
if (srv_buf_pool_dump_pct != 100) {
ulint t_pages;
ut_ad(srv_buf_pool_dump_pct < 100);
/* limit the number of total pages dumped to X% of the
* total number of pages */
t_pages = buf_pool->curr_size
* srv_buf_pool_dump_pct / 100;
if (n_pages > t_pages) {
buf_dump_status(STATUS_INFO,
"Instance " ULINTPF
", restricted to " ULINTPF
" pages due to "
"innodb_buf_pool_dump_pct=%lu",
i, t_pages,
srv_buf_pool_dump_pct);
n_pages = t_pages;
}
dump = static_cast<buf_dump_t*>(ut_malloc_nokey(
n_pages * sizeof(*dump)));
if (n_pages == 0) {
n_pages = 1;
}
if (dump == NULL) {
mutex_exit(&buf_pool->mutex);
fclose(f);
buf_dump_status(STATUS_ERR,
"Cannot allocate " ULINTPF " bytes: %s",
(ulint) (n_pages * sizeof(*dump)),
strerror(errno));
/* leave tmp_filename to exist */
return;
}
for (bpage = UT_LIST_GET_FIRST(buf_pool->LRU), j = 0;
bpage != NULL && j < n_pages;
bpage = UT_LIST_GET_NEXT(LRU, bpage)) {
ut_a(buf_page_in_file(bpage));
if (bpage->id.space() == SRV_TMP_SPACE_ID) {
/* Ignore the innodb_temporary tablespace. */
continue;
}
dump = static_cast<buf_dump_t*>(ut_malloc_nokey(
n_pages * sizeof(*dump)));
dump[j++] = BUF_DUMP_CREATE(bpage->id.space(),
bpage->id.page_no());
}
mutex_exit(&buf_pool->mutex);
if (dump == NULL) {
buf_pool_mutex_exit(buf_pool);
ut_a(j <= n_pages);
n_pages = j;
for (j = 0; j < n_pages && !SHOULD_QUIT(); j++) {
ret = fprintf(f, ULINTPF "," ULINTPF "\n",
BUF_DUMP_SPACE(dump[j]),
BUF_DUMP_PAGE(dump[j]));
if (ret < 0) {
ut_free(dump);
fclose(f);
buf_dump_status(STATUS_ERR,
"Cannot allocate " ULINTPF " bytes: %s",
(ulint) (n_pages * sizeof(*dump)),
strerror(errno));
"Cannot write to '%s': %s",
tmp_filename, strerror(errno));
/* leave tmp_filename to exist */
return;
}
for (bpage = UT_LIST_GET_FIRST(buf_pool->LRU), j = 0;
bpage != NULL && j < n_pages;
bpage = UT_LIST_GET_NEXT(LRU, bpage)) {
ut_a(buf_page_in_file(bpage));
if (bpage->id.space() == SRV_TMP_SPACE_ID) {
/* Ignore the innodb_temporary tablespace. */
continue;
}
dump[j++] = BUF_DUMP_CREATE(bpage->id.space(),
bpage->id.page_no());
}
buf_pool_mutex_exit(buf_pool);
ut_a(j <= n_pages);
n_pages = j;
for (j = 0; j < n_pages && !SHOULD_QUIT(); j++) {
ret = fprintf(f, ULINTPF "," ULINTPF "\n",
BUF_DUMP_SPACE(dump[j]),
BUF_DUMP_PAGE(dump[j]));
if (ret < 0) {
ut_free(dump);
fclose(f);
buf_dump_status(STATUS_ERR,
"Cannot write to '%s': %s",
tmp_filename, strerror(errno));
/* leave tmp_filename to exist */
return;
}
if (SHUTTING_DOWN() && !(j % 1024)) {
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"Dumping buffer pool "
ULINTPF "/%lu, "
"page " ULINTPF "/" ULINTPF,
i + 1, srv_buf_pool_instances,
j + 1, n_pages);
}
if (SHUTTING_DOWN() && !(j & 1023)) {
service_manager_extend_timeout(
INNODB_EXTEND_TIMEOUT_INTERVAL,
"Dumping buffer pool page "
ULINTPF "/" ULINTPF, j + 1, n_pages);
}
ut_free(dump);
}
ut_free(dump);
done:
ret = fclose(f);
if (ret != 0) {
buf_dump_status(STATUS_ERR,
......@@ -517,7 +501,6 @@ buf_load()
FILE* f;
buf_dump_t* dump;
ulint dump_n;
ulint total_buffer_pools_pages;
ulint i;
ulint space_id;
ulint page_no;
......@@ -567,13 +550,9 @@ buf_load()
/* If dump is larger than the buffer pool(s), then we ignore the
extra trailing. This could happen if a dump is made, then buffer
pool is shrunk and then load is attempted. */
total_buffer_pools_pages = buf_pool_get_n_pages()
* srv_buf_pool_instances;
if (dump_n > total_buffer_pools_pages) {
dump_n = total_buffer_pools_pages;
}
dump_n = std::min(dump_n, buf_pool_get_n_pages());
if(dump_n != 0) {
if (dump_n != 0) {
dump = static_cast<buf_dump_t*>(ut_malloc_nokey(
dump_n * sizeof(*dump)));
} else {
......@@ -805,7 +784,7 @@ static void buf_dump_load_func(void *)
while (!SHUTTING_DOWN()) {
if (buf_dump_should_start) {
buf_dump_should_start = false;
buf_dump(TRUE /* quit on shutdown */);
buf_dump(true);
}
if (buf_load_should_start) {
buf_load_should_start = false;
......@@ -827,7 +806,7 @@ static void buf_dump_load_func(void *)
} else if (get_wsrep_recovery()) {
#endif /* WITH_WSREP */
} else {
buf_dump(FALSE/* do complete dump at shutdown */);
buf_dump(false/* do complete dump at shutdown */);
}
}
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -41,11 +41,6 @@ Created 11/5/1995 Heikki Tuuri
#include "srv0start.h"
#include "srv0srv.h"
/** There must be at least this many pages in buf_pool in the area to start
a random read-ahead */
#define BUF_READ_AHEAD_RANDOM_THRESHOLD(b) \
(5 + BUF_READ_AHEAD_AREA(b) / 8)
/** If there are buf_pool->curr_size per the number below pending reads, then
read-ahead is not done: this is to prevent flooding the buffer pool with
i/o-fixed buffer blocks */
......@@ -60,13 +55,12 @@ buf_read_page_handle_error(
/*=======================*/
buf_page_t* bpage) /*!< in: pointer to the block */
{
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
const bool uncompressed = (buf_page_get_state(bpage)
== BUF_BLOCK_FILE_PAGE);
const page_id_t old_page_id = bpage->id;
/* First unfix and release lock on the bpage */
buf_pool_mutex_enter(buf_pool);
mutex_enter(&buf_pool->mutex);
mutex_enter(buf_page_get_mutex(bpage));
ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_READ);
......@@ -88,7 +82,7 @@ buf_read_page_handle_error(
ut_ad(buf_pool->n_pend_reads > 0);
buf_pool->n_pend_reads--;
buf_pool_mutex_exit(buf_pool);
mutex_exit(&buf_pool->mutex);
}
/** Low-level function which reads a page asynchronously from a file to the
......@@ -224,15 +218,12 @@ get read even if we return a positive value! */
ulint
buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf)
{
buf_pool_t* buf_pool = buf_pool_get(page_id);
ulint recent_blocks = 0;
ulint ibuf_mode;
ulint count;
ulint low, high;
dberr_t err = DB_SUCCESS;
ulint i;
const ulint buf_read_ahead_random_area
= BUF_READ_AHEAD_AREA(buf_pool);
if (!srv_random_read_ahead) {
/* Disabled by user */
......@@ -253,6 +244,8 @@ buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf)
return(0);
}
const ulint buf_read_ahead_random_area
= buf_pool->read_ahead_area;
low = (page_id.page_no() / buf_read_ahead_random_area)
* buf_read_ahead_random_area;
......@@ -289,11 +282,11 @@ buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf)
return(0);
}
buf_pool_mutex_enter(buf_pool);
mutex_enter(&buf_pool->mutex);
if (buf_pool->n_pend_reads
> buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
buf_pool_mutex_exit(buf_pool);
mutex_exit(&buf_pool->mutex);
return(0);
}
......@@ -302,25 +295,19 @@ buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf)
that is, reside near the start of the LRU list. */
for (i = low; i < high; i++) {
const buf_page_t* bpage = buf_page_hash_get(
buf_pool, page_id_t(page_id.space(), i));
if (bpage != NULL
&& buf_page_is_accessed(bpage)
&& buf_page_peek_if_young(buf_pool, bpage)) {
recent_blocks++;
if (recent_blocks
>= BUF_READ_AHEAD_RANDOM_THRESHOLD(buf_pool)) {
buf_pool_mutex_exit(buf_pool);
if (const buf_page_t* bpage = buf_page_hash_get(
page_id_t(page_id.space(), i))) {
if (buf_page_is_accessed(bpage)
&& buf_page_peek_if_young(bpage)
&& ++recent_blocks
>= 5 + buf_pool->read_ahead_area / 8) {
mutex_exit(&buf_pool->mutex);
goto read_ahead;
}
}
}
buf_pool_mutex_exit(buf_pool);
mutex_exit(&buf_pool->mutex);
/* Do nothing */
return(0);
......@@ -490,7 +477,6 @@ which could result in a deadlock if the OS does not support asynchronous io.
ulint
buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf)
{
buf_pool_t* buf_pool = buf_pool_get(page_id);
buf_page_t* bpage;
buf_frame_t* frame;
buf_page_t* pred_bpage = NULL;
......@@ -502,8 +488,6 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf)
ulint low, high;
dberr_t err = DB_SUCCESS;
ulint i;
const ulint buf_read_ahead_linear_area
= BUF_READ_AHEAD_AREA(buf_pool);
ulint threshold;
/* check if readahead is disabled */
......@@ -516,6 +500,8 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf)
return(0);
}
const ulint buf_read_ahead_linear_area
= buf_pool->read_ahead_area;
low = (page_id.page_no() / buf_read_ahead_linear_area)
* buf_read_ahead_linear_area;
high = (page_id.page_no() / buf_read_ahead_linear_area + 1)
......@@ -553,11 +539,11 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf)
return(0);
}
buf_pool_mutex_enter(buf_pool);
mutex_enter(&buf_pool->mutex);
if (buf_pool->n_pend_reads
> buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
buf_pool_mutex_exit(buf_pool);
mutex_exit(&buf_pool->mutex);
return(0);
}
......@@ -575,13 +561,12 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf)
/* How many out of order accessed pages can we ignore
when working out the access pattern for linear readahead */
threshold = ut_min(static_cast<ulint>(64 - srv_read_ahead_threshold),
BUF_READ_AHEAD_AREA(buf_pool));
buf_pool->read_ahead_area);
fail_count = 0;
for (i = low; i < high; i++) {
bpage = buf_page_hash_get(buf_pool,
page_id_t(page_id.space(), i));
bpage = buf_page_hash_get(page_id_t(page_id.space(), i));
if (bpage == NULL || !buf_page_is_accessed(bpage)) {
/* Not accessed */
......@@ -607,7 +592,7 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf)
if (fail_count > threshold) {
/* Too many failures: return */
buf_pool_mutex_exit(buf_pool);
mutex_exit(&buf_pool->mutex);
return(0);
}
......@@ -619,10 +604,10 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf)
/* If we got this far, we know that enough pages in the area have
been accessed in the right order: linear read-ahead can be sensible */
bpage = buf_page_hash_get(buf_pool, page_id);
bpage = buf_page_hash_get(page_id);
if (bpage == NULL) {
buf_pool_mutex_exit(buf_pool);
mutex_exit(&buf_pool->mutex);
return(0);
}
......@@ -648,7 +633,7 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf)
pred_offset = fil_page_get_prev(frame);
succ_offset = fil_page_get_next(frame);
buf_pool_mutex_exit(buf_pool);
mutex_exit(&buf_pool->mutex);
if ((page_id.page_no() == low)
&& (succ_offset == page_id.page_no() + 1)) {
......@@ -760,19 +745,14 @@ buf_read_recv_pages(
const ulint zip_size = space->zip_size();
for (ulint i = 0; i < n_stored; i++) {
buf_pool_t* buf_pool;
const page_id_t cur_page_id(space_id, page_nos[i]);
ulint count = 0;
buf_pool = buf_pool_get(cur_page_id);
while (buf_pool->n_pend_reads >= recv_sys.max_blocks() / 2) {
for (ulint count = 0, limit = recv_sys.max_blocks() / 2;
buf_pool->n_pend_reads >= limit; ) {
os_thread_sleep(10000);
count++;
if (!(count % 1000)) {
if (!(++count % 1000)) {
ib::error()
<< "Waited for " << count / 100
......
......@@ -1200,7 +1200,7 @@ static bool fil_crypt_start_encrypting_space(fil_space_t* space)
do {
ulint n_pages = 0;
success = buf_flush_lists(ULINT_MAX, end_lsn, &n_pages);
buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
buf_flush_wait_batch_end(BUF_FLUSH_LIST);
sum_pages += n_pages;
} while (!success);
......@@ -2137,7 +2137,7 @@ fil_crypt_flush_space(
do {
success = buf_flush_lists(ULINT_MAX, end_lsn, &n_pages);
buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
buf_flush_wait_batch_end(BUF_FLUSH_LIST);
sum_pages += n_pages;
} while (!success && !space->is_stopping());
......
This diff is collapsed.
This diff is collapsed.
......@@ -3367,7 +3367,7 @@ ibuf_insert_low(
/* We check if the index page is suitable for buffered entries */
if (buf_page_peek(page_id)
if (buf_page_hash_get(page_id)
|| lock_rec_expl_exist_on_page(page_id.space(),
page_id.page_no())) {
......@@ -3610,20 +3610,14 @@ ibuf_insert(
that the issuer of IBUF_OP_DELETE has called
buf_pool_watch_set(space, page_no). */
{
buf_pool_t* buf_pool = buf_pool_get(page_id);
buf_page_t* bpage
= buf_page_get_also_watch(buf_pool, page_id);
if (bpage != NULL) {
/* A buffer pool watch has been set or the
page has been read into the buffer pool.
Do not buffer the request. If a purge operation
is being buffered, have this request executed
directly on the page in the buffer pool after the
buffered entries for this page have been merged. */
DBUG_RETURN(false);
}
if (buf_page_get_also_watch(page_id)) {
/* A buffer pool watch has been set or the
page has been read into the buffer pool.
Do not buffer the request. If a purge operation
is being buffered, have this request executed
directly on the page in the buffer pool after the
buffered entries for this page have been merged. */
DBUG_RETURN(false);
}
skip_watch:
......
/*****************************************************************************
Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2018, 2020, 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
......@@ -28,60 +29,66 @@ Created December 2006 by Marko Makela
#include "buf0types.h"
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
buf_pool->mutex and must not hold buf_pool->zip_mutex or any
block->mutex. The buf_pool->mutex may be released and reacquired.
This function should only be used for allocating compressed page frames.
/**
@param[in] block size in bytes
@return index of buf_pool->zip_free[], or BUF_BUDDY_SIZES */
inline
ulint
buf_buddy_get_slot(ulint size)
{
ulint i;
ulint s;
ut_ad(ut_is_2pow(size));
ut_ad(size >= UNIV_ZIP_SIZE_MIN);
ut_ad(size <= srv_page_size);
for (i = 0, s = BUF_BUDDY_LOW; s < size; i++, s <<= 1) {
}
ut_ad(i <= BUF_BUDDY_SIZES);
return i;
}
/** Allocate a ROW_FORMAT=COMPRESSED block.
@param[in] i index of buf_pool->zip_free[] or BUF_BUDDY_SIZES
@param[out] lru whether buf_pool->mutex was temporarily released
@return allocated block, never NULL */
byte *buf_buddy_alloc_low(ulint i, bool *lru) MY_ATTRIBUTE((malloc));
/** Allocate a ROW_FORMAT=COMPRESSED block.
The caller must not hold buf_pool->mutex nor buf_pool->zip_mutex nor any
block->mutex.
@param[in] size compressed page size
@param[out] lru whether buf_pool->mutex was temporarily released
@return allocated block, never NULL */
UNIV_INLINE
byte*
buf_buddy_alloc(
/*============*/
buf_pool_t* buf_pool, /*!< in/out: buffer pool in which
the page resides */
ulint size, /*!< in: compressed page size
(between UNIV_ZIP_SIZE_MIN and
srv_page_size) */
bool* lru) /*!< in: pointer to a variable
that will be assigned true if
storage was allocated from the
LRU list and buf_pool->mutex was
temporarily released */
MY_ATTRIBUTE((malloc, nonnull));
/**********************************************************************//**
Deallocate a block. */
UNIV_INLINE
void
buf_buddy_free(
/*===========*/
buf_pool_t* buf_pool, /*!< in/out: buffer pool in which
the block resides */
void* buf, /*!< in: block to be freed, must not
be pointed to by the buffer pool */
ulint size) /*!< in: block size,
up to srv_page_size */
MY_ATTRIBUTE((nonnull));
/** Reallocate a block.
@param[in] buf_pool buffer pool instance
inline byte *buf_buddy_alloc(ulint size, bool *lru= nullptr)
{
return buf_buddy_alloc_low(buf_buddy_get_slot(size), lru);
}
/** Deallocate a block.
@param[in] buf block to be freed, must not be pointed to
by the buffer pool
@param[in] i index of buf_pool->zip_free[], or BUF_BUDDY_SIZES */
void buf_buddy_free_low(void* buf, ulint i);
/** Deallocate a block.
@param[in] buf block to be freed, must not be pointed to
by the buffer pool
@param[in] size block size in bytes */
inline void buf_buddy_free(void* buf, ulint size)
{
buf_buddy_free_low(buf, buf_buddy_get_slot(size));
}
/** Try to reallocate a block.
@param[in] buf block to be reallocated, must be pointed
to by the buffer pool
@param[in] size block size, up to srv_page_size
@retval false if failed because of no free blocks. */
bool
buf_buddy_realloc(
buf_pool_t* buf_pool,
void* buf,
ulint size);
/** Combine all pairs of free buddies.
@param[in] buf_pool buffer pool instance */
void
buf_buddy_condense_free(
buf_pool_t* buf_pool);
#include "buf0buddy.ic"
bool buf_buddy_realloc(void* buf, ulint size);
/** Combine all pairs of free buddies. */
void buf_buddy_condense_free();
#endif /* buf0buddy_h */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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