Commit ef466a20 authored by unknown's avatar unknown

Merge april.(none):/home/svoj/devel/bk/mysql-5.1

into  april.(none):/home/svoj/devel/mysql/merge/mysql-5.1-engines


mysql-test/r/myisam.result:
  Auto merged
mysql-test/t/myisam.test:
  Auto merged
sql/handler.cc:
  Auto merged
sql/opt_range.cc:
  Auto merged
storage/myisam/ha_myisam.cc:
  Auto merged
parents daaf51fb 01e2f11f
# include/concurrent.inc
# #
# Concurrent InnoDB tests, mainly in UPDATE's # Concurrent tests for transactional storage engines, mainly in UPDATE's
# Bug#3300 # Bug#3300
# Designed and tested by Sinisa Milivojevic, sinisa@mysql.com # Designed and tested by Sinisa Milivojevic, sinisa@mysql.com
# #
# two non-interfering UPDATE's not changing result set # two non-interfering UPDATE's not changing result set
# #
# The variable
# test takes circa 5 minutes to run, so it's big # $engine_type -- storage engine to be tested
-- source include/big_test.inc # has to be set before sourcing this script.
#
# Last update:
# 2006-08-02 ML test refactored
# old name was t/innodb_concurrent.test
# main code went into include/concurrent.inc
#
connection default; connection default;
eval SET SESSION STORAGE_ENGINE = $engine_type;
--disable_warnings
drop table if exists t1; drop table if exists t1;
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb; --enable_warnings
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
connect (thread1, localhost, mysqltest,,); connect (thread1, localhost, mysqltest,,);
connection thread1; connection thread1;
eval SET SESSION STORAGE_ENGINE = $engine_type;
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc"); insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
...@@ -57,7 +68,7 @@ drop table t1; ...@@ -57,7 +68,7 @@ drop table t1;
# #
#connect (thread1, localhost, mysqltest,,); #connect (thread1, localhost, mysqltest,,);
connection thread1; connection thread1;
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb; create table t1(eta int(11) not null, tipo int(11), c varchar(255));
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc"); insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
...@@ -103,7 +114,7 @@ drop table t1; ...@@ -103,7 +114,7 @@ drop table t1;
#connect (thread1, localhost, mysqltest,,); #connect (thread1, localhost, mysqltest,,);
connection thread1; connection thread1;
create table t1 (a int not null, b int not null) engine=innodb; create table t1 (a int not null, b int not null);
insert into t1 values (1,1),(2,1),(3,1),(4,1); insert into t1 values (1,1),(2,1),(3,1),(4,1);
select get_lock("hello2",1000); select get_lock("hello2",1000);
#connect (thread2, localhost, mysqltest,,); #connect (thread2, localhost, mysqltest,,);
...@@ -132,7 +143,7 @@ drop table t1; ...@@ -132,7 +143,7 @@ drop table t1;
# #
#connect (thread1, localhost, mysqltest,,); #connect (thread1, localhost, mysqltest,,);
connection thread1; connection thread1;
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb; create table t1(eta int(11) not null, tipo int(11), c varchar(255));
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc"); insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
...@@ -175,7 +186,7 @@ drop table t1; ...@@ -175,7 +186,7 @@ drop table t1;
# #
#connect (thread1, localhost, mysqltest,,); #connect (thread1, localhost, mysqltest,,);
connection thread1; connection thread1;
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb; create table t1(eta int(11) not null, tipo int(11), c varchar(255));
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc"); insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
...@@ -218,7 +229,7 @@ drop table t1; ...@@ -218,7 +229,7 @@ drop table t1;
# #
#connect (thread1, localhost, mysqltest,,); #connect (thread1, localhost, mysqltest,,);
connection thread1; connection thread1;
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb; create table t1(eta int(11) not null, tipo int(11), c varchar(255));
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc"); insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
...@@ -261,7 +272,7 @@ drop table t1; ...@@ -261,7 +272,7 @@ drop table t1;
# #
#connect (thread1, localhost, mysqltest,,); #connect (thread1, localhost, mysqltest,,);
connection thread1; connection thread1;
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb; create table t1(eta int(11) not null, tipo int(11), c varchar(255));
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc"); insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
...@@ -305,7 +316,7 @@ drop table t1; ...@@ -305,7 +316,7 @@ drop table t1;
# #
#connect (thread1, localhost, mysqltest,,); #connect (thread1, localhost, mysqltest,,);
connection thread1; connection thread1;
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb; create table t1(eta int(11) not null, tipo int(11), c varchar(255));
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc"); insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
......
-- source include/have_innodb.inc # include/deadlock.inc
# Can't test this with embedded server #
-- source include/not_embedded.inc # The variable
# $engine_type -- storage engine to be tested
# has to be set before sourcing this script.
#
# Last update:
# 2006-07-26 ML refactoring + print when connection is switched
# old name was t/innodb-deadlock.test
# main code went into include/deadlock.inc
#
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
--disable_warnings --disable_warnings
...@@ -13,29 +23,34 @@ drop table if exists t1,t2; ...@@ -13,29 +23,34 @@ drop table if exists t1,t2;
# Testing of FOR UPDATE # Testing of FOR UPDATE
# #
--echo # Switch to connection con1
connection con1; connection con1;
create table t1 (id integer, x integer) engine=INNODB; eval create table t1 (id integer, x integer) engine = $engine_type;
insert into t1 values(0, 0); insert into t1 values(0, 0);
set autocommit=0; set autocommit=0;
SELECT * from t1 where id = 0 FOR UPDATE; SELECT * from t1 where id = 0 FOR UPDATE;
--echo # Switch to connection con2
connection con2; connection con2;
set autocommit=0; set autocommit=0;
# The following query should hang because con1 is locking the page # The following query should hang because con1 is locking the record
--send --send
update t1 set x=2 where id = 0; update t1 set x=2 where id = 0;
--sleep 2 --sleep 2
--echo # Switch to connection con1
connection con1; connection con1;
update t1 set x=1 where id = 0; update t1 set x=1 where id = 0;
select * from t1; select * from t1;
commit; commit;
--echo # Switch to connection con2
connection con2; connection con2;
reap; reap;
commit; commit;
--echo # Switch to connection con1
connection con1; connection con1;
select * from t1; select * from t1;
commit; commit;
...@@ -45,9 +60,10 @@ drop table t1; ...@@ -45,9 +60,10 @@ drop table t1;
# Testing of FOR UPDATE # Testing of FOR UPDATE
# #
--echo # Switch to connection con1
connection con1; connection con1;
create table t1 (id integer, x integer) engine=INNODB; eval create table t1 (id integer, x integer) engine = $engine_type;
create table t2 (b integer, a integer) engine=INNODB; eval create table t2 (b integer, a integer) engine = $engine_type;
insert into t1 values(0, 0), (300, 300); insert into t1 values(0, 0), (300, 300);
insert into t2 values(0, 10), (1, 20), (2, 30); insert into t2 values(0, 10), (1, 20), (2, 30);
commit; commit;
...@@ -57,61 +73,75 @@ update t2 set a=100 where b=(SELECT x from t1 where id = b FOR UPDATE); ...@@ -57,61 +73,75 @@ update t2 set a=100 where b=(SELECT x from t1 where id = b FOR UPDATE);
select * from t2; select * from t2;
select * from t1; select * from t1;
--echo # Switch to connection con2
connection con2; connection con2;
set autocommit=0; set autocommit=0;
# The following query should hang because con1 is locking the page # The following query should hang because con1 is locking the record
--send --send
update t1 set x=2 where id = 0; update t1 set x=2 where id = 0;
--sleep 2 --sleep 2
--echo # Switch to connection con1
connection con1; connection con1;
update t1 set x=1 where id = 0; update t1 set x=1 where id = 0;
select * from t1; select * from t1;
commit; commit;
--echo # Switch to connection con2
connection con2; connection con2;
reap; reap;
commit; commit;
--echo # Switch to connection con1
connection con1; connection con1;
select * from t1; select * from t1;
commit; commit;
drop table t1, t2; drop table t1, t2;
create table t1 (id integer, x integer) engine=INNODB; eval create table t1 (id integer, x integer) engine = $engine_type;
create table t2 (b integer, a integer) engine=INNODB; eval create table t2 (b integer, a integer) engine = $engine_type;
insert into t1 values(0, 0), (300, 300); insert into t1 values(0, 0), (300, 300);
insert into t2 values(0, 0), (1, 20), (2, 30); insert into t2 values(0, 0), (1, 20), (2, 30);
commit; commit;
--echo # Switch to connection con1
connection con1; connection con1;
select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE; select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
select * from t2; select * from t2;
select * from t1; select * from t1;
--echo # Switch to connection con2
connection con2; connection con2;
# The following query should hang because con1 is locking the page # The following query should hang because con1 is locking the record
update t2 set a=2 where b = 0; update t2 set a=2 where b = 0;
select * from t2; select * from t2;
--send --send
update t1 set x=2 where id = 0; update t1 set x=2 where id = 0;
--sleep 2 --sleep 2
--echo # Switch to connection con1
connection con1; connection con1;
update t1 set x=1 where id = 0; update t1 set x=1 where id = 0;
select * from t1; select * from t1;
commit; commit;
--echo # Switch to connection con2
connection con2; connection con2;
reap; reap;
commit; commit;
--echo # Switch to connection con1
connection con1; connection con1;
select * from t1; select * from t1;
commit; commit;
# Cleanup
--echo # Switch to connection default + disconnect con1 and con2
connection default;
disconnect con1;
disconnect con2;
drop table t1, t2; drop table t1, t2;
# End of 4.1 tests # End of 4.1 tests
# include/handler.inc
#
# The variables
# $engine_type -- storage engine to be tested
# $other_engine_type -- storage engine <> $engine_type
# $other_handler_engine_type -- storage engine <> $engine_type, if possible
# 1. $other_handler_engine_type must support handler
# 2. $other_handler_engine_type must point to an all
# time available storage engine
# 2006-08 MySQL 5.1 MyISAM and MEMORY only
# have to be set before sourcing this script.
-- source include/not_embedded.inc -- source include/not_embedded.inc
# #
# test of HANDLER ... # test of HANDLER ...
# #
# Last update:
# 2006-07-31 ML test refactored (MySQL 5.1)
# code of t/handler.test and t/innodb_handler.test united
# main testing code put into include/handler.inc
#
# should work in embedded server after mysqltest is fixed eval SET SESSION STORAGE_ENGINE = $engine_type;
-- source include/not_embedded.inc
--disable_warnings --disable_warnings
drop table if exists t1,t3,t4,t5; drop table if exists t1,t3,t4,t5;
...@@ -74,6 +89,22 @@ handler t2 read next; ...@@ -74,6 +89,22 @@ handler t2 read next;
handler t2 read last; handler t2 read last;
handler t2 close; handler t2 close;
handler t1 open;
handler t1 read a next; # this used to crash as a bug#5373
handler t1 read a next;
handler t1 close;
handler t1 open;
handler t1 read a prev; # this used to crash as a bug#5373
handler t1 read a prev;
handler t1 close;
handler t1 open as t2;
handler t2 read first;
eval alter table t1 engine = $engine_type;
--error 1109
handler t2 read first;
# #
# DROP TABLE / ALTER TABLE # DROP TABLE / ALTER TABLE
# #
...@@ -84,7 +115,7 @@ insert into t1 values (17); ...@@ -84,7 +115,7 @@ insert into t1 values (17);
--error 1109 --error 1109
handler t2 read first; handler t2 read first;
handler t1 open as t2; handler t1 open as t2;
alter table t1 engine=MyISAM; eval alter table t1 engine=$other_engine_type;
--error 1109 --error 1109
handler t2 read first; handler t2 read first;
drop table t1; drop table t1;
...@@ -303,7 +334,7 @@ insert into t5 values ("t5"); ...@@ -303,7 +334,7 @@ insert into t5 values ("t5");
handler t5 open as h5; handler t5 open as h5;
handler h5 read first limit 9; handler h5 read first limit 9;
# close first # close first
alter table t1 engine=MyISAM; eval alter table t1 engine=$other_handler_engine_type;
--error 1109 --error 1109
handler h1 read first limit 9; handler h1 read first limit 9;
handler h2 read first limit 9; handler h2 read first limit 9;
...@@ -311,7 +342,7 @@ handler h3 read first limit 9; ...@@ -311,7 +342,7 @@ handler h3 read first limit 9;
handler h4 read first limit 9; handler h4 read first limit 9;
handler h5 read first limit 9; handler h5 read first limit 9;
# close last # close last
alter table t5 engine=MyISAM; eval alter table t5 engine=$other_handler_engine_type;
--error 1109 --error 1109
handler h1 read first limit 9; handler h1 read first limit 9;
handler h2 read first limit 9; handler h2 read first limit 9;
...@@ -320,7 +351,7 @@ handler h4 read first limit 9; ...@@ -320,7 +351,7 @@ handler h4 read first limit 9;
--error 1109 --error 1109
handler h5 read first limit 9; handler h5 read first limit 9;
# close middle # close middle
alter table t3 engine=MyISAM; eval alter table t3 engine=$other_handler_engine_type;
--error 1109 --error 1109
handler h1 read first limit 9; handler h1 read first limit 9;
handler h2 read first limit 9; handler h2 read first limit 9;
...@@ -338,7 +369,7 @@ handler t1 open as h1_3; ...@@ -338,7 +369,7 @@ handler t1 open as h1_3;
handler h1_1 read first limit 9; handler h1_1 read first limit 9;
handler h1_2 read first limit 9; handler h1_2 read first limit 9;
handler h1_3 read first limit 9; handler h1_3 read first limit 9;
alter table t1 engine=MyISAM; eval alter table t1 engine=$engine_type;
--error 1109 --error 1109
handler h1_1 read first limit 9; handler h1_1 read first limit 9;
--error 1109 --error 1109
...@@ -379,6 +410,13 @@ reap; ...@@ -379,6 +410,13 @@ reap;
connection default; connection default;
drop table t1; drop table t1;
CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2));
INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
HANDLER t1 OPEN;
HANDLER t1 READ `primary` = (1, 1000);
HANDLER t1 READ `primary` PREV;
DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests
# #
......
This diff is collapsed.
# include/index_merge_2sweeps.inc
# #
# 2-sweeps read Index_merge test # 2-sweeps read Index_merge test
# #
-- source include/have_innodb.inc # The variable
# $engine_type -- storage engine to be tested
# has to be set before sourcing this script.
#
# Last update:
# 2006-08-02 ML test refactored
# old name was index_merge_innodb2.test
# main code went into include/index_merge_2sweeps.inc
#
--echo #---------------- 2-sweeps read Index merge test 2 -------------------------------
eval SET SESSION STORAGE_ENGINE = $engine_type;
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
...@@ -10,12 +23,12 @@ drop table if exists t1; ...@@ -10,12 +23,12 @@ drop table if exists t1;
create table t1 ( create table t1 (
pk int primary key, pk int primary key,
key1 int, key1 int,
key2 int, key2 int,
filler char(200), filler char(200),
filler2 char(200), filler2 char(200),
index(key1), index(key1),
index(key2) index(key2)
) engine=innodb; );
--disable_query_log --disable_query_log
...@@ -31,20 +44,20 @@ select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 ); ...@@ -31,20 +44,20 @@ select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 );
set @maxv=1000; set @maxv=1000;
select * from t1 where select * from t1 where
(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10) (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
or key1=18 or key1=60; or key1=18 or key1=60;
select * from t1 where select * from t1 where
(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10) (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
or key1 < 3 or key1 > @maxv-11; or key1 < 3 or key1 > @maxv-11;
select * from t1 where select * from t1 where
(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10) (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
or or
(key1 < 5) or (key1 > 10 and key1 < 15) or (key1 >= 50 and key1 < 55 ) or (key1 > @maxv-10); (key1 < 5) or (key1 > 10 and key1 < 15) or (key1 >= 50 and key1 < 55 ) or (key1 > @maxv-10);
select * from t1 where select * from t1 where
(pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 )
or or
(key1 < 5) or (key1 > @maxv-10); (key1 < 5) or (key1 > @maxv-10);
......
# include/index_merge_ror.inc
# #
# ROR-index_merge tests. # ROR-index_merge tests.
# #
# The variable
# $engine_type -- storage engine to be tested
# has to be set before sourcing this script.
#
# Note: The comments/expectations refer to MyISAM.
# They might be not valid for other storage engines.
#
# Last update:
# 2006-08-02 ML test refactored
# old name was t/index_merge_ror.test
# main code went into include/index_merge_ror.inc
#
--echo #---------------- ROR-index_merge tests -----------------------
eval SET SESSION STORAGE_ENGINE = $engine_type;
--disable_warnings --disable_warnings
drop table if exists t0,t1,t2; drop table if exists t0,t1,t2;
--enable_warnings --enable_warnings
--disable_query_log
create table t1 create table t1
( (
/* Field names reflect value(rowid) distribution, st=STairs, swt= SaWTooth */ /* Field names reflect value(rowid) distribution, st=STairs, swt= SaWTooth */
...@@ -29,7 +46,7 @@ create table t1 ...@@ -29,7 +46,7 @@ create table t1
filler4 char (200), filler4 char (200),
filler5 char (200), filler5 char (200),
filler6 char (200), filler6 char (200),
/* order of keys is important */ /* order of keys is important */
key sta_swt12a(st_a,swt1a,swt2a), key sta_swt12a(st_a,swt1a,swt2a),
key sta_swt1a(st_a,swt1a), key sta_swt1a(st_a,swt1a),
...@@ -47,21 +64,26 @@ create table t1 ...@@ -47,21 +64,26 @@ create table t1
key(key4) key(key4)
) ; ) ;
# Fill table # Fill table
create table t0 as select * from t1; create table t0 as select * from t1;
--disable_query_log
--echo # Printing of many insert into t0 values (....) disabled.
let $cnt=1000; let $cnt=1000;
while ($cnt) while ($cnt)
{ {
eval insert into t0 values (1, 2, 3, 1, 2, 3, 0, 0, 0, 0, 'data1', 'data2', 'data3', 'data4', 'data5', 'data6'); eval insert into t0 values (1, 2, 3, 1, 2, 3, 0, 0, 0, 0, 'data1', 'data2', 'data3', 'data4', 'data5', 'data6');
dec $cnt; dec $cnt;
} }
--enable_query_log
alter table t1 disable keys; alter table t1 disable keys;
--disable_query_log
--echo # Printing of many insert into t1 select .... from t0 disabled.
let $1=4; let $1=4;
while ($1) while ($1)
{ {
let $2=4; let $2=4;
while ($2) while ($2)
{ {
let $3=4; let $3=4;
while ($3) while ($3)
...@@ -74,6 +96,7 @@ while ($1) ...@@ -74,6 +96,7 @@ while ($1)
dec $1; dec $1;
} }
--echo # Printing of many insert into t1 (...) values (....) disabled.
# Row retrieval tests # Row retrieval tests
# -1 is used for values 'out of any range we are using' # -1 is used for values 'out of any range we are using'
# insert enough rows for index intersection to be used for (key1,key2) # insert enough rows for index intersection to be used for (key1,key2)
...@@ -90,17 +113,17 @@ while ($cnt) ...@@ -90,17 +113,17 @@ while ($cnt)
eval insert into t1 (key1, key2, key3, key4, filler1) values (-1, 100, -1, 100,'key2-key4'); eval insert into t1 (key1, key2, key3, key4, filler1) values (-1, 100, -1, 100,'key2-key4');
dec $cnt; dec $cnt;
} }
alter table t1 enable keys;
--enable_query_log --enable_query_log
alter table t1 enable keys;
select count(*) from t1; select count(*) from t1;
# One row results tests for cases where a single row matches all conditions # One row results tests for cases where a single row matches all conditions
explain select key1,key2 from t1 where key1=100 and key2=100; explain select key1,key2 from t1 where key1=100 and key2=100;
select key1,key2 from t1 where key1=100 and key2=100; select key1,key2 from t1 where key1=100 and key2=100;
explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
# Several-rows results # Several-rows results
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, -1, -1, 'key1-key2'); insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, -1, -1, 'key1-key2');
insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 100, 100, 'key4-key3'); insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 100, 100, 'key4-key3');
...@@ -150,7 +173,7 @@ explain select key1,key2 from t1 where key1=100 and key2=100; ...@@ -150,7 +173,7 @@ explain select key1,key2 from t1 where key1=100 and key2=100;
select key1,key2 from t1 where key1=100 and key2=100; select key1,key2 from t1 where key1=100 and key2=100;
# ROR-union tests with various cases. # ROR-union tests with various cases.
# All scans returning duplicate rows: # All scans returning duplicate rows:
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-1'); insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-1');
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-2'); insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-2');
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-3'); insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-3');
...@@ -169,7 +192,7 @@ explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 a ...@@ -169,7 +192,7 @@ explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 a
select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200; select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
## ##
## Optimizer tests ## Optimizer tests
## ##
# Check that the shortest key is used for ROR-intersection, covering and non-covering. # Check that the shortest key is used for ROR-intersection, covering and non-covering.
...@@ -179,9 +202,9 @@ explain select st_a,st_b from t1 where st_a=1 and st_b=1; ...@@ -179,9 +202,9 @@ explain select st_a,st_b from t1 where st_a=1 and st_b=1;
# Check if "ingore index" syntax works # Check if "ingore index" syntax works
explain select st_a from t1 ignore index (st_a) where st_a=1 and st_b=1; explain select st_a from t1 ignore index (st_a) where st_a=1 and st_b=1;
# Do many tests # Do many tests
# Check that keys that don't improve selectivity are skipped. # Check that keys that don't improve selectivity are skipped.
# #
# Different value on 32 and 64 bit # Different value on 32 and 64 bit
--replace_result sta_swt12a sta_swt21a sta_swt12a, sta_swt12a, --replace_result sta_swt12a sta_swt21a sta_swt12a, sta_swt12a,
...@@ -191,25 +214,25 @@ explain select * from t1 where st_b=1 and swt1b=1 and swt2b=1; ...@@ -191,25 +214,25 @@ explain select * from t1 where st_b=1 and swt1b=1 and swt2b=1;
explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1; explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
explain select * from t1 ignore index (sta_swt21a, stb_swt1a_2b) explain select * from t1 ignore index (sta_swt21a, stb_swt1a_2b)
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1; where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b) explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b)
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1; where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b, stb_swt1b) explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b, stb_swt1b)
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1; where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
explain select * from t1 explain select * from t1
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1; where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1;
explain select * from t1 explain select * from t1
where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1; where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
explain select st_a from t1 explain select st_a from t1
where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1; where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
explain select st_a from t1 explain select st_a from t1
where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1; where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
drop table t0,t1; drop table t0,t1;
...@@ -240,7 +263,7 @@ insert into t2 select * from t2; ...@@ -240,7 +263,7 @@ insert into t2 select * from t2;
select count(a) from t2 where a='BBBBBBBB'; select count(a) from t2 where a='BBBBBBBB';
select count(a) from t2 where b='BBBBBBBB'; select count(a) from t2 where b='BBBBBBBB';
# BUG#1: # BUG#1:
--replace_result a a_or_b b a_or_b --replace_result a a_or_b b a_or_b
explain select count(a) from t2 where a='AAAAAAAA' and b='AAAAAAAA'; explain select count(a) from t2 where a='AAAAAAAA' and b='AAAAAAAA';
select count(a) from t2 where a='AAAAAAAA' and b='AAAAAAAA'; select count(a) from t2 where a='AAAAAAAA' and b='AAAAAAAA';
......
# include/index_merge_ror_cpk.inc
# #
# Clustered PK ROR-index_merge tests # Clustered PK ROR-index_merge tests
# #
-- source include/have_innodb.inc # The variable
# $engine_type -- storage engine to be tested
# has to be set before sourcing this script.
#
# Note: The comments/expectations refer to InnoDB.
# They might be not valid for other storage engines.
#
# Last update:
# 2006-08-02 ML test refactored
# old name was t/index_merge_ror_cpk.test
# main code went into include/index_merge_ror_cpk.inc
#
--echo #---------------- Clustered PK ROR-index_merge tests -----------------------------
eval SET SESSION STORAGE_ENGINE = $engine_type;
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
...@@ -9,14 +25,14 @@ drop table if exists t1; ...@@ -9,14 +25,14 @@ drop table if exists t1;
create table t1 create table t1
( (
pk1 int not null, pk1 int not null,
pk2 int not null, pk2 int not null,
key1 int not null, key1 int not null,
key2 int not null, key2 int not null,
pktail1ok int not null, pktail1ok int not null,
pktail2ok int not null, pktail2ok int not null,
pktail3bad int not null, pktail3bad int not null,
pktail4bad int not null, pktail4bad int not null,
pktail5bad int not null, pktail5bad int not null,
...@@ -37,7 +53,7 @@ create table t1 ...@@ -37,7 +53,7 @@ create table t1
key (pktail5bad, pk1, pk2, pk2copy), key (pktail5bad, pk1, pk2, pk2copy),
primary key (pk1, pk2) primary key (pk1, pk2)
) engine=innodb; );
--disable_query_log --disable_query_log
set autocommit=0; set autocommit=0;
...@@ -50,13 +66,13 @@ while ($1) ...@@ -50,13 +66,13 @@ while ($1)
set autocommit=1; set autocommit=1;
--enable_query_log --enable_query_log
# Verify that range scan on CPK is ROR # Verify that range scan on CPK is ROR
# (use index_intersection because it is impossible to check that for index union) # (use index_intersection because it is impossible to check that for index union)
explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0; explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
# CPK scan + 1 ROR range scan is a special case # CPK scan + 1 ROR range scan is a special case
select * from t1 where pk1 = 1 and pk2 < 80 and key1=0; select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
# Verify that CPK fields are considered to be covered by index scans # Verify that CPK fields are considered to be covered by index scans
explain select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1; explain select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1; select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
...@@ -65,12 +81,13 @@ select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1; ...@@ -65,12 +81,13 @@ select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
explain select * from t1 where badkey=1 and key1=10; explain select * from t1 where badkey=1 and key1=10;
--replace_column 9 ROWS --replace_column 9 ROWS
explain select * from t1 where pk1 < 7500 and key1 = 10; explain select * from t1 where pk1 < 7500 and key1 = 10;
# Verify that keys with 'tails' of PK members are ok. # Verify that keys with 'tails' of PK members are ok.
explain select * from t1 where pktail1ok=1 and key1=10; explain select * from t1 where pktail1ok=1 and key1=10;
explain select * from t1 where pktail2ok=1 and key1=10; explain select * from t1 where pktail2ok=1 and key1=10;
select ' The following is actually a deficiency, it uses sort_union currently:' as 'note:'; # Note: The following is actually a deficiency, it uses sort_union currently.
# This comment refers to InnoDB and is probably not valid for other engines.
explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10; explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10;
# The expected rows differs a bit from platform to platform # The expected rows differs a bit from platform to platform
...@@ -79,33 +96,33 @@ explain select * from t1 where pktail3bad=1 and key1=10; ...@@ -79,33 +96,33 @@ explain select * from t1 where pktail3bad=1 and key1=10;
explain select * from t1 where pktail4bad=1 and key1=10; explain select * from t1 where pktail4bad=1 and key1=10;
explain select * from t1 where pktail5bad=1 and key1=10; explain select * from t1 where pktail5bad=1 and key1=10;
# Test for problem with innodb key values prefetch buffer: # Test for problem with innodb key values prefetch buffer:
explain select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10; explain select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10; select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
drop table t1; drop table t1;
# Testcase for BUG#4984 # Testcase for BUG#4984
create table t1 create table t1
( (
RUNID varchar(22), RUNID varchar(22),
SUBMITNR varchar(5), SUBMITNR varchar(5),
ORDERNR char(1) , ORDERNR char(1),
PROGRAMM varchar(8), PROGRAMM varchar(8),
TESTID varchar(4), TESTID varchar(4),
UCCHECK char(1), UCCHECK char(1),
ETEXT varchar(80), ETEXT varchar(80),
ETEXT_TYPE char(1), ETEXT_TYPE char(1),
INFO char(1), INFO char(1),
SEVERITY tinyint(3), SEVERITY tinyint(3),
TADIRFLAG char(1), TADIRFLAG char(1),
PRIMARY KEY (RUNID,SUBMITNR,ORDERNR,PROGRAMM,TESTID,UCCHECK), PRIMARY KEY (RUNID,SUBMITNR,ORDERNR,PROGRAMM,TESTID,UCCHECK),
KEY `TVERM~KEY` (PROGRAMM,TESTID,UCCHECK) KEY `TVERM~KEY` (PROGRAMM,TESTID,UCCHECK)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) DEFAULT CHARSET=latin1;
update t1 set `ETEXT` = '', `ETEXT_TYPE`='', `INFO`='', `SEVERITY`='', `TADIRFLAG`='' update t1 set `ETEXT` = '', `ETEXT_TYPE`='', `INFO`='', `SEVERITY`='', `TADIRFLAG`=''
WHERE WHERE
`RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND `RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND
`TESTID`='' AND `UCCHECK`=''; `TESTID`='' AND `UCCHECK`='';
drop table t1; drop table t1;
This diff is collapsed.
This diff is collapsed.
-- source include/have_innodb.inc # include/query_cache.inc
-- source include/have_query_cache.inc #
# The variables
# $engine_type -- storage engine to be tested
# $test_foreign_keys -- 0, skip foreign key tests
# -- 1, do not skip foreign key tests
# have to be set before sourcing this script.
#
# Last update:
# 2006-08-02 ML test refactored
# old name was innodb_cache.test
# main code went into include/query_cache.inc
#
eval SET SESSION STORAGE_ENGINE = $engine_type;
# Initialise # Initialise
--disable_warnings --disable_warnings
...@@ -11,7 +24,7 @@ drop table if exists t1,t2,t3; ...@@ -11,7 +24,7 @@ drop table if exists t1,t2,t3;
# #
flush status; flush status;
set autocommit=0; set autocommit=0;
create table t1 (a int not null) engine=innodb; create table t1 (a int not null);
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
select * from t1; select * from t1;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
...@@ -19,15 +32,15 @@ drop table t1; ...@@ -19,15 +32,15 @@ drop table t1;
commit; commit;
set autocommit=1; set autocommit=1;
begin; begin;
create table t1 (a int not null) engine=innodb; create table t1 (a int not null);
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
select * from t1; select * from t1;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
drop table t1; drop table t1;
commit; commit;
create table t1 (a int not null) engine=innodb; create table t1 (a int not null);
create table t2 (a int not null) engine=innodb; create table t2 (a int not null);
create table t3 (a int not null) engine=innodb; create table t3 (a int not null);
insert into t1 values (1),(2); insert into t1 values (1),(2);
insert into t2 values (1),(2); insert into t2 values (1),(2);
insert into t3 values (1),(2); insert into t3 values (1),(2);
...@@ -54,20 +67,22 @@ commit; ...@@ -54,20 +67,22 @@ commit;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
drop table t3,t2,t1; drop table t3,t2,t1;
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=InnoDB; CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id));
select count(*) from t1; select count(*) from t1;
insert into t1 (id) values (0); insert into t1 (id) values (0);
select count(*) from t1; select count(*) from t1;
drop table t1; drop table t1;
if ($test_foreign_keys)
{
# #
# one statement roll back inside transation # one statement roll back inside transation
# #
let $save_query_cache_size=`select @@global.query_cache_size`; let $save_query_cache_size=`select @@global.query_cache_size`;
set GLOBAL query_cache_size=1355776; set GLOBAL query_cache_size=1355776;
CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a)) ENGINE=innodb; CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a));
CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b)) ENGINE=innodb; CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b));
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`)) ENGINE=innodb; 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`));
INSERT INTO t1 VALUES (1,'me'); INSERT INTO t1 VALUES (1,'me');
INSERT INTO t2 VALUES (1,'you'); INSERT INTO t2 VALUES (1,'you');
INSERT INTO t3 VALUES (2,1,1,2); INSERT INTO t3 VALUES (2,1,1,2);
...@@ -83,5 +98,6 @@ drop table t3,t2,t1; ...@@ -83,5 +98,6 @@ drop table t3,t2,t1;
--disable_query_log --disable_query_log
eval set GLOBAL query_cache_size=$save_query_cache_size; eval set GLOBAL query_cache_size=$save_query_cache_size;
--enable_query_log --enable_query_log
}
# End of 4.1 tests # End of 4.1 tests
# include/read_many_rows.inc
#
# Test how filesort and buffered-record-reads works
# This test needs a lot of time.
#
# The variables
# $engine_type -- storage engine to be tested
# $other_engine_type -- storage engine <> $engine_type, if possible
# 1. $other_engine_type must allow to store many rows
# without using non standard server options
# (does not need a t/read_many_rows_*-master.opt file)
# 2. $other_engine_type must point to an all time
# available storage engine
# 2006-08 MySQL 5.1 MyISAM and MEMORY only
# have to be set before sourcing this script.
#
# Last update:
# 2006-08-03 ML test refactored (MySQL 5.1)
# main code t/innodb-big.test --> include/read_many_rows.inc
# #
# Test some things that takes a long time
-- source include/big_test.inc eval SET SESSION STORAGE_ENGINE = $engine_type;
-- source include/have_innodb.inc
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1, t2, t3, t4; DROP TABLE IF EXISTS t1, t2, t3, t4;
--enable_warnings --enable_warnings
# eval CREATE TABLE t1 (id INTEGER) ENGINE=$other_engine_type;
# Test test how filesort and buffered-record-reads works with innodb CREATE TABLE t2 (id INTEGER PRIMARY KEY);
# CREATE TABLE t3 (a CHAR(32) PRIMARY KEY,id INTEGER);
eval CREATE TABLE t4 (a CHAR(32) PRIMARY KEY,id INTEGER) ENGINE=$other_engine_type;
CREATE TABLE t1 (id INTEGER) ENGINE=MYISAM;
CREATE TABLE t2 (id INTEGER primary key) ENGINE=INNODB;
CREATE TABLE t3 (a char(32) primary key,id INTEGER) ENGINE=INNODB;
CREATE TABLE t4 (a char(32) primary key,id INTEGER) ENGINE=MYISAM;
INSERT INTO t1 (id) VALUES (1); INSERT INTO t1 (id) VALUES (1);
INSERT INTO t1 SELECT id+1 FROM t1; INSERT INTO t1 SELECT id+1 FROM t1;
...@@ -39,8 +52,10 @@ INSERT INTO t1 SELECT id+131072 FROM t1; ...@@ -39,8 +52,10 @@ INSERT INTO t1 SELECT id+131072 FROM t1;
INSERT INTO t1 SELECT id+262144 FROM t1; INSERT INTO t1 SELECT id+262144 FROM t1;
INSERT INTO t1 SELECT id+524288 FROM t1; INSERT INTO t1 SELECT id+524288 FROM t1;
INSERT INTO t1 SELECT id+1048576 FROM t1; INSERT INTO t1 SELECT id+1048576 FROM t1;
INSERT INTO t2 SELECT * FROM t1; INSERT INTO t2 SELECT * FROM t1;
INSERT INTO t3 SELECT concat(id),id from t2 ORDER BY -id; INSERT INTO t3 SELECT CONCAT(id),id FROM t2 ORDER BY -id;
INSERT INTO t4 SELECT * from t3 ORDER BY concat(a); INSERT INTO t4 SELECT * FROM t3 ORDER BY CONCAT(a);
select sum(id) from t3; SELECT SUM(id) FROM t3;
drop table t1,t2,t3,t4;
DROP TABLE t1,t2,t3,t4;
# include/rowid_order.inc
#
# Test for rowid ordering (and comparison) functions.
# do index_merge select for tables with PK of various types.
#
# The variable
# $engine_type -- storage engine to be tested
# has to be set before sourcing this script.
#
# Note: The comments/expections refer to InnoDB.
# They might be not valid for other storage engines.
#
# Last update:
# 2006-08-02 ML test refactored
# old name was t/rowid_order.test
# main code went into include/rowid_order.inc
#
eval SET SESSION STORAGE_ENGINE = $engine_type;
--disable_warnings
drop table if exists t1, t2, t3,t4;
--enable_warnings
# Signed number as rowid
create table t1 (
pk1 int not NULL,
key1 int(11),
key2 int(11),
PRIMARY KEY (pk1),
KEY key1 (key1),
KEY key2 (key2)
);
insert into t1 values (-5, 1, 1),
(-100, 1, 1),
(3, 1, 1),
(0, 1, 1),
(10, 1, 1);
explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
drop table t1;
# Unsigned numbers as rowids
create table t1 (
pk1 int unsigned not NULL,
key1 int(11),
key2 int(11),
PRIMARY KEY (pk1),
KEY key1 (key1),
KEY key2 (key2)
);
insert into t1 values (0, 1, 1),
(0xFFFFFFFF, 1, 1),
(0xFFFFFFFE, 1, 1),
(1, 1, 1),
(2, 1, 1);
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
drop table t1;
# Case-insensitive char(N)
create table t1 (
pk1 char(4) not NULL,
key1 int(11),
key2 int(11),
PRIMARY KEY (pk1),
KEY key1 (key1),
KEY key2 (key2)
) collate latin2_general_ci;
insert into t1 values ('a1', 1, 1),
('b2', 1, 1),
('A3', 1, 1),
('B4', 1, 1);
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
drop table t1;
# Multi-part PK
create table t1 (
pk1 int not NULL,
pk2 char(4) not NULL collate latin1_german1_ci,
pk3 char(4) not NULL collate latin1_bin,
key1 int(11),
key2 int(11),
PRIMARY KEY (pk1,pk2,pk3),
KEY key1 (key1),
KEY key2 (key2)
);
insert into t1 values
(1, 'u', 'u', 1, 1),
(1, 'u', char(0xEC), 1, 1),
(1, 'u', 'x', 1, 1);
insert ignore into t1 select pk1, char(0xEC), pk3, key1, key2 from t1;
insert ignore into t1 select pk1, 'x', pk3, key1, key2 from t1 where pk2='u';
insert ignore into t1 select 2, pk2, pk3, key1, key2 from t1;
select * from t1;
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
# Hidden PK
alter table t1 drop primary key;
select * from t1;
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
drop table t1;
# Variable-length PK
# this is also test for Bug#2688
create table t1 (
pk1 varchar(8) NOT NULL default '',
pk2 varchar(4) NOT NULL default '',
key1 int(11),
key2 int(11),
primary key(pk1, pk2),
KEY key1 (key1),
KEY key2 (key2)
);
insert into t1 values ('','empt',2,2),
('a','a--a',2,2),
('bb','b--b',2,2),
('ccc','c--c',2,2),
('dddd','d--d',2,2);
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
drop table t1;
-- source include/have_innodb.inc # include/unsafe_binlog.inc
# #
# Note that these tests uses options # The variable
# $engine_type -- storage engine to be tested
# has to be set before sourcing this script.
#
# Notes:
# 1. This test uses at least in case of InnoDB options
# innodb_locks_unsafe_for_binlog = true # innodb_locks_unsafe_for_binlog = true
# innodb_lock_timeout = 5 # innodb_lock_timeout = 5
# 2. The comments/expectations refer to InnoDB.
# They might be not valid for other storage engines.
#
# Last update:
# 2006-08-02 ML test refactored
# old name was innodb_unsafe_binlog.test
# main code went into include/unsafe_binlog.inc
#
# #
# Test cases for a bug #15650 # Test cases for bug#15650
# DELETE with LEFT JOIN crashes server with innodb_locks_unsafe_for_binlog
# #
--disable_warnings --disable_warnings
drop table if exists t1,t2; drop table if exists t1,t2;
--enable_warnings --enable_warnings
create table t1 (id int not null, f_id int not null, f int not null, eval create table t1 (id int not null, f_id int not null, f int not null,
primary key(f_id, id)) engine=innodb; primary key(f_id, id)) engine = $engine_type;
create table t2 (id int not null,s_id int not null,s varchar(200), eval create table t2 (id int not null,s_id int not null,s varchar(200),
primary key(id)) engine=innodb; primary key(id)) engine = $engine_type;
INSERT INTO t1 VALUES (8, 1, 3); INSERT INTO t1 VALUES (8, 1, 3);
INSERT INTO t1 VALUES (1, 2, 1); INSERT INTO t1 VALUES (1, 2, 1);
INSERT INTO t2 VALUES (1, 0, ''); INSERT INTO t2 VALUES (1, 0, '');
...@@ -34,10 +48,10 @@ drop table t1,t2; ...@@ -34,10 +48,10 @@ drop table t1,t2;
connect (a,localhost,root,,); connect (a,localhost,root,,);
connect (b,localhost,root,,); connect (b,localhost,root,,);
connection a; connection a;
create table t1(a int not null, b int, primary key(a)) engine=innodb; eval create table t1(a int not null, b int, primary key(a)) engine = $engine_type;
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
commit; commit;
set autocommit = 0; set autocommit = 0;
select * from t1 lock in share mode; select * from t1 lock in share mode;
update t1 set b = 5 where b = 1; update t1 set b = 5 where b = 1;
connection b; connection b;
...@@ -63,10 +77,10 @@ disconnect b; ...@@ -63,10 +77,10 @@ disconnect b;
connect (a,localhost,root,,); connect (a,localhost,root,,);
connect (b,localhost,root,,); connect (b,localhost,root,,);
connection a; connection a;
create table t1(a int not null, b int, primary key(a)) engine=innodb; eval create table t1(a int not null, b int, primary key(a)) engine = $engine_type;
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
commit; commit;
set autocommit = 0; set autocommit = 0;
update t1 set b = 5 where b = 1; update t1 set b = 5 where b = 1;
connection b; connection b;
set autocommit = 0; set autocommit = 0;
...@@ -93,9 +107,9 @@ disconnect b; ...@@ -93,9 +107,9 @@ disconnect b;
connect (a,localhost,root,,); connect (a,localhost,root,,);
connect (b,localhost,root,,); connect (b,localhost,root,,);
connection a; connection a;
create table t1(a int not null, b int, primary key(a)) engine=innodb; eval create table t1(a int not null, b int, primary key(a)) engine = $engine_type;
insert into t1 values (1,2),(5,3),(4,2); insert into t1 values (1,2),(5,3),(4,2);
create table t2(d int not null, e int, primary key(d)) engine=innodb; eval create table t2(d int not null, e int, primary key(d)) engine = $engine_type;
insert into t2 values (8,6),(12,1),(3,1); insert into t2 values (8,6),(12,1),(3,1);
commit; commit;
set autocommit = 0; set autocommit = 0;
...@@ -104,7 +118,7 @@ connection b; ...@@ -104,7 +118,7 @@ connection b;
set autocommit = 0; set autocommit = 0;
insert into t1 select * from t2; insert into t1 select * from t2;
update t1 set b = (select e from t2 where a = d); update t1 set b = (select e from t2 where a = d);
create table t3(d int not null, e int, primary key(d)) engine=innodb eval create table t3(d int not null, e int, primary key(d)) engine = $engine_type
select * from t2; select * from t2;
commit; commit;
connection a; connection a;
...@@ -115,7 +129,7 @@ disconnect b; ...@@ -115,7 +129,7 @@ disconnect b;
drop table t1, t2, t3; drop table t1, t2, t3;
# #
# Consistent read should not be used if # Consistent read should not be used if
# #
# (a) isolation level is serializable OR # (a) isolation level is serializable OR
# (b) select ... lock in share mode OR # (b) select ... lock in share mode OR
...@@ -131,26 +145,29 @@ connect (a,localhost,root,,); ...@@ -131,26 +145,29 @@ connect (a,localhost,root,,);
connect (b,localhost,root,,); connect (b,localhost,root,,);
connect (c,localhost,root,,); connect (c,localhost,root,,);
connect (d,localhost,root,,); connect (d,localhost,root,,);
eval SET SESSION STORAGE_ENGINE = $engine_type;
connect (e,localhost,root,,); connect (e,localhost,root,,);
connect (f,localhost,root,,); connect (f,localhost,root,,);
connect (g,localhost,root,,); connect (g,localhost,root,,);
eval SET SESSION STORAGE_ENGINE = $engine_type;
connect (h,localhost,root,,); connect (h,localhost,root,,);
connect (i,localhost,root,,); connect (i,localhost,root,,);
connect (j,localhost,root,,); connect (j,localhost,root,,);
eval SET SESSION STORAGE_ENGINE = $engine_type;
connection a; connection a;
create table t1(a int not null, b int, primary key(a)) engine=innodb; eval create table t1(a int not null, b int, primary key(a)) engine = $engine_type;
insert into t1 values (1,2),(5,3),(4,2); insert into t1 values (1,2),(5,3),(4,2);
create table t2(a int not null, b int, primary key(a)) engine=innodb; eval create table t2(a int not null, b int, primary key(a)) engine = $engine_type;
insert into t2 values (8,6),(12,1),(3,1); insert into t2 values (8,6),(12,1),(3,1);
create table t3(d int not null, b int, primary key(d)) engine=innodb; eval create table t3(d int not null, b int, primary key(d)) engine = $engine_type;
insert into t3 values (8,6),(12,1),(3,1); insert into t3 values (8,6),(12,1),(3,1);
create table t5(a int not null, b int, primary key(a)) engine=innodb; eval create table t5(a int not null, b int, primary key(a)) engine = $engine_type;
insert into t5 values (1,2),(5,3),(4,2); insert into t5 values (1,2),(5,3),(4,2);
create table t6(d int not null, e int, primary key(d)) engine=innodb; eval create table t6(d int not null, e int, primary key(d)) engine = $engine_type;
insert into t6 values (8,6),(12,1),(3,1); insert into t6 values (8,6),(12,1),(3,1);
create table t8(a int not null, b int, primary key(a)) engine=innodb; eval create table t8(a int not null, b int, primary key(a)) engine = $engine_type;
insert into t8 values (1,2),(5,3),(4,2); insert into t8 values (1,2),(5,3),(4,2);
create table t9(d int not null, e int, primary key(d)) engine=innodb; eval create table t9(d int not null, e int, primary key(d)) engine = $engine_type;
insert into t9 values (8,6),(12,1),(3,1); insert into t9 values (8,6),(12,1),(3,1);
commit; commit;
set autocommit = 0; set autocommit = 0;
...@@ -169,7 +186,7 @@ connection d; ...@@ -169,7 +186,7 @@ connection d;
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
--send --send
create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2; create table t4(a int not null, b int, primary key(a)) select * from t2;
connection e; connection e;
set autocommit = 0; set autocommit = 0;
--send --send
...@@ -181,7 +198,7 @@ update t6 set e = (select b from t2 where a = d lock in share mode); ...@@ -181,7 +198,7 @@ update t6 set e = (select b from t2 where a = d lock in share mode);
connection g; connection g;
set autocommit = 0; set autocommit = 0;
--send --send
create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode; create table t7(a int not null, b int, primary key(a)) select * from t2 lock in share mode;
connection h; connection h;
set autocommit = 0; set autocommit = 0;
--send --send
...@@ -193,7 +210,7 @@ update t9 set e = (select b from t2 where a = d for update); ...@@ -193,7 +210,7 @@ update t9 set e = (select b from t2 where a = d for update);
connection j; connection j;
set autocommit = 0; set autocommit = 0;
--send --send
create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update; create table t10(a int not null, b int, primary key(a)) select * from t2 for update;
connection b; connection b;
--error 1205 --error 1205
......
SET SESSION STORAGE_ENGINE = InnoDB;
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3;
flush status; flush status;
set autocommit=0; set autocommit=0;
create table t1 (a int not null) engine=innodb; create table t1 (a int not null);
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
select * from t1; select * from t1;
a a
...@@ -15,7 +16,7 @@ drop table t1; ...@@ -15,7 +16,7 @@ drop table t1;
commit; commit;
set autocommit=1; set autocommit=1;
begin; begin;
create table t1 (a int not null) engine=innodb; create table t1 (a int not null);
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
select * from t1; select * from t1;
a a
...@@ -27,9 +28,9 @@ Variable_name Value ...@@ -27,9 +28,9 @@ Variable_name Value
Qcache_queries_in_cache 1 Qcache_queries_in_cache 1
drop table t1; drop table t1;
commit; commit;
create table t1 (a int not null) engine=innodb; create table t1 (a int not null);
create table t2 (a int not null) engine=innodb; create table t2 (a int not null);
create table t3 (a int not null) engine=innodb; create table t3 (a int not null);
insert into t1 values (1),(2); insert into t1 values (1),(2);
insert into t2 values (1),(2); insert into t2 values (1),(2);
insert into t3 values (1),(2); insert into t3 values (1),(2);
...@@ -99,7 +100,7 @@ show status like "Qcache_queries_in_cache"; ...@@ -99,7 +100,7 @@ show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 1 Qcache_queries_in_cache 1
drop table t3,t2,t1; drop table t3,t2,t1;
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=InnoDB; CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id));
select count(*) from t1; select count(*) from t1;
count(*) count(*)
0 0
...@@ -109,9 +110,9 @@ count(*) ...@@ -109,9 +110,9 @@ count(*)
1 1
drop table t1; drop table t1;
set GLOBAL query_cache_size=1355776; set GLOBAL query_cache_size=1355776;
CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a)) ENGINE=innodb; CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a));
CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b)) ENGINE=innodb; CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b));
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`)) ENGINE=innodb; 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`));
INSERT INTO t1 VALUES (1,'me'); INSERT INTO t1 VALUES (1,'me');
INSERT INTO t2 VALUES (1,'you'); INSERT INTO t2 VALUES (1,'you');
INSERT INTO t3 VALUES (2,1,1,2); INSERT INTO t3 VALUES (2,1,1,2);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# t/cache_innodb.test
#
# Last update:
# 2006-07-26 ML test refactored (MySQL 5.1)
# main code t/innodb_cache.test --> include/query_cache.inc
# new wrapper t/cache_innodb.test
#
--source include/have_query_cache.inc
--source include/have_innodb.inc
let $engine_type= InnoDB;
# InnoDB supports FOREIGN KEYs
let $test_foreign_keys= 1;
--source include/query_cache.inc
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -953,6 +953,7 @@ class handler :public Sql_alloc ...@@ -953,6 +953,7 @@ class handler :public Sql_alloc
{ {
/* TODO: DBUG_ASSERT(inited == NONE); */ /* TODO: DBUG_ASSERT(inited == NONE); */
} }
virtual handler *clone(MEM_ROOT *mem_root);
/* This is called after create to allow us to set up cached variables */ /* This is called after create to allow us to set up cached variables */
void init() void init()
{ {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment