Skip to content

Commit 84379b0

Browse files
committed
MDEV-11454: Add test case innodb_buffer_pool_dump_pct
Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
1 parent d04cb70 commit 84379b0

File tree

3 files changed

+169
-0
lines changed

3 files changed

+169
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
SET GLOBAL innodb_buffer_pool_dump_pct=25, global innodb_buffer_pool_dump_at_shutdown=1;;
2+
# populate with data
3+
CREATE TABLE t1 (
4+
c01 blob, c02 blob, c03 blob, c04 blob, c05 blob,
5+
c06 blob, c07 blob, c08 blob, c09 blob, c10 blob,
6+
c11 blob, c12 blob, c13 blob, c14 blob, c15 blob,
7+
c16 blob, c17 blob, c18 blob, c19 blob, c20 blob,
8+
c21 blob, c22 blob, c23 blob, c24 blob, c25 blob,
9+
c26 blob, c27 blob, c28 blob, c29 blob, c30 blob,
10+
c31 blob, c32 blob, c33 blob, c34 blob, c35 blob,
11+
c36 blob, c37 blob, c38 blob, c39 blob, c40 blob,
12+
c41 blob, c42 blob, c43 blob, c44 blob, c45 blob,
13+
c46 blob, c47 blob, c48 blob, c49 blob, c50 blob,
14+
c51 blob, c52 blob, c53 blob, c54 blob, c55 blob,
15+
c56 blob, c57 blob, c58 blob, c59 blob, c60 blob,
16+
c61 blob, c62 blob, c63 blob, c64 blob
17+
) ROW_FORMAT=dynamic;
18+
SET @a = repeat('a', 16 * 1024);
19+
INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,
20+
@a,@a,@a,@a,@a,
21+
@a,@a,@a,@a,@a,
22+
@a,@a,@a,@a,@a,
23+
@a,@a,@a,@a,@a,
24+
@a,@a,@a,@a,@a,
25+
@a,@a,@a,@a,@a,
26+
@a,@a,@a,@a,@a,
27+
@a,@a,@a,@a,@a,
28+
@a,@a,@a,@a,@a,
29+
@a,@a,@a,@a,@a,
30+
@a,@a,@a,@a,@a,
31+
@a,@a,@a,@a
32+
);
33+
insert into t1 select * from t1;
34+
# Restart server
35+
SET GLOBAL innodb_buffer_pool_load_now=1;
36+
# Case 1: Limit from innodb_buffer_pool_dump_pct
37+
SELECT 256 as 'Previous pool pages',
38+
ROUND(25 / 100 * @@innodb_buffer_pool_size / @@innodb_page_size) as 'Limit',
39+
128 as 'Pages saved';
40+
Previous pool pages Limit Pages saved
41+
256 128 128
42+
# Case 2: blog_pages is the minimum.
43+
# load buffer pool with entire table.
44+
select * from t1;
45+
SET GLOBAL innodb_buffer_pool_dump_pct=75, global innodb_buffer_pool_dump_at_shutdown=1;
46+
# Restart server
47+
SET GLOBAL innodb_buffer_pool_load_now=1;
48+
# now loaded
49+
SELECT 256 as 'Previous pool pages',
50+
ROUND(75 / 100 * @@innodb_buffer_pool_size / @@innodb_page_size) as 'Limit',
51+
256 as 'Pages saved';
52+
Previous pool pages Limit Pages saved
53+
256 384 256
54+
DROP TABLE t1;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
--loose-default-storage-engine=innodb
2+
--loose-innodb_buffer_pool_load_at_startup=0
3+
--loose-innodb_buffer_pool_dump_at_shutdown=0
4+
--loose-innodb-buffer-pool-size=8M
5+
--loose-innodb-page-size=16k
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#
2+
# Functional test for innodb_buffer_pool_dump_pct
3+
#
4+
# From MDEV-11454 the amount dumped is the minimum of:
5+
# * innodb_buffer_pool_dump_pct * Innodb_buffer_pool_pages_total * innodb_page_size
6+
# * innodb_buffer_pool_pages_data * innodb_page_size
7+
8+
-- source include/have_innodb.inc
9+
10+
--let $PCT=25
11+
12+
--eval SET GLOBAL innodb_buffer_pool_dump_pct=$PCT, global innodb_buffer_pool_dump_at_shutdown=1;
13+
14+
--echo # populate with data
15+
16+
CREATE TABLE t1 (
17+
c01 blob, c02 blob, c03 blob, c04 blob, c05 blob,
18+
c06 blob, c07 blob, c08 blob, c09 blob, c10 blob,
19+
c11 blob, c12 blob, c13 blob, c14 blob, c15 blob,
20+
c16 blob, c17 blob, c18 blob, c19 blob, c20 blob,
21+
c21 blob, c22 blob, c23 blob, c24 blob, c25 blob,
22+
c26 blob, c27 blob, c28 blob, c29 blob, c30 blob,
23+
c31 blob, c32 blob, c33 blob, c34 blob, c35 blob,
24+
c36 blob, c37 blob, c38 blob, c39 blob, c40 blob,
25+
c41 blob, c42 blob, c43 blob, c44 blob, c45 blob,
26+
c46 blob, c47 blob, c48 blob, c49 blob, c50 blob,
27+
c51 blob, c52 blob, c53 blob, c54 blob, c55 blob,
28+
c56 blob, c57 blob, c58 blob, c59 blob, c60 blob,
29+
c61 blob, c62 blob, c63 blob, c64 blob
30+
) ROW_FORMAT=dynamic;
31+
32+
SET @a = repeat('a', 16 * 1024);
33+
INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,
34+
@a,@a,@a,@a,@a,
35+
@a,@a,@a,@a,@a,
36+
@a,@a,@a,@a,@a,
37+
@a,@a,@a,@a,@a,
38+
@a,@a,@a,@a,@a,
39+
@a,@a,@a,@a,@a,
40+
@a,@a,@a,@a,@a,
41+
@a,@a,@a,@a,@a,
42+
@a,@a,@a,@a,@a,
43+
@a,@a,@a,@a,@a,
44+
@a,@a,@a,@a,@a,
45+
@a,@a,@a,@a
46+
);
47+
48+
insert into t1 select * from t1;
49+
50+
--let $blob_pages=`select count(*) from information_schema.INNODB_BUFFER_PAGE WHERE PAGE_TYPE='BLOB' group by PAGE_TYPE`
51+
52+
# Dump on shutdown has been set - shutdown now
53+
54+
--echo # Restart server
55+
--let $shutdown_timeout= 10
56+
--let $allow_rpl_inited= 1
57+
--source include/restart_mysqld.inc
58+
59+
SET GLOBAL innodb_buffer_pool_load_now=1;
60+
61+
# Wait fit for the load to complete
62+
let $wait_condition =
63+
SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) load completed at '
64+
FROM information_schema.global_status
65+
WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
66+
-- source include/wait_condition.inc
67+
68+
69+
--let $loaded_blob_pages=`select count(*) from information_schema.INNODB_BUFFER_PAGE WHERE PAGE_TYPE='BLOB' group by PAGE_TYPE`
70+
71+
--echo # Case 1: Limit from innodb_buffer_pool_dump_pct
72+
73+
eval SELECT $blob_pages as 'Previous pool pages',
74+
ROUND($PCT / 100 * @@innodb_buffer_pool_size / @@innodb_page_size) as 'Limit',
75+
$loaded_blob_pages as 'Pages saved';
76+
77+
--echo # Case 2: blog_pages is the minimum.
78+
79+
--echo # load buffer pool with entire table.
80+
--disable_result_log
81+
select * from t1;
82+
--enable_result_log
83+
84+
--let $PCT=75
85+
eval SET GLOBAL innodb_buffer_pool_dump_pct=$PCT, global innodb_buffer_pool_dump_at_shutdown=1;
86+
87+
--let $blob_pages=`select count(*) from information_schema.INNODB_BUFFER_PAGE WHERE PAGE_TYPE='BLOB' group by PAGE_TYPE`
88+
89+
--echo # Restart server
90+
--source include/restart_mysqld.inc
91+
92+
93+
SET GLOBAL innodb_buffer_pool_load_now=1;
94+
95+
# Wait for load
96+
-- source include/wait_condition.inc
97+
98+
--echo # now loaded
99+
100+
--let $loaded_blob_pages=`select count(*) from information_schema.INNODB_BUFFER_PAGE WHERE PAGE_TYPE='BLOB' group by PAGE_TYPE`
101+
102+
eval SELECT $blob_pages as 'Previous pool pages',
103+
ROUND($PCT / 100 * @@innodb_buffer_pool_size / @@innodb_page_size) as 'Limit',
104+
$loaded_blob_pages as 'Pages saved';
105+
106+
# Clean up
107+
#
108+
#
109+
--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/ib_buffer_pool
110+
DROP TABLE t1;

0 commit comments

Comments
 (0)