~james-page/ubuntu/precise/mysql-5.5/misc-fixes

« back to all changes in this revision

Viewing changes to mysql-test/include/query_cache.inc

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-06-11 07:34:33 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120611073433-l9za2ni4ipp848y3
Tags: 5.5.24-0ubuntu0.12.04.1
* SECURITY UPDATE: Update to 5.5.24 to fix security issues (LP: #1011371)
  - http://dev.mysql.com/doc/refman/5.5/en/news-5-5-24.html

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
#     $engine_type       -- storage engine to be tested
5
5
#     $test_foreign_keys -- 0, skip foreign key tests
6
6
#                        -- 1, do not skip foreign key tests
 
7
#     $partitions_a      -- partition by column 'a'
 
8
#     $partitions_id     -- partition by column 'id'
 
9
#     $partitions_s1     -- partition by column 's1'
7
10
# have to be set before sourcing this script.
8
11
#
9
12
# Last update:
19
22
drop table if exists t1,t2,t3;
20
23
--enable_warnings
21
24
 
 
25
set @save_query_cache_size = @@global.query_cache_size;
 
26
set GLOBAL query_cache_size = 1355776;
 
27
 
22
28
#
23
29
# Without auto_commit.
24
30
#
25
31
flush status;
26
32
set autocommit=0;
27
 
create table t1 (a int not null);
 
33
eval create table t1 (a int not null)$partitions_a;
28
34
insert into t1 values (1),(2),(3);
 
35
--sorted_result
29
36
select * from t1;
30
37
show status like "Qcache_queries_in_cache";
31
38
drop table t1;
32
39
commit;
33
40
set autocommit=1;
34
41
begin;
35
 
create table t1 (a int not null);
 
42
eval create table t1 (a int not null)$partitions_a;
36
43
insert into t1 values (1),(2),(3);
 
44
--sorted_result
37
45
select * from t1;
38
46
show status like "Qcache_queries_in_cache";
39
47
drop table t1;
40
48
commit;
41
 
create table t1 (a int not null);
42
 
create table t2 (a int not null);
43
 
create table t3 (a int not null);
 
49
eval create table t1 (a int not null)$partitions_a;
 
50
eval create table t2 (a int not null)$partitions_a;
 
51
eval create table t3 (a int not null)$partitions_a;
44
52
insert into t1 values (1),(2);
45
53
insert into t2 values (1),(2);
46
54
insert into t3 values (1),(2);
 
55
--sorted_result
47
56
select * from t1;
 
57
--sorted_result
48
58
select * from t2;
 
59
--sorted_result
49
60
select * from t3;
50
61
show status like "Qcache_queries_in_cache";
51
62
show status like "Qcache_hits";
52
63
begin;
 
64
--sorted_result
53
65
select * from t1;
 
66
--sorted_result
54
67
select * from t2;
 
68
--sorted_result
55
69
select * from t3;
56
70
show status like "Qcache_queries_in_cache";
57
71
show status like "Qcache_hits";
58
72
insert into t1 values (3);
59
73
insert into t2 values (3);
60
74
insert into t1 values (4);
 
75
--sorted_result
61
76
select * from t1;
 
77
--sorted_result
62
78
select * from t2;
 
79
--sorted_result
63
80
select * from t3;
64
81
show status like "Qcache_queries_in_cache";
65
82
show status like "Qcache_hits";
67
84
show status like "Qcache_queries_in_cache";
68
85
drop table t3,t2,t1;
69
86
 
70
 
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY  (id));
 
87
eval CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id))$partitions_id;
71
88
select count(*) from t1;
72
89
insert into t1 (id) values (0);
73
90
select count(*) from t1;
78
95
#
79
96
# one statement roll back inside transation
80
97
#
81
 
let $save_query_cache_size=`select @@global.query_cache_size`;
82
 
set GLOBAL query_cache_size=1355776;
83
98
CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY  (id), UNIQUE KEY a (a));
84
99
CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY  (id), UNIQUE KEY b (b));
85
100
CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY  (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`));
95
110
commit;
96
111
select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t2_id = t2.id and t1.id = 1 order by t1.a asc;
97
112
drop table t3,t2,t1;
98
 
--disable_query_log
99
 
eval set GLOBAL query_cache_size=$save_query_cache_size;
100
 
--enable_query_log
101
113
}
102
114
 
103
115
#
118
130
flush status;
119
131
SET @@autocommit=1;
120
132
eval SET SESSION STORAGE_ENGINE = $engine_type;
121
 
CREATE TABLE t2 (s1 int, s2 varchar(1000), key(s1));
 
133
eval CREATE TABLE t2 (s1 int, s2 varchar(1000), key(s1))$partitions_s1;
122
134
INSERT INTO t2 VALUES (1,repeat('a',10)),(2,repeat('a',10)),(3,repeat('a',10)),(4,repeat('a',10));
123
135
COMMIT;
124
136
START TRANSACTION;
176
188
show status like "Qcache_hits";
177
189
 
178
190
# Final cleanup
179
 
eval set GLOBAL query_cache_size=$save_query_cache_size;
180
191
disconnect connection1;
181
192
--source include/wait_until_disconnected.inc
182
193
connection default;
 
194
set @@global.query_cache_size = @save_query_cache_size;
183
195
drop table t2;