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