mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-13626: Import and adjust buffer pool resizing tests from MySQL 5.7
This commit is contained in:
8
mysql-test/suite/innodb/r/buf_pool_resize_oom.result
Normal file
8
mysql-test/suite/innodb/r/buf_pool_resize_oom.result
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#
|
||||||
|
# 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;
|
46
mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result
Normal file
46
mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
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 COUNT(*) FROM information_schema.innodb_buffer_page_lru
|
||||||
|
WHERE table_name LIKE '%ib_bp_test%';
|
||||||
|
COUNT(*)
|
||||||
|
2
|
||||||
|
SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru
|
||||||
|
WHERE table_name LIKE '%ib_bp_test%';
|
||||||
|
COUNT(*)
|
||||||
|
{checked_valid}
|
||||||
|
SET GLOBAL innodb_buffer_pool_dump_now = ON;
|
||||||
|
SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru
|
||||||
|
WHERE table_name LIKE '%ib_bp_test%';
|
||||||
|
COUNT(*)
|
||||||
|
0
|
||||||
|
select count(*) from ib_bp_test where a = 1;
|
||||||
|
count(*)
|
||||||
|
1
|
||||||
|
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 LIKE '%ib_bp_test%';
|
||||||
|
COUNT(*)
|
||||||
|
{checked_valid}
|
||||||
|
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
|
||||||
|
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;
|
109
mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result
Normal file
109
mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
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;
|
||||||
|
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 @save_disable = @@GLOBAL.innodb_disable_background_merge;
|
||||||
|
SET GLOBAL innodb_disable_background_merge = ON;
|
||||||
|
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;
|
||||||
|
SET GLOBAL innodb_disable_background_merge = @save_disable;
|
1
mysql-test/suite/innodb/t/buf_pool_resize_oom.opt
Normal file
1
mysql-test/suite/innodb/t/buf_pool_resize_oom.opt
Normal file
@ -0,0 +1 @@
|
|||||||
|
--innodb-buffer-pool-size=1G
|
30
mysql-test/suite/innodb/t/buf_pool_resize_oom.test
Normal file
30
mysql-test/suite/innodb/t/buf_pool_resize_oom.test
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
--source include/have_innodb.inc
|
||||||
|
--source include/have_debug.inc
|
||||||
|
# Allocating 1 GiB of buffer pool is pretty steep!
|
||||||
|
--source include/big_test.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
|
@ -0,0 +1,3 @@
|
|||||||
|
--innodb-buffer-pool-size=64M
|
||||||
|
--skip-innodb-buffer-pool-load-at-startup
|
||||||
|
--skip-innodb-buffer-pool-dump-at-shutdown
|
201
mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test
Normal file
201
mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
#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
|
||||||
|
|
||||||
|
--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;
|
||||||
|
|
||||||
|
let $check_cnt =
|
||||||
|
SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru
|
||||||
|
WHERE table_name LIKE '%ib_bp_test%';
|
||||||
|
|
||||||
|
--let SPACE = `SELECT space FROM information_schema.innodb_sys_tables WHERE name LIKE '%ib_bp_test%'`
|
||||||
|
|
||||||
|
# See that we have a small number of pages in the LRU
|
||||||
|
--eval $check_cnt
|
||||||
|
|
||||||
|
# Here we end up with 16382 rows in the table
|
||||||
|
--disable_query_log
|
||||||
|
INSERT INTO ib_bp_test (b, c) VALUES (REPEAT('b', 64), REPEAT('c', 256));
|
||||||
|
INSERT INTO ib_bp_test (b, c) VALUES (REPEAT('B', 64), REPEAT('C', 256));
|
||||||
|
let $i=12;
|
||||||
|
while ($i)
|
||||||
|
{
|
||||||
|
--eval INSERT INTO ib_bp_test (b, c) VALUES ($i, $i * $i);
|
||||||
|
INSERT INTO ib_bp_test (b, c) SELECT b, c FROM ib_bp_test;
|
||||||
|
dec $i;
|
||||||
|
}
|
||||||
|
--enable_query_log
|
||||||
|
|
||||||
|
# Accept 83 for 64k page size, 163 for 32k page size, 329 for 16k page size,
|
||||||
|
# 662 for 8k page size & 1392 for 4k page size
|
||||||
|
--replace_result 83 {checked_valid} 163 {checked_valid} 329 {checked_valid} 662 {checked_valid} 1392 {checked_valid}
|
||||||
|
--eval $check_cnt
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
--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
|
||||||
|
--eval $check_cnt
|
||||||
|
|
||||||
|
# Load the table so that entries in the I_S table do not appear as NULL
|
||||||
|
select count(*) from ib_bp_test where a = 1;
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Accept 83 for 64k page size, 163 for 32k page size, 329 for 16k page size,
|
||||||
|
# 662 for 8k page size & 1392 for 4k page size
|
||||||
|
--replace_result 83 {checked_valid} 163 {checked_valid} 329 {checked_valid} 662 {checked_valid} 1392 {checked_valid}
|
||||||
|
--eval $check_cnt
|
||||||
|
|
||||||
|
# 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;
|
@ -0,0 +1 @@
|
|||||||
|
--innodb-buffer-pool-size=8M --innodb-buffer-pool-chunk-size=2M
|
241
mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.test
Normal file
241
mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.test
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
#
|
||||||
|
# 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;
|
||||||
|
--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
|
||||||
|
--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 @save_disable = @@GLOBAL.innodb_disable_background_merge;
|
||||||
|
SET GLOBAL innodb_disable_background_merge = ON;
|
||||||
|
|
||||||
|
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;
|
||||||
|
SET GLOBAL innodb_disable_background_merge = @save_disable;
|
Reference in New Issue
Block a user