Debian Codegraph @

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

raw
1 # innodb_gis.rtree_split with a geographic SRS
2
3 --source include/big_test.inc
4 --source include/not_valgrind.inc
5 --source include/not_sparc_debug.inc
6 --source include/have_debug.inc
7
8 # Create table with R-tree index.
9 create table t1 (c1 int, c2 geometry srid 4326 not null, spatial index (c2))engine=innodb;
10
11 # Insert enough values to let R-tree split.
12 insert into t1 values(1, ST_SRID(Point(1,1), 4326));
13 insert into t1 values(2, ST_SRID(Point(2,2), 4326));
14 insert into t1 values(3, ST_SRID(Point(3,3), 4326));
15 insert into t1 values(4, ST_SRID(Point(4,4), 4326));
16 insert into t1 values(5, ST_SRID(Point(5,5), 4326));
17 insert into t1 values(6, ST_SRID(Point(6,6), 4326));
18 insert into t1 values(7, ST_SRID(Point(7,7), 4326));
19 insert into t1 values(8, ST_SRID(Point(8,8), 4326));
20 insert into t1 values(9, ST_SRID(Point(9,9), 4326));
21
22 insert into t1 select * from t1;
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
29 #Check second round spliting.
30 SET SESSION debug="+d, rtr_page_need_second_split";
31 insert into t1 select * from t1;
32 SET SESSION debug="-d, rtr_page_need_second_split";
33
34 delete from t1;
35
36 insert into t1 values(1, ST_SRID(Point(1,1), 4326));
37 insert into t1 values(2, ST_SRID(Point(2,2), 4326));
38 insert into t1 values(3, ST_SRID(Point(3,3), 4326));
39 insert into t1 values(4, ST_SRID(Point(4,4), 4326));
40 insert into t1 values(5, ST_SRID(Point(5,5), 4326));
41 insert into t1 values(6, ST_SRID(Point(6,6), 4326));
42 insert into t1 values(7, ST_SRID(Point(7,7), 4326));
43 insert into t1 values(8, ST_SRID(Point(8,8), 4326));
44 insert into t1 values(9, ST_SRID(Point(9,9), 4326));
45
46 insert into t1 select * from t1;
47 insert into t1 select * from t1;
48 insert into t1 select * from t1;
49 insert into t1 select * from t1;
50
51 insert into t1 select * from t1;
52 insert into t1 select * from t1;
53
54 insert into t1 select * from t1;
55 insert into t1 select * from t1;
56 start transaction;
57 insert into t1 select * from t1;
58 rollback;
59 check table t1;
60 insert into t1 select * from 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 check table t1;
66
67 select count(*) from t1;
68
69 set @g1 = ST_GeomFromText('Polygon((-90 -180,-90 180,90 180,90 -180,-90 -180))', 4326);
70 select count(*) from t1 where MBRWithin(t1.c2, @g1);
71
72 set @g1 = ST_GeomFromText('Polygon((10 10,10 180,90 180,90 10,10 10))', 4326);
73 select count(*) from t1 where MBRWithin(t1.c2, @g1);
74
75 drop index c2 on t1;
76
77 # Test create index with algorithm=inplace
78 create spatial index idx2 on t1(c2);
79
80 show create table t1;
81
82 set @g1 = ST_GeomFromText('Polygon((-90 -180,-90 180,90 180,90 -180,-90 -180))', 4326);
83 select count(*) from t1 where MBRWithin(t1.c2, @g1);
84
85 # test read only case
86 --source include/restart_innodb_read_only.inc
87
88 set @g1 = ST_GeomFromText('Polygon((-90 -180,-90 180,90 180,90 -180,-90 -180))', 4326);
89 select count(*) from t1 where MBRWithin(t1.c2, @g1);
90
91 set @g1 = ST_GeomFromText('Polygon((2 2,2 180,90 180,90 2,2 2))', 4326);
92 select count(*) from t1 where MBRWithin(t1.c2, @g1);
93
94 let $restart_parameters = restart;
95 --source include/restart_mysqld.inc
96
97 # Clean up.
98 drop table t1;