summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test
blob: 932829470e3e179a8a04b83989e3b91c22b41b92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#
# WL6117 : Resize the InnoDB Buffer Pool Online
#

--source include/have_innodb.inc
--source include/big_test.inc

let $wait_timeout = 180;
let $wait_condition =
  SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at '
  FROM information_schema.global_status
  WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status';

--disable_query_log
set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size;
set @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index;
--enable_query_log

set global innodb_adaptive_hash_index=ON;

select @@innodb_buffer_pool_size;

# Expand buffer pool
set global innodb_buffer_pool_size = 10485760;

--source include/wait_condition.inc

select @@innodb_buffer_pool_size;

# fill buffer pool
--disable_query_log
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
SET GLOBAL innodb_read_only_compressed=OFF;
--enable_query_log
create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
create or replace view view0 as select 1 union all select 1;

set @`v_id` := 0;
set @`v_val` := 0;

# 2^18 == 262144 records
replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log

# Shrink buffer pool
set global innodb_buffer_pool_size = 7340032;
--source include/wait_condition.inc

select @@innodb_buffer_pool_size;

select count(val) from t1;

set global innodb_adaptive_hash_index=OFF;

# Expand buffer pool to 24MB
set global innodb_buffer_pool_size = 25165824;
--source include/wait_condition.inc

select @@innodb_buffer_pool_size;

select count(val) from t1;

drop table t1;
drop view view0;

--disable_query_log
set global innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index;
set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size;
--enable_query_log
--source include/wait_condition.inc