1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-36781: Assertion i < BUF_BUDDY_SIZES failed in buf_buddy_shrink()

buf_buddy_shrink(): Properly cover the case when KEY_BLOCK_SIZE
corresponds to the innodb_page_size, that is, the ROW_FORMAT=COMPRESSED
page frame is directly allocated from the buffer pool, not via the
binary buddy allocator.

buf_LRU_check_size_of_non_data_objects(): Avoid a crash when the
buffer pool is being shrunk.

buf_pool_t::shrink(): Abort if over 95% of the shrunk buffer pool
would be occupied by the adaptive hash index or record locks.
This commit is contained in:
Marko Mäkelä
2025-05-13 12:27:46 +03:00
parent 56e0be34bc
commit bb48d7bc81
6 changed files with 31 additions and 15 deletions

View File

@@ -12,12 +12,19 @@ select @@innodb_buffer_pool_size;
10485760
create table t1 (id int primary key, val int not null)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
create table t2 (id int primary key, val int not null)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=$kbs;
SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR
INSERT INTO t1 SELECT seq*4,seq*4 FROM seq_1_to_262144;
SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR
INSERT INTO t2 SELECT seq*4,seq*4 FROM seq_1_to_16384;
set global innodb_buffer_pool_size = 7340032;
select count(val) from t1;
count(val)
262144
select count(val) from t2;
count(val)
16384
set global innodb_adaptive_hash_index=OFF;
set global innodb_buffer_pool_size = 24117248;
set global innodb_buffer_pool_size = 26214400;
@@ -29,7 +36,10 @@ select @@innodb_buffer_pool_size;
select count(val) from t1;
count(val)
262144
drop table t1;
select count(val) from t2;
count(val)
16384
drop table t1,t2;
SET GLOBAL innodb_max_purge_lag_wait = 0;
SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct;
SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm;

View File

@@ -21,6 +21,7 @@ set global innodb_buffer_pool_size = 9437184;
set global innodb_buffer_pool_size = 10485760;
select @@innodb_buffer_pool_size;
let $kbs=`SELECT CAST(@@innodb_page_size / 1024 AS INT)`;
# fill buffer pool
--disable_query_log
@@ -29,9 +30,13 @@ SET GLOBAL innodb_read_only_compressed=OFF;
--enable_query_log
create table t1 (id int primary key, val int not null)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
evalp create table t2 (id int primary key, val int not null)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=$kbs;
SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR
INSERT INTO t1 SELECT seq*4,seq*4 FROM seq_1_to_262144;
SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR
INSERT INTO t2 SELECT seq*4,seq*4 FROM seq_1_to_16384;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
@@ -42,6 +47,7 @@ SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
set global innodb_buffer_pool_size = 7340032;
select count(val) from t1;
select count(val) from t2;
set global innodb_adaptive_hash_index=OFF;
@@ -52,8 +58,9 @@ set global innodb_buffer_pool_size = 26214400;
select @@innodb_buffer_pool_size;
select count(val) from t1;
select count(val) from t2;
drop table t1;
drop table t1,t2;
SET GLOBAL innodb_max_purge_lag_wait = 0;
SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct;
@@ -66,8 +73,6 @@ SELECT variable_value = 0
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY';
--source include/wait_condition.inc
# this may occasionally be aborted on a heavily loaded builder
--error 0,ER_WRONG_USAGE
SET GLOBAL innodb_buffer_pool_size = @old_innodb_buffer_pool_size;
SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index;
SET GLOBAL innodb_max_dirty_pages_pct = @save_pct;