44# $engine_type -- storage engine to be tested
55# $test_foreign_keys -- 0, skip foreign key tests
66# -- 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'
710# have to be set before sourcing this script.
811#
912# Last update:
@@ -19,55 +22,69 @@ eval SET SESSION STORAGE_ENGINE = $engine_type;
1922drop table if exists t1,t2,t3;
2023-- enable_warnings
2124
25+ set @save_query_cache_size = @@global .query_cache_size ;
26+ set GLOBAL query_cache_size = 1355776 ;
27+
2228#
2329# Without auto_commit.
2430#
2531flush status;
2632set autocommit= 0 ;
27- create table t1 (a int not null );
33+ eval create table t1 (a int not null )$partitions_a ;
2834insert into t1 values (1 ),(2 ),(3 );
35+ -- sorted_result
2936select * from t1;
3037show status like " Qcache_queries_in_cache" ;
3138drop table t1;
3239commit ;
3340set autocommit= 1 ;
3441begin ;
35- create table t1 (a int not null );
42+ eval create table t1 (a int not null )$partitions_a ;
3643insert into t1 values (1 ),(2 ),(3 );
44+ -- sorted_result
3745select * from t1;
3846show status like " Qcache_queries_in_cache" ;
3947drop table t1;
4048commit ;
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 ;
4452insert into t1 values (1 ),(2 );
4553insert into t2 values (1 ),(2 );
4654insert into t3 values (1 ),(2 );
55+ -- sorted_result
4756select * from t1;
57+ -- sorted_result
4858select * from t2;
59+ -- sorted_result
4960select * from t3;
5061show status like " Qcache_queries_in_cache" ;
5162show status like " Qcache_hits" ;
5263begin ;
64+ -- sorted_result
5365select * from t1;
66+ -- sorted_result
5467select * from t2;
68+ -- sorted_result
5569select * from t3;
5670show status like " Qcache_queries_in_cache" ;
5771show status like " Qcache_hits" ;
5872insert into t1 values (3 );
5973insert into t2 values (3 );
6074insert into t1 values (4 );
75+ -- sorted_result
6176select * from t1;
77+ -- sorted_result
6278select * from t2;
79+ -- sorted_result
6380select * from t3;
6481show status like " Qcache_queries_in_cache" ;
6582show status like " Qcache_hits" ;
6683commit ;
6784show status like " Qcache_queries_in_cache" ;
6885drop table t3,t2,t1;
6986
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 ;
7188select count (* ) from t1;
7289insert into t1 (id) values (0 );
7390select count (* ) from t1;
@@ -78,8 +95,6 @@ if ($test_foreign_keys)
7895#
7996# one statement roll back inside transation
8097#
81- let $save_query_cache_size= ` select @@global.query_cache_size` ;
82- set GLOBAL query_cache_size= 1355776 ;
8398CREATE TABLE t1 ( id int (10 ) NOT NULL auto_increment, a varchar (25 ) default NULL , PRIMARY KEY (id), UNIQUE KEY a (a));
8499CREATE TABLE t2 ( id int (10 ) NOT NULL auto_increment, b varchar (25 ) default NULL , PRIMARY KEY (id), UNIQUE KEY b (b));
85100CREATE 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,9 +110,6 @@ insert into t3 VALUES ( NULL, 1, 1, 2 );
95110commit ;
96111select 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 ;
97112drop table t3,t2,t1;
98- -- disable_query_log
99- eval set GLOBAL query_cache_size= $save_query_cache_size;
100- -- enable_query_log
101113}
102114
103115#
@@ -118,7 +130,7 @@ SET GLOBAL query_cache_size = 204800;
118130flush status;
119131SET @@autocommit= 1 ;
120132eval 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 ;
122134INSERT INTO t2 VALUES (1 ,repeat(' a' ,10 )),(2 ,repeat(' a' ,10 )),(3 ,repeat(' a' ,10 )),(4 ,repeat(' a' ,10 ));
123135COMMIT ;
124136START TRANSACTION ;
@@ -176,8 +188,8 @@ show status like "Qcache_queries_in_cache";
176188show status like " Qcache_hits" ;
177189
178190# Final cleanup
179- eval set GLOBAL query_cache_size= $save_query_cache_size;
180191disconnect connection1;
181192-- source include/wait_until_disconnected.inc
182193connection default;
194+ set @@global .query_cache_size = @save_query_cache_size;
183195drop table t2;
0 commit comments