|
| 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