Debian Codegraph @

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

raw
1 # WL#6745 InnoDB R-tree support
2 # This test case will test R-tree split, mostly on duplciate records.
3
4
5 --source include/big_test.inc
6 --source include/not_valgrind.inc
7 --source include/have_debug.inc
8
9 # Create table with R-tree index.
10 create table t1 (c1 int, c2 geometry not null SRID 0, spatial index (c2))engine=innodb;
11
12 # Insert enough values to let R-tree split.
13 insert into t1 values(1, Point(1,1));
14 insert into t1 values(2, Point(2,2));
15 insert into t1 values(3, Point(3,3));
16 insert into t1 values(4, Point(4,4));
17 insert into t1 values(5, Point(5,5));
18 insert into t1 values(6, Point(6,6));
19 insert into t1 values(7, Point(7,7));
20 insert into t1 values(8, Point(8,8));
21 insert into t1 values(9, Point(9,9));
22
23 insert into t1 select * from t1;
24 insert into t1 select * from t1;
25 insert into t1 select * from t1;
26 insert into t1 select * from t1;
27 insert into t1 select * from t1;
28 insert into t1 select * from t1;
29
30 #Check second round spliting.
31 SET SESSION debug="+d, rtr_page_need_second_split";
32 insert into t1 select * from t1;
33 SET SESSION debug="-d, rtr_page_need_second_split";
34
35 delete from t1;
36
37 insert into t1 values(1, Point(1,1));
38 insert into t1 values(2, Point(2,2));
39 insert into t1 values(3, Point(3,3));
40 insert into t1 values(4, Point(4,4));
41 insert into t1 values(5, Point(5,5));
42 insert into t1 values(6, Point(6,6));
43 insert into t1 values(7, Point(7,7));
44 insert into t1 values(8, Point(8,8));
45 insert into t1 values(9, Point(9,9));
46
47 insert into t1 select * from t1;
48 insert into t1 select * from t1;
49 insert into t1 select * from t1;
50 insert into t1 select * from t1;
51
52 insert into t1 select * from t1;
53 insert into t1 select * from t1;
54
55 insert into t1 select * from t1;
56 insert into t1 select * from t1;
57 start transaction;
58 insert into t1 select * from t1;
59 rollback;
60 check table t1;
61 insert into t1 select * from t1;
62 insert into t1 select * from t1;
63 insert into t1 select * from t1;
64 insert into t1 select * from t1;
65 insert into t1 select * from t1;
66 check table t1;
67
68 select count(*) from t1;
69
70 set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))');
71 select count(*) from t1 where MBRWithin(t1.c2, @g1);
72
73 set @g1 = ST_GeomFromText('Polygon((10 10,10 800,800 800,800 10,10 10))');
74 select count(*) from t1 where MBRWithin(t1.c2, @g1);
75
76 drop index c2 on t1;
77
78 # Test create index with algorithm=inplace
79 create spatial index idx2 on t1(c2);
80
81 show create table t1;
82
83 set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))');
84 select count(*) from t1 where MBRWithin(t1.c2, @g1);
85
86 # test read only case
87 --source include/restart_innodb_read_only.inc
88
89 set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))');
90 select count(*) from t1 where MBRWithin(t1.c2, @g1);
91
92 set @g1 = ST_GeomFromText('Polygon((2 2,2 800,800 800,800 2,2 2))');
93 select count(*) from t1 where MBRWithin(t1.c2, @g1);
94
95 let $restart_parameters = restart;
96 --source include/restart_mysqld.inc
97
98 # Clean up.
99 drop table t1;
100
101 --echo #
102 --echo # Bug #29465567 INNODB: RTREE SPLIT ASSERTION FAILURE
103 --echo #
104
105 # Create table with R-tree index.
106 create table t1 (c1 int, c2 geometry not null SRID 0, spatial index (c2))engine=innodb;
107
108 # Insert enough values to let R-tree split.
109 insert into t1 values(1, Point(1,1));
110 insert into t1 values(2, Point(2,2));
111 insert into t1 values(3, Point(3,3));
112 insert into t1 values(4, Point(4,4));
113 insert into t1 values(5, Point(5,5));
114 insert into t1 values(6, Point(6,6));
115 insert into t1 values(7, Point(7,7));
116 insert into t1 values(8, Point(8,8));
117 insert into t1 values(9, Point(9,9));
118
119 insert into t1 select * from t1;
120 insert into t1 select * from t1;
121 insert into t1 select * from t1;
122 insert into t1 select * from t1;
123 insert into t1 select * from t1;
124 insert into t1 select * from t1;
125 insert into t1 select * from t1;
126 insert into t1 select * from t1;
127 start transaction;
128 insert into t1 select * from t1;
129 rollback;
130 check table t1;
131 insert into t1 select * from t1;
132 insert into t1 select * from t1;
133 insert into t1 select * from t1;
134 insert into t1 select * from t1;
135
136 #Check first round spliting.
137 SET SESSION debug="+d, rtr_page_need_first_split";
138 insert into t1 select * from t1;
139 SET SESSION debug="-d, rtr_page_need_first_split";
140
141 # Clean up.
142 drop table t1;