Debian Codegraph @

mysql-test/suite/innodb_gis/t/multi_pk.test

raw
1 # WL#6745 InnoDB R-tree support
2 # This test case will test R-tree split.
3
4 # Not supported in embedded
5 --source include/not_embedded.inc
6
7 --source include/have_innodb.inc
8 --source include/have_debug.inc
9 --source include/big_test.inc
10 --source include/not_valgrind.inc
11 # This test often times out with MSAN
12 --source include/not_msan.inc
13
14 # Create table with R-tree index.
15 create table t1 (c1 int, c2 varchar(255), c3 geometry not null, primary key(c1, c2), spatial index (c3))engine=innodb;
16
17 # Insert enough values to let R-tree split.
18 delimiter |;
19
20 create function rand_string(str_length tinyint unsigned, str_type tinyint unsigned) returns varchar(255)
21 begin
22 declare counter int unsigned default 0;
23 declare const_chars varchar(64) default '0123456789';
24 declare result varchar(255) default '';
25
26 if str_type = 1 then
27 set const_chars = '0123456789';
28 elseif str_type = 2 then
29 set const_chars = 'abcdefghijklmnopqrstuvwxyz';
30 elseif str_type = 3 then
31 set const_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
32 elseif str_type = 4 then
33 set const_chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
34 elseif str_type = 5 then
35 set const_chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
36 else
37 set const_chars = '0123456789';
38 end if;
39
40 while counter < str_length do
41 set result = concat(result,substr(const_chars,ceil(rand()*(length(const_chars)-1)),1));
42 set counter = counter + 1;
43 end while;
44
45 return result;
46 end|
47
48 create procedure insert_t1(IN total int)
49 begin
50 declare i int default 1;
51 declare i2 int default 1;
52 declare str varchar(100) default '';
53 declare dup_key int default 1;
54 while i <= total DO
55 set i2 = floor(0+(rand()*100));
56 set str = rand_string(i2, 5);
57 select count(*) into dup_key from t1 where c2 = str and c1 = i;
58 while dup_key <> 0 do
59 set i2 = floor(0+(rand()*100));
60 set str = rand_string(i2, 5);
61 select count(*) into dup_key from t1 where c2 = str and c1 = i;
62 end while;
63 insert into t1 values (i, str, Point(i, i));
64 set i = i + 1;
65 end while;
66 end|
67
68 delimiter ;|
69
70 CALL insert_t1(10000);
71 check table t1;
72
73 start transaction;
74 CALL insert_t1(30000);
75 rollback;
76 check table t1;
77
78 # Clean up.
79 drop procedure insert_t1;
80 drop function rand_string;
81 drop table t1;
82