Skip to content

Commit bfb5e1c

Browse files
committed
MDEV-13626: Import and adjust buffer pool resizing tests from MySQL 5.7
1 parent e28b4b6 commit bfb5e1c

9 files changed

+640
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# Bug #21348684 SIGABRT DURING RESIZING THE INNODB BUFFER POOL
3+
# ONLINE WITH MEMORY FULL CONDITION
4+
#
5+
call mtr.add_suppression("InnoDB: .* failed to allocate the chunk array");
6+
SET GLOBAL innodb_disable_resize_buffer_pool_debug=OFF;
7+
SET GLOBAL debug_dbug='+d,buf_pool_resize_chunk_null';
8+
SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + 1048576;
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
SET GLOBAL innodb_buffer_pool_dump_pct=100;
2+
CREATE TABLE ib_bp_test
3+
(a INT AUTO_INCREMENT, b VARCHAR(64), c TEXT, PRIMARY KEY (a), KEY (b, c(128)))
4+
ENGINE=INNODB;
5+
SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru
6+
WHERE table_name LIKE '%ib_bp_test%';
7+
COUNT(*)
8+
2
9+
SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru
10+
WHERE table_name LIKE '%ib_bp_test%';
11+
COUNT(*)
12+
{checked_valid}
13+
SET GLOBAL innodb_buffer_pool_dump_now = ON;
14+
SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru
15+
WHERE table_name LIKE '%ib_bp_test%';
16+
COUNT(*)
17+
0
18+
select count(*) from ib_bp_test where a = 1;
19+
count(*)
20+
1
21+
SET GLOBAL innodb_buffer_pool_load_now = ON;
22+
SELECT variable_value
23+
FROM information_schema.global_status
24+
WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
25+
variable_value
26+
Buffer pool(s) load completed at TIMESTAMP_NOW
27+
SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru
28+
WHERE table_name LIKE '%ib_bp_test%';
29+
COUNT(*)
30+
{checked_valid}
31+
call mtr.add_suppression("InnoDB: Error parsing");
32+
SET GLOBAL innodb_buffer_pool_load_now = ON;
33+
# Re-write some valid pages to the dump file, make sure the space
34+
# should be valid but all the page no should be out of bound of the file
35+
SET GLOBAL innodb_buffer_pool_load_now = ON;
36+
SELECT variable_value
37+
FROM information_schema.global_status
38+
WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
39+
variable_value
40+
Buffer pool(s) load completed at TIMESTAMP_NOW
41+
DROP TABLE ib_bp_test;
42+
SET GLOBAL innodb_buffer_pool_dump_pct=default;
43+
#
44+
# Bug#21371070 [ERROR] INNODB: CANNOT ALLOCATE 0 BYTES: SUCCESS
45+
#
46+
SET GLOBAL innodb_buffer_pool_load_now = ON;
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
set global innodb_file_per_table=ON;
2+
set global innodb_thread_concurrency=20;
3+
connect con1,localhost,root,,;
4+
connect con2,localhost,root,,;
5+
connect con3,localhost,root,,;
6+
connect con4,localhost,root,,;
7+
connect con5,localhost,root,,;
8+
connect con6,localhost,root,,;
9+
connect con7,localhost,root,,;
10+
connect con8,localhost,root,,;
11+
create table t2 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
12+
insert into t2 (c1, c2) values (1, 1);
13+
create table t3 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
14+
insert into t3 (c1, c2) values (1, 1);
15+
create table t4 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
16+
insert into t4 (c1, c2) values (1, 1);
17+
create table t5 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
18+
insert into t5 (c1, c2) values (1, 1);
19+
create table t6 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
20+
insert into t6 (c1, c2) values (1, 1);
21+
create database test2;
22+
create table test2.t7 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
23+
insert into test2.t7 (c1, c2) values (1, 1);
24+
drop table test2.t7;
25+
connection con1;
26+
set @save_dbug=@@global.debug_dbug;
27+
set global debug_dbug="+d,ib_buf_pool_resize_wait_before_resize";
28+
set global innodb_buffer_pool_size = 12*1024*1024;
29+
set global innodb_buffer_pool_size = 8*1024*1024;
30+
ERROR HY000: Another buffer pool resize is already in progress.
31+
select @@global.innodb_buffer_pool_size;
32+
@@global.innodb_buffer_pool_size
33+
8388608
34+
select @@global.innodb_adaptive_hash_index;
35+
@@global.innodb_adaptive_hash_index
36+
0
37+
set global innodb_adaptive_hash_index = ON;
38+
select @@global.innodb_adaptive_hash_index;
39+
@@global.innodb_adaptive_hash_index
40+
0
41+
set global innodb_adaptive_hash_index = OFF;
42+
select @@global.innodb_adaptive_hash_index;
43+
@@global.innodb_adaptive_hash_index
44+
0
45+
create table t1 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
46+
connection con2;
47+
analyze table t2;
48+
connection con3;
49+
alter table t3 algorithm=inplace, add index idx (c1);
50+
connection con4;
51+
alter table t4 rename to t0;
52+
connection con5;
53+
drop table t5;
54+
connection con6;
55+
alter table t6 discard tablespace;
56+
connection con7;
57+
drop database test2;
58+
connection con8;
59+
select count(*) > 0 from information_schema.innodb_buffer_page;
60+
connection default;
61+
set global debug_dbug=@save_dbug;
62+
connection con1;
63+
connection con2;
64+
Table Op Msg_type Msg_text
65+
test.t2 analyze status OK
66+
connection con3;
67+
connection con4;
68+
connection con5;
69+
connection con6;
70+
connection con7;
71+
connection con8;
72+
count(*) > 0
73+
1
74+
connection default;
75+
disconnect con3;
76+
disconnect con4;
77+
disconnect con5;
78+
disconnect con6;
79+
disconnect con7;
80+
disconnect con8;
81+
disconnect con1;
82+
disconnect con2;
83+
call mtr.add_suppression("\\[ERROR\\] InnoDB: buffer pool 0 : failed to allocate new memory.");
84+
connection default;
85+
set global debug_dbug="+d,ib_buf_chunk_init_fails";
86+
set global innodb_buffer_pool_size = 16*1024*1024;
87+
set global debug_dbug=@save_dbug;
88+
create table t8 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
89+
insert into t8 (c1, c2) values (1, 1);
90+
drop table t8;
91+
drop table t1;
92+
drop table t2;
93+
drop table t3;
94+
drop table t0;
95+
drop table t6;
96+
#
97+
# BUG#23590280 NO WARNING WHEN REDUCING INNODB_BUFFER_POOL_SIZE INSIZE THE FIRST CHUNK
98+
#
99+
SET @save_disable = @@GLOBAL.innodb_disable_background_merge;
100+
SET GLOBAL innodb_disable_background_merge = ON;
101+
set @old_innodb_disable_resize = @@innodb_disable_resize_buffer_pool_debug;
102+
set global innodb_disable_resize_buffer_pool_debug = OFF;
103+
set @before_innodb_buffer_pool_size = @@innodb_buffer_pool_size;
104+
set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size;
105+
set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size * 2;
106+
set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size;
107+
set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size;
108+
SET GLOBAL innodb_disable_resize_buffer_pool_debug = @old_innodb_disable_resize;
109+
SET GLOBAL innodb_disable_background_merge = @save_disable;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--innodb-buffer-pool-size=1G
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--source include/have_innodb.inc
2+
--source include/have_debug.inc
3+
# Allocating 1 GiB of buffer pool is pretty steep!
4+
--source include/big_test.inc
5+
--source include/not_embedded.inc
6+
7+
--echo #
8+
--echo # Bug #21348684 SIGABRT DURING RESIZING THE INNODB BUFFER POOL
9+
--echo # ONLINE WITH MEMORY FULL CONDITION
10+
--echo #
11+
12+
call mtr.add_suppression("InnoDB: .* failed to allocate the chunk array");
13+
14+
SET GLOBAL innodb_disable_resize_buffer_pool_debug=OFF;
15+
SET GLOBAL debug_dbug='+d,buf_pool_resize_chunk_null';
16+
17+
--disable_warnings
18+
SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + 1048576;
19+
--enable_warnings
20+
21+
let $wait_timeout = 60;
22+
let $wait_condition =
23+
SELECT SUBSTR(variable_value, 1, 27) = 'Resizing buffer pool failed'
24+
FROM information_schema.global_status
25+
WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS';
26+
27+
--source include/wait_condition.inc
28+
# Restart the server, because the buffer pool would not necessarily be
29+
# shrunk afterwards even if we request it.
30+
--source include/restart_mysqld.inc
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--innodb-buffer-pool-size=64M
2+
--skip-innodb-buffer-pool-load-at-startup
3+
--skip-innodb-buffer-pool-dump-at-shutdown

0 commit comments

Comments
 (0)