1 # include/read_many_rows.inc
3 # Test how filesort and buffered-record-reads works
4 # This test needs a lot of time.
7 # $engine_type -- storage engine to be tested
8 # $other_engine_type -- storage engine <> $engine_type, if possible
9 # 1. $other_engine_type must allow to store many rows
10 # without using non standard server options
11 # (does not need a t/read_many_rows_*-master.opt file)
12 # 2. $other_engine_type must point to an all time
13 # available storage engine
14 # 2006-08 MySQL 5.1 MyISAM and MEMORY only
15 # have to be set before sourcing this script.
18 # 2006-08-03 ML test refactored (MySQL 5.1)
19 # main code t/innodb-big.test --> include/read_many_rows.inc
22 eval SET SESSION DEFAULT_STORAGE_ENGINE = $engine_type;
25 DROP
TABLE IF EXISTS t1, t2, t3, t4;
28 eval CREATE
TABLE t1 (
id INTEGER) ENGINE=$other_engine_type;
29 CREATE
TABLE t2 (
id INTEGER PRIMARY
KEY);
30 CREATE
TABLE t3 (a CHAR(32) PRIMARY
KEY,
id INTEGER);
31 eval CREATE
TABLE t4 (a CHAR(32) PRIMARY
KEY,
id INTEGER) ENGINE=$other_engine_type;
33 INSERT INTO t1 (
id) VALUES (1);
34 INSERT INTO t1 SELECT
id+1 FROM t1;
35 INSERT INTO t1 SELECT
id+2 FROM t1;
36 INSERT INTO t1 SELECT
id+4 FROM t1;
37 INSERT INTO t1 SELECT
id+8 FROM t1;
38 INSERT INTO t1 SELECT
id+16 FROM t1;
39 INSERT INTO t1 SELECT
id+32 FROM t1;
40 INSERT INTO t1 SELECT
id+64 FROM t1;
41 INSERT INTO t1 SELECT
id+128 FROM t1;
42 INSERT INTO t1 SELECT
id+256 FROM t1;
43 INSERT INTO t1 SELECT
id+512 FROM t1;
44 INSERT INTO t1 SELECT
id+1024 FROM t1;
45 INSERT INTO t1 SELECT
id+2048 FROM t1;
46 INSERT INTO t1 SELECT
id+4096 FROM t1;
47 INSERT INTO t1 SELECT
id+8192 FROM t1;
48 INSERT INTO t1 SELECT
id+16384 FROM t1;
49 INSERT INTO t1 SELECT
id+32768 FROM t1;
50 INSERT INTO t1 SELECT
id+65536 FROM t1;
51 INSERT INTO t1 SELECT
id+131072 FROM t1;
52 INSERT INTO t1 SELECT
id+262144 FROM t1;
53 INSERT INTO t1 SELECT
id+524288 FROM t1;
54 INSERT INTO t1 SELECT
id+1048576 FROM t1;
56 INSERT INTO t2 SELECT * FROM t1;
57 INSERT INTO t3 SELECT CONCAT(
id),
id FROM t2
ORDER BY -
id;
58 INSERT INTO t4 SELECT * FROM t3
ORDER BY CONCAT(a);
59 SELECT SUM(
id) FROM t3;
61 DROP
TABLE t1,t2,t3,t4;
64 # Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
66 CREATE
TABLE t1 (f1
int NOT NULL) ENGINE=InnoDB;
67 CREATE
TABLE t2 (f2
int(11) NOT NULL PRIMARY
KEY AUTO_INCREMENT) ENGINE=InnoDB;
69 CREATE TRIGGER t1_bi before INSERT
72 DECLARE CONTINUE HANDLER FOR SQLSTATE
'40001' SET @a:=
'deadlock';
73 DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:=
'exception';
74 INSERT INTO t2 (f2) VALUES (1);
75 DELETE FROM t2 WHERE f2 = 1;
78 CREATE PROCEDURE proc24989()
80 DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @b:= 'deadlock';
81 DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
82 INSERT INTO t2 (f2) VALUES (1);
83 DELETE FROM t2 WHERE f2 = 1;
86 create procedure proc24989_2()
89 declare continue
handler for sqlexception
90 select 'Outer
handler' as 'exception';
92 insert into t1 values(1);
98 connect (con1,localhost,root,,);
99 connect (con2,localhost,root,,);
103 insert into t1 values(1);
107 insert into t2 values(123);
108 send insert into t1 values(1);
112 insert into t1 values(1);
118 # check that the whole transaction was rolled back
124 insert into t1 values(1);
128 insert into t2 values(123);
129 send call proc24989();
133 insert into t1 values(1);
138 # check that the whole transaction was rolled back
144 insert into t1 values(1);
148 insert into t2 values(123);
149 send call proc24989_2();
153 insert into t1 values(1);
158 # check that the whole transaction was rolled back
164 drop procedure proc24989;
165 drop procedure proc24989_2;