diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-03-19 11:17:20 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-03-19 11:17:20 +0200 |
commit | 6297a1026db4032ab7b7e28788d0b5b9a1f32aa3 (patch) | |
tree | 8ab3ebe2dbeb198fcf9e36af7590ba19bb593724 | |
parent | 007bb37aff528ac9d48560744c992f1ef7857673 (diff) | |
download | mariadb-git-6297a1026db4032ab7b7e28788d0b5b9a1f32aa3.tar.gz |
MDEV-13626: Import and adjust buffer pool resizing tests from MySQL 5.7
Adapt from 10.2: git cherry-pick bfb5e1c3f0ba57b54f245d7cc2d1dfabaa7c4462
buf_pool_t::chunk_t::create(), buf_pool_t::resize():
Restore or simplify the debug instrumentation.
buf_resize_callback(): Add DBUG_ENTER/DBUG_VOID_RETURN so that
the DBUG_EXECUTE_IF in buf_pool_t::resize() can be triggered.
10 files changed, 634 insertions, 7 deletions
diff --git a/mysql-test/suite/innodb/r/buf_pool_resize_oom.result b/mysql-test/suite/innodb/r/buf_pool_resize_oom.result new file mode 100644 index 00000000000..d8f6872ad6f --- /dev/null +++ b/mysql-test/suite/innodb/r/buf_pool_resize_oom.result @@ -0,0 +1,9 @@ +# +# Bug #21348684 SIGABRT DURING RESIZING THE INNODB BUFFER POOL +# ONLINE WITH MEMORY FULL CONDITION +# +call mtr.add_suppression("InnoDB: failed to allocate the chunk array"); +SET GLOBAL innodb_disable_resize_buffer_pool_debug=OFF; +SET GLOBAL debug_dbug='+d,buf_pool_resize_chunk_null'; +SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + 1048576; +# restart diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result new file mode 100644 index 00000000000..30812b1d198 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result @@ -0,0 +1,52 @@ +SET GLOBAL innodb_buffer_pool_dump_pct=100; +CREATE TABLE ib_bp_test +(a INT AUTO_INCREMENT, b VARCHAR(64), c TEXT, PRIMARY KEY (a), KEY (b, c(128))) +ENGINE=INNODB; +SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; +PAGE_NUMBER +3 +4 +SELECT SPACE INTO @space FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`' AND PAGE_NUMBER=3; +INSERT INTO ib_bp_test +SELECT NULL, REPEAT('b', 64), REPEAT('c', 256) FROM seq_1_to_16382; +SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; +COUNT(*) +594 +SET GLOBAL innodb_buffer_pool_dump_now = ON; +SET GLOBAL innodb_fast_shutdown=0; +# restart +SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; +PAGE_NUMBER +select count(*) from ib_bp_test LIMIT 0; +count(*) +SET GLOBAL innodb_buffer_pool_load_now = ON; +SELECT variable_value +FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +variable_value +Buffer pool(s) load completed at TIMESTAMP_NOW +SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; +COUNT(*) +594 +call mtr.add_suppression("InnoDB: Error parsing"); +SET GLOBAL innodb_buffer_pool_load_now = ON; +# Re-write some valid pages to the dump file, make sure the space +# should be valid but all the page no should be out of bound of the file +# restart +SET GLOBAL innodb_buffer_pool_load_now = ON; +SELECT variable_value +FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +variable_value +Buffer pool(s) load completed at TIMESTAMP_NOW +DROP TABLE ib_bp_test; +SET GLOBAL innodb_buffer_pool_dump_pct=default; +# +# Bug#21371070 [ERROR] INNODB: CANNOT ALLOCATE 0 BYTES: SUCCESS +# +SET GLOBAL innodb_buffer_pool_load_now = ON; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result new file mode 100644 index 00000000000..f1faeb1d554 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result @@ -0,0 +1,107 @@ +set global innodb_file_per_table=ON; +set global innodb_thread_concurrency=20; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connect con3,localhost,root,,; +connect con4,localhost,root,,; +connect con5,localhost,root,,; +connect con6,localhost,root,,; +connect con7,localhost,root,,; +connect con8,localhost,root,,; +create table t2 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t2 (c1, c2) values (1, 1); +create table t3 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t3 (c1, c2) values (1, 1); +create table t4 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t4 (c1, c2) values (1, 1); +create table t5 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t5 (c1, c2) values (1, 1); +create table t6 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t6 (c1, c2) values (1, 1); +create database test2; +create table test2.t7 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into test2.t7 (c1, c2) values (1, 1); +drop table test2.t7; +connection con1; +set @save_dbug=@@global.debug_dbug; +set global debug_dbug="+d,ib_buf_pool_resize_wait_before_resize"; +set global innodb_buffer_pool_size = 12*1024*1024; +set global innodb_buffer_pool_size = 8*1024*1024; +ERROR HY000: Another buffer pool resize is already in progress. +select @@global.innodb_buffer_pool_size; +@@global.innodb_buffer_pool_size +8388608 +select @@global.innodb_adaptive_hash_index; +@@global.innodb_adaptive_hash_index +0 +set global innodb_adaptive_hash_index = ON; +select @@global.innodb_adaptive_hash_index; +@@global.innodb_adaptive_hash_index +0 +set global innodb_adaptive_hash_index = OFF; +select @@global.innodb_adaptive_hash_index; +@@global.innodb_adaptive_hash_index +0 +create table t1 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +connection con2; +set use_stat_tables=never; +analyze table t2; +connection con3; +alter table t3 algorithm=inplace, add index idx (c1); +connection con4; +alter table t4 rename to t0; +connection con5; +drop table t5; +connection con6; +alter table t6 discard tablespace; +connection con7; +drop database test2; +connection con8; +select count(*) > 0 from information_schema.innodb_buffer_page; +connection default; +set global debug_dbug=@save_dbug; +connection con1; +connection con2; +Table Op Msg_type Msg_text +test.t2 analyze status OK +connection con3; +connection con4; +connection con5; +connection con6; +connection con7; +connection con8; +count(*) > 0 +1 +connection default; +disconnect con3; +disconnect con4; +disconnect con5; +disconnect con6; +disconnect con7; +disconnect con8; +disconnect con1; +disconnect con2; +call mtr.add_suppression("\\[ERROR\\] InnoDB: buffer pool 0 : failed to allocate new memory."); +connection default; +set global debug_dbug="+d,ib_buf_chunk_init_fails"; +set global innodb_buffer_pool_size = 16*1024*1024; +set global debug_dbug=@save_dbug; +create table t8 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t8 (c1, c2) values (1, 1); +drop table t8; +drop table t1; +drop table t2; +drop table t3; +drop table t0; +drop table t6; +# +# BUG#23590280 NO WARNING WHEN REDUCING INNODB_BUFFER_POOL_SIZE INSIZE THE FIRST CHUNK +# +set @old_innodb_disable_resize = @@innodb_disable_resize_buffer_pool_debug; +set global innodb_disable_resize_buffer_pool_debug = OFF; +set @before_innodb_buffer_pool_size = @@innodb_buffer_pool_size; +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size; +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size * 2; +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size; +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size; +SET GLOBAL innodb_disable_resize_buffer_pool_debug = @old_innodb_disable_resize; diff --git a/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt b/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt new file mode 100644 index 00000000000..09fd8bd8e35 --- /dev/null +++ b/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt @@ -0,0 +1 @@ +--innodb-buffer-pool-size=8m --innodb-buffer-pool-chunk-size=1m diff --git a/mysql-test/suite/innodb/t/buf_pool_resize_oom.test b/mysql-test/suite/innodb/t/buf_pool_resize_oom.test new file mode 100644 index 00000000000..c5af10ef3d3 --- /dev/null +++ b/mysql-test/suite/innodb/t/buf_pool_resize_oom.test @@ -0,0 +1,28 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/not_embedded.inc + +--echo # +--echo # Bug #21348684 SIGABRT DURING RESIZING THE INNODB BUFFER POOL +--echo # ONLINE WITH MEMORY FULL CONDITION +--echo # + +call mtr.add_suppression("InnoDB: failed to allocate the chunk array"); + +SET GLOBAL innodb_disable_resize_buffer_pool_debug=OFF; +SET GLOBAL debug_dbug='+d,buf_pool_resize_chunk_null'; + +--disable_warnings +SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + 1048576; +--enable_warnings + +let $wait_timeout = 60; +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 27) = 'Resizing buffer pool failed' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; + +--source include/wait_condition.inc +# Restart the server, because the buffer pool would not necessarily be +# shrunk afterwards even if we request it. +--source include/restart_mysqld.inc diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.opt new file mode 100644 index 00000000000..948d874d23d --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.opt @@ -0,0 +1,3 @@ +--innodb-buffer-pool-size=64M +--skip-innodb-buffer-pool-load-at-startup +--skip-innodb-buffer-pool-dump-at-shutdown diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test new file mode 100644 index 00000000000..baced6e9e11 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test @@ -0,0 +1,190 @@ +#Want to skip this test from daily Valgrind execution +--source include/no_valgrind_without_big.inc +# +# Test for the functionality of InnoDB Buffer Pool dump/load. +# + +# This case checks buffer pool dump/load works as expected +# with innodb_buffer_pool_dump_now=ON +# and innodb_buffer_pool_load_now=ON + +--source include/have_innodb.inc +# include/restart_mysqld.inc does not work in embedded mode +--source include/not_embedded.inc +--source include/have_sequence.inc + +--let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)` + +--error 0,1 +--remove_file $file + +# Dump the whole buffer pool because if only a portion of it is dumped, we +# cannot be sure how many of the ib_bp_test's pages will end up in the dump. +SET GLOBAL innodb_buffer_pool_dump_pct=100; + +# Create a table and populate it with some data +CREATE TABLE ib_bp_test +(a INT AUTO_INCREMENT, b VARCHAR(64), c TEXT, PRIMARY KEY (a), KEY (b, c(128))) +ENGINE=INNODB; + +SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; + +SELECT SPACE INTO @space FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`' AND PAGE_NUMBER=3; + +let SPACE=`SELECT @space`; + +INSERT INTO ib_bp_test +SELECT NULL, REPEAT('b', 64), REPEAT('c', 256) FROM seq_1_to_16382; + +SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; + +# Dump +SET GLOBAL innodb_buffer_pool_dump_now = ON; + +# Wait for the dump to complete +--disable_warnings +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at ' + FROM information_schema.global_status + WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'; +--enable_warnings +--source include/wait_condition.inc + +# Confirm the file has been created +--file_exists $file + +# Add some garbage records to the dump file +--let IBDUMPFILE = $file +perl; +my $fn = $ENV{'IBDUMPFILE'}; +open(my $fh, '>>', $fn) || die "perl open($fn): $!"; +print $fh "123456,0\n"; +print $fh "0,123456\n"; +print $fh "123456,123456\n"; +close($fh); +EOF + +--move_file $file $file.now + +# Complete purge (and change buffer merge). +SET GLOBAL innodb_fast_shutdown=0; +--source include/shutdown_mysqld.inc + +# Make sure no dump after shutdown +--error 1 +--file_exists $file + +--source include/start_mysqld.inc + +--move_file $file.now $file + +# See that we have no pages in the LRU +SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; + +# Load the table so that entries in the I_S table do not appear as NULL +select count(*) from ib_bp_test LIMIT 0; + +# Load +SET GLOBAL innodb_buffer_pool_load_now = ON; + +# Wait for the load to complete +--disable_warnings +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) load completed at ' + FROM information_schema.global_status + WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +--enable_warnings +--source include/wait_condition.inc + +# Show the status, interesting if the above timed out +--disable_warnings +--replace_regex /[0-9]{6}[[:space:]]+[0-9]{1,2}:[0-9]{2}:[0-9]{2}/TIMESTAMP_NOW/ +SELECT variable_value +FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +--enable_warnings + +SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; + +# Add some total garbage to the dump file +--let IBDUMPFILE = $file +perl; +my $fn = $ENV{'IBDUMPFILE'}; +open(my $fh, '>>', $fn) || die "perl open($fn): $!"; +print $fh "abcdefg\n"; +close($fh); +EOF + +call mtr.add_suppression("InnoDB: Error parsing"); + +# Load +SET GLOBAL innodb_buffer_pool_load_now = ON; + +# Wait for the load to fail +--disable_warnings +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 13) = 'Error parsing' + FROM information_schema.global_status + WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +--enable_warnings +--source include/wait_condition.inc + +--echo # Re-write some valid pages to the dump file, make sure the space +--echo # should be valid but all the page no should be out of bound of the file +--let IBDUMPFILE = $file +perl; +my $fn = $ENV{'IBDUMPFILE'}; +my $space = $ENV{'SPACE'}; +open(my $fh, '>', $fn) || die "perl open($fn): $!"; +print $fh "$space,10000\n"; +print $fh "$space,10001\n"; +print $fh "$space,10002\n"; +close($fh); +EOF + +# We force the restart so that the table would be closed +--source include/restart_mysqld.inc + +# Load directly, without accessing the table first +SET GLOBAL innodb_buffer_pool_load_now = ON; + +# Wait for the load to complete +--disable_warnings +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) load completed at ' + FROM information_schema.global_status + WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +--enable_warnings +--source include/wait_condition.inc + +# Show the status, interesting if the above timed out +--disable_warnings +--replace_regex /[0-9]{6}[[:space:]]+[0-9]{1,2}:[0-9]{2}:[0-9]{2}/TIMESTAMP_NOW/ +SELECT variable_value +FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +--enable_warnings + +DROP TABLE ib_bp_test; +SET GLOBAL innodb_buffer_pool_dump_pct=default; + +--echo # +--echo # Bug#21371070 [ERROR] INNODB: CANNOT ALLOCATE 0 BYTES: SUCCESS +--echo # + +--let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)` + +# Remove the buffer pool file that exists already +--error 0,1 +--remove_file $file + +# Create an empty buffer pool file +write_file $file; +EOF + +SET GLOBAL innodb_buffer_pool_load_now = ON; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt new file mode 100644 index 00000000000..dca040ea893 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt @@ -0,0 +1 @@ +--innodb-buffer-pool-size=8M --innodb-buffer-pool-chunk-size=2M diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.test new file mode 100644 index 00000000000..4f5ee089852 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.test @@ -0,0 +1,239 @@ +# +# WL6117 : Resize the InnoDB Buffer Pool Online +# (concurrent sql; allocation fail;) +# + +--source include/have_innodb.inc +--source include/have_debug.inc + +--disable_query_log +set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size; +set @old_innodb_file_per_table = @@innodb_file_per_table; +set @old_innodb_thread_concurrency = @@innodb_thread_concurrency; +set @old_innodb_thread_sleep_delay = @@innodb_thread_sleep_delay; +set @old_innodb_disable_resize = @@innodb_disable_resize_buffer_pool_debug; +set global innodb_disable_resize_buffer_pool_debug = OFF; +call mtr.add_suppression("\\[ERROR\\] InnoDB: failed to allocate memory for buffer pool chunk"); +--enable_query_log + +# Save the initial number of concurrent sessions +--source include/count_sessions.inc + +let $wait_timeout = 180; + +set global innodb_file_per_table=ON; +set global innodb_thread_concurrency=20; + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); +connect (con3,localhost,root,,); +connect (con4,localhost,root,,); +connect (con5,localhost,root,,); +connect (con6,localhost,root,,); +connect (con7,localhost,root,,); +connect (con8,localhost,root,,); + +create table t2 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t2 (c1, c2) values (1, 1); + +create table t3 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t3 (c1, c2) values (1, 1); + +create table t4 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t4 (c1, c2) values (1, 1); + +create table t5 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t5 (c1, c2) values (1, 1); + +create table t6 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t6 (c1, c2) values (1, 1); + +create database test2; +create table test2.t7 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into test2.t7 (c1, c2) values (1, 1); +drop table test2.t7; + +connection con1; +set @save_dbug=@@global.debug_dbug; +set global debug_dbug="+d,ib_buf_pool_resize_wait_before_resize"; +set global innodb_buffer_pool_size = 12*1024*1024; + +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 30) = 'Latching whole of buffer pool.' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc + +# trying to update innodb_buffer_pool_size +--error ER_WRONG_ARGUMENTS +set global innodb_buffer_pool_size = 8*1024*1024; +select @@global.innodb_buffer_pool_size; + +# trying to control adaptive hash index +select @@global.innodb_adaptive_hash_index; +set global innodb_adaptive_hash_index = ON; +select @@global.innodb_adaptive_hash_index; +set global innodb_adaptive_hash_index = OFF; +select @@global.innodb_adaptive_hash_index; + +# - create table +--send create table t1 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB + +connection con2; +# - analyze table +set use_stat_tables=never; +--send analyze table t2 + +connection con3; +# - alter table ... algorithm=inplace +--send alter table t3 algorithm=inplace, add index idx (c1) + +connection con4; +# - alter table ... rename to +--send alter table t4 rename to t0 + +connection con5; +# - drop table +--send drop table t5 + +connection con6; +# - alter table ... discard tablespace +--send alter table t6 discard tablespace + +connection con7; +# - drop database +--send drop database test2 + +connection con8; +# information schema INNODB_BUFFER_PAGE +--send select count(*) > 0 from information_schema.innodb_buffer_page + +connection default; +set global debug_dbug=@save_dbug; + +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at ' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc + +connection con1; +--reap + +connection con2; +--reap + +connection con3; +--reap + +connection con4; +--reap + +connection con5; +--reap + +connection con6; +--reap + +connection con7; +--reap + +connection con8; +--reap + +connection default; + +disconnect con3; +disconnect con4; +disconnect con5; +disconnect con6; +disconnect con7; +disconnect con8; +disconnect con1; +disconnect con2; + +# fails to allocate new chunks +call mtr.add_suppression("\\[ERROR\\] InnoDB: buffer pool 0 : failed to allocate new memory."); +connection default; +set global debug_dbug="+d,ib_buf_chunk_init_fails"; +set global innodb_buffer_pool_size = 16*1024*1024; +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 27) = 'Resizing buffer pool failed' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc +set global debug_dbug=@save_dbug; + +# can be used as usual, even if failed to allocate +create table t8 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t8 (c1, c2) values (1, 1); +drop table t8; + +drop table t1; +drop table t2; +drop table t3; +drop table t0; +drop table t6; + +--disable_query_log +set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size; +set global innodb_file_per_table = @old_innodb_file_per_table; +set global innodb_thread_concurrency = @old_innodb_thread_concurrency; +set global innodb_thread_sleep_delay = @old_innodb_thread_sleep_delay; +set global innodb_disable_resize_buffer_pool_debug = @old_innodb_disable_resize; +--enable_query_log + +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at ' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc + +# Wait till all disconnects are completed] +--source include/wait_until_count_sessions.inc + +--echo # +--echo # BUG#23590280 NO WARNING WHEN REDUCING INNODB_BUFFER_POOL_SIZE INSIZE THE FIRST CHUNK +--echo # + +set @old_innodb_disable_resize = @@innodb_disable_resize_buffer_pool_debug; +set global innodb_disable_resize_buffer_pool_debug = OFF; +set @before_innodb_buffer_pool_size = @@innodb_buffer_pool_size; + +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size; + +let $wait_timeout = 60; +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 19) = 'Size did not change' + FROM information_schema.global_status + WHERE VARIABLE_NAME = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc + +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size * 2; + +let $wait_timeout = 60; +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 9) = 'Completed' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc + +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size; + +let $wait_timeout = 60; +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 9) = 'Completed' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc + +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size; + +let $wait_timeout = 60; +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 19) = 'Size did not change' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc + +SET GLOBAL innodb_disable_resize_buffer_pool_debug = @old_innodb_disable_resize; diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 99bd2ea712c..1e181872e87 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1360,6 +1360,7 @@ buf_block_init(buf_block_t* block, byte* frame) @return whether the allocation succeeded */ inline bool buf_pool_t::chunk_t::create(size_t bytes) { + DBUG_EXECUTE_IF("ib_buf_chunk_init_fails", return false;); /* Round down to a multiple of page size, although it already should be. */ bytes= ut_2pow_round<size_t>(bytes, srv_page_size); @@ -2317,13 +2318,7 @@ withdraw_retry: ut_zalloc_nokey_nofatal(new_chunks_size)); DBUG_EXECUTE_IF("buf_pool_resize_chunk_null", - { - static int count = 0; - if (count++ == 1) { - ut_free(new_chunks); - new_chunks= nullptr; - } - }); + { ut_free(new_chunks); new_chunks= nullptr; }); if (!new_chunks) { ib::error() << "failed to allocate" @@ -2497,6 +2492,7 @@ calc_buf_pool_size: /** Thread pool task invoked by innodb_buffer_pool_size changes. */ static void buf_resize_callback(void *) { + DBUG_ENTER("buf_resize_callback"); ut_a(srv_shutdown_state == SRV_SHUTDOWN_NONE); mutex_enter(&buf_pool.mutex); const auto size= srv_buf_pool_size; @@ -2511,6 +2507,7 @@ static void buf_resize_callback(void *) sout << "Size did not change: old size = new size = " << size; buf_resize_status(sout.str().c_str()); } + DBUG_VOID_RETURN; } /* Ensure that task does not run in parallel, by setting max_concurrency to 1 for the thread group */ |