| 1 |
# |
| 2 |
# WL6117 : Resize the InnoDB Buffer Pool Online |
| 3 |
# (concurrent sql; allocation fail;) |
| 4 |
# |
| 5 |
|
| 6 |
--source include/have_innodb_max_16k.inc |
| 7 |
--source include/have_debug.inc |
| 8 |
|
| 9 |
--disable_query_log |
| 10 |
set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size; |
| 11 |
set @old_innodb_file_per_table = @@innodb_file_per_table; |
| 12 |
set @old_innodb_thread_concurrency = @@innodb_thread_concurrency; |
| 13 |
set @old_innodb_thread_sleep_delay = @@innodb_thread_sleep_delay; |
| 14 |
--enable_query_log |
| 15 |
|
| 16 |
# Save the initial number of concurrent sessions |
| 17 |
--source include/count_sessions.inc |
| 18 |
|
| 19 |
let $wait_timeout = 180; |
| 20 |
|
| 21 |
set global innodb_file_per_table=ON; |
| 22 |
set global innodb_thread_concurrency=20; |
| 23 |
|
| 24 |
connect (con1,localhost,root,,); |
| 25 |
connect (con2,localhost,root,,); |
| 26 |
connect (con3,localhost,root,,); |
| 27 |
connect (con4,localhost,root,,); |
| 28 |
connect (con5,localhost,root,,); |
| 29 |
connect (con6,localhost,root,,); |
| 30 |
connect (con7,localhost,root,,); |
| 31 |
connect (con8,localhost,root,,); |
| 32 |
|
| 33 |
create table t2 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; |
| 34 |
insert into t2 (c1, c2) values (1, 1); |
| 35 |
|
| 36 |
create table t3 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; |
| 37 |
insert into t3 (c1, c2) values (1, 1); |
| 38 |
|
| 39 |
create table t4 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; |
| 40 |
insert into t4 (c1, c2) values (1, 1); |
| 41 |
|
| 42 |
create table t5 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; |
| 43 |
insert into t5 (c1, c2) values (1, 1); |
| 44 |
|
| 45 |
create table t6 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; |
| 46 |
insert into t6 (c1, c2) values (1, 1); |
| 47 |
|
| 48 |
create database test2; |
| 49 |
create table test2.t7 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; |
| 50 |
insert into test2.t7 (c1, c2) values (1, 1); |
| 51 |
drop table test2.t7; |
| 52 |
|
| 53 |
connection con1; |
| 54 |
set global DEBUG="+d,ib_buf_pool_resize_wait_before_resize"; |
| 55 |
set global innodb_buffer_pool_size = 12*1024*1024; |
| 56 |
|
| 57 |
let $wait_condition = |
| 58 |
SELECT SUBSTR(variable_value, 1, 30) = 'Latching whole of buffer pool.' |
| 59 |
FROM performance_schema.global_status |
| 60 |
WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; |
| 61 |
--source include/wait_condition.inc |
| 62 |
|
| 63 |
# trying to update innodb_buffer_pool_size |
| 64 |
set global innodb_buffer_pool_size = 8*1024*1024; |
| 65 |
select @@global.innodb_buffer_pool_size; |
| 66 |
|
| 67 |
# trying to control adaptive hash index |
| 68 |
select @@global.innodb_adaptive_hash_index; |
| 69 |
set global innodb_adaptive_hash_index = ON; |
| 70 |
select @@global.innodb_adaptive_hash_index; |
| 71 |
set global innodb_adaptive_hash_index = OFF; |
| 72 |
select @@global.innodb_adaptive_hash_index; |
| 73 |
|
| 74 |
# - create table |
| 75 |
--send create table t1 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB |
| 76 |
|
| 77 |
connection con2; |
| 78 |
# - analyze table |
| 79 |
--send analyze table t2 |
| 80 |
|
| 81 |
connection con3; |
| 82 |
# - alter table ... algorithm=inplace |
| 83 |
--send alter table t3 algorithm=inplace, add index idx (c1) |
| 84 |
|
| 85 |
connection con4; |
| 86 |
# - alter table ... rename to |
| 87 |
--send alter table t4 rename to t0 |
| 88 |
|
| 89 |
connection con5; |
| 90 |
# - drop table |
| 91 |
--send drop table t5 |
| 92 |
|
| 93 |
#TODO: NewDD: Re-enable after WL9535 |
| 94 |
#connection con6; |
| 95 |
# - alter table ... discard tablespace |
| 96 |
#--send alter table t6 discard tablespace |
| 97 |
|
| 98 |
connection con7; |
| 99 |
# - drop database |
| 100 |
--send drop database test2 |
| 101 |
|
| 102 |
connection con8; |
| 103 |
# information schema INNODB_BUFFER_PAGE |
| 104 |
--send select count(*) > 0 from information_schema.innodb_buffer_page |
| 105 |
|
| 106 |
connection default; |
| 107 |
set global DEBUG="-d,ib_buf_pool_resize_wait_before_resize"; |
| 108 |
|
| 109 |
let $wait_condition = |
| 110 |
SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at ' |
| 111 |
FROM performance_schema.global_status |
| 112 |
WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; |
| 113 |
--source include/wait_condition.inc |
| 114 |
|
| 115 |
connection con1; |
| 116 |
--reap |
| 117 |
|
| 118 |
connection con2; |
| 119 |
--reap |
| 120 |
|
| 121 |
connection con3; |
| 122 |
--reap |
| 123 |
|
| 124 |
connection con4; |
| 125 |
--reap |
| 126 |
|
| 127 |
connection con5; |
| 128 |
--reap |
| 129 |
|
| 130 |
#connection con6; |
| 131 |
#--reap |
| 132 |
|
| 133 |
connection con7; |
| 134 |
--reap |
| 135 |
|
| 136 |
connection con8; |
| 137 |
--reap |
| 138 |
|
| 139 |
connection default; |
| 140 |
|
| 141 |
disconnect con3; |
| 142 |
disconnect con4; |
| 143 |
disconnect con5; |
| 144 |
disconnect con6; |
| 145 |
disconnect con7; |
| 146 |
disconnect con8; |
| 147 |
disconnect con1; |
| 148 |
disconnect con2; |
| 149 |
|
| 150 |
# fails to allocate new chunks |
| 151 |
call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* buffer pool 0 : failed to allocate new memory."); |
| 152 |
connection default; |
| 153 |
set global DEBUG="+d,ib_buf_chunk_init_fails"; |
| 154 |
set global innodb_buffer_pool_size = 16*1024*1024; |
| 155 |
let $wait_condition = |
| 156 |
SELECT SUBSTR(variable_value, 1, 27) = 'Resizing buffer pool failed' |
| 157 |
FROM performance_schema.global_status |
| 158 |
WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; |
| 159 |
--source include/wait_condition.inc |
| 160 |
set global DEBUG="-d,ib_buf_chunk_init_fails"; |
| 161 |
|
| 162 |
# can be used as usual, even if failed to allocate |
| 163 |
create table t8 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; |
| 164 |
insert into t8 (c1, c2) values (1, 1); |
| 165 |
drop table t8; |
| 166 |
|
| 167 |
drop table t1; |
| 168 |
drop table t2; |
| 169 |
drop table t3; |
| 170 |
drop table t0; |
| 171 |
drop table t6; |
| 172 |
|
| 173 |
--disable_query_log |
| 174 |
set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size; |
| 175 |
set global innodb_file_per_table = @old_innodb_file_per_table; |
| 176 |
set global innodb_thread_concurrency = @old_innodb_thread_concurrency; |
| 177 |
set global innodb_thread_sleep_delay = @old_innodb_thread_sleep_delay; |
| 178 |
--enable_query_log |
| 179 |
|
| 180 |
let $wait_condition = |
| 181 |
SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at ' |
| 182 |
FROM performance_schema.global_status |
| 183 |
WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; |
| 184 |
--source include/wait_condition.inc |
| 185 |
|
| 186 |
# Wait till all disconnects are completed] |
| 187 |
--source include/wait_until_count_sessions.inc |
| 188 |
|
| 189 |
--echo # |
| 190 |
--echo # BUG#23590280 NO WARNING WHEN REDUCING INNODB_BUFFER_POOL_SIZE INSIZE THE FIRST CHUNK |
| 191 |
--echo # |
| 192 |
|
| 193 |
# Slow shutdown and restart to make sure ibuf merge is finished |
| 194 |
SET GLOBAL innodb_fast_shutdown = 0; |
| 195 |
let $restart_parameters = restart: --innodb-buffer-pool-size=24M --innodb-buffer-pool-chunk-size=24M; |
| 196 |
--source include/restart_mysqld.inc |
| 197 |
|
| 198 |
set @before_innodb_buffer_pool_size = @@innodb_buffer_pool_size; |
| 199 |
|
| 200 |
set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size div 2; |
| 201 |
|
| 202 |
let $wait_timeout = 60; |
| 203 |
let $wait_condition = |
| 204 |
SELECT SUBSTR(variable_value, 1, 19) = 'Size did not change' |
| 205 |
FROM performance_schema.global_status |
| 206 |
WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; |
| 207 |
--source include/wait_condition.inc |
| 208 |
|
| 209 |
set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size * 2; |
| 210 |
|
| 211 |
let $wait_timeout = 60; |
| 212 |
let $wait_condition = |
| 213 |
SELECT SUBSTR(variable_value, 1, 9) = 'Completed' |
| 214 |
FROM performance_schema.global_status |
| 215 |
WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; |
| 216 |
--source include/wait_condition.inc |
| 217 |
|
| 218 |
set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size; |
| 219 |
|
| 220 |
let $wait_timeout = 60; |
| 221 |
let $wait_condition = |
| 222 |
SELECT SUBSTR(variable_value, 1, 9) = 'Completed' |
| 223 |
FROM performance_schema.global_status |
| 224 |
WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; |
| 225 |
--source include/wait_condition.inc |
| 226 |
|
| 227 |
set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size; |
| 228 |
|
| 229 |
let $wait_timeout = 60; |
| 230 |
let $wait_condition = |
| 231 |
SELECT SUBSTR(variable_value, 1, 19) = 'Size did not change' |
| 232 |
FROM performance_schema.global_status |
| 233 |
WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; |
| 234 |
--source include/wait_condition.inc |
| 235 |
|
| 236 |
--let $restart_parameters= restart: |
| 237 |
--source include/restart_mysqld.inc |