| 1 |
# |
| 2 |
# Testing of PRELOAD |
| 3 |
# |
| 4 |
|
| 5 |
# Slow test, don't run during staging part |
| 6 |
-- source include/not_staging.inc |
| 7 |
-- source include/have_maria.inc |
| 8 |
|
| 9 |
--disable_warnings |
| 10 |
drop table if exists t1, t2; |
| 11 |
--enable_warnings |
| 12 |
|
| 13 |
# Background dirty pages flushing may influence page cache stats: |
| 14 |
let $def_checkinterval=`select @@global.aria_checkpoint_interval`; |
| 15 |
set global aria_checkpoint_interval=0; |
| 16 |
|
| 17 |
# Work around BUG#34911 "FLUSH STATUS doesn't flush what it should": |
| 18 |
# compute differences in status variables before and after relevant |
| 19 |
# queries. Aria_pagecache_read_requests varies accross machines. |
| 20 |
create temporary table initial |
| 21 |
select variable_name,variable_value from |
| 22 |
information_schema.global_status where variable_name like "Aria_pagecache_reads"; |
| 23 |
|
| 24 |
# we don't use block-format because we want page cache stats |
| 25 |
# about indices and not data pages. |
| 26 |
|
| 27 |
create table t1 ( |
| 28 |
a int not null auto_increment, |
| 29 |
b char(16) not null, |
| 30 |
primary key (a), |
| 31 |
key (b) |
| 32 |
) engine=aria row_format=dynamic; |
| 33 |
|
| 34 |
create table t2( |
| 35 |
a int not null auto_increment, |
| 36 |
b char(16) not null, |
| 37 |
primary key (a), |
| 38 |
key (b) |
| 39 |
) engine=aria row_format=dynamic; |
| 40 |
|
| 41 |
insert into t1(b) values |
| 42 |
('test0'), |
| 43 |
('test1'), |
| 44 |
('test2'), |
| 45 |
('test3'), |
| 46 |
('test4'), |
| 47 |
('test5'), |
| 48 |
('test6'), |
| 49 |
('test7'); |
| 50 |
|
| 51 |
insert into t2(b) select b from t1; |
| 52 |
insert into t1(b) select b from t2; |
| 53 |
insert into t2(b) select b from t1; |
| 54 |
insert into t1(b) select b from t2; |
| 55 |
insert into t2(b) select b from t1; |
| 56 |
insert into t1(b) select b from t2; |
| 57 |
insert into t2(b) select b from t1; |
| 58 |
insert into t1(b) select b from t2; |
| 59 |
insert into t2(b) select b from t1; |
| 60 |
insert into t1(b) select b from t2; |
| 61 |
insert into t2(b) select b from t1; |
| 62 |
insert into t1(b) select b from t2; |
| 63 |
insert into t2(b) select b from t1; |
| 64 |
insert into t1(b) select b from t2; |
| 65 |
insert into t2(b) select b from t1; |
| 66 |
insert into t1(b) select b from t2; |
| 67 |
insert into t2(b) select b from t1; |
| 68 |
insert into t1(b) select b from t2; |
| 69 |
|
| 70 |
select count(*) from t1; |
| 71 |
select count(*) from t2; |
| 72 |
|
| 73 |
flush tables; flush status; |
| 74 |
let $show_stat=select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Aria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc; |
| 75 |
eval $show_stat; |
| 76 |
select count(*) from t1 where b = 'test1'; |
| 77 |
eval $show_stat; |
| 78 |
select count(*) from t1 where b = 'test1'; |
| 79 |
eval $show_stat; |
| 80 |
|
| 81 |
flush tables; flush status; |
| 82 |
select @@preload_buffer_size; |
| 83 |
load index into cache t1; |
| 84 |
eval $show_stat; |
| 85 |
select count(*) from t1 where b = 'test1'; |
| 86 |
eval $show_stat; |
| 87 |
|
| 88 |
flush tables; flush status; |
| 89 |
eval $show_stat; |
| 90 |
set session preload_buffer_size=256*1024; |
| 91 |
select @@preload_buffer_size; |
| 92 |
load index into cache t1 ignore leaves; |
| 93 |
eval $show_stat; |
| 94 |
select count(*) from t1 where b = 'test1'; |
| 95 |
eval $show_stat; |
| 96 |
|
| 97 |
flush tables; flush status; |
| 98 |
eval $show_stat; |
| 99 |
set session preload_buffer_size=1*1024; |
| 100 |
select @@preload_buffer_size; |
| 101 |
load index into cache t1, t2 key (primary,b) ignore leaves; |
| 102 |
eval $show_stat; |
| 103 |
select count(*) from t1 where b = 'test1'; |
| 104 |
select count(*) from t2 where b = 'test1'; |
| 105 |
eval $show_stat; |
| 106 |
|
| 107 |
flush tables; flush status; |
| 108 |
eval $show_stat; |
| 109 |
load index into cache t3, t2 key (primary,b) ; |
| 110 |
eval $show_stat; |
| 111 |
flush tables; flush status; |
| 112 |
eval $show_stat; |
| 113 |
load index into cache t3 key (b), t2 key (c) ; |
| 114 |
eval $show_stat; |
| 115 |
|
| 116 |
drop table t1, t2; |
| 117 |
drop temporary table initial; |
| 118 |
|
| 119 |
# check that Aria didn't use key cache |
| 120 |
show status like "key_read%"; |
| 121 |
|
| 122 |
--disable_result_log |
| 123 |
--disable_query_log |
| 124 |
eval set global aria_checkpoint_interval=$def_checkinterval; |
| 125 |
--enable_result_log |
| 126 |
--enable_query_log |