| 1 |
# WL#6745 InnoDB R-tree support |
| 2 |
# This test case will test R-tree multi level split. |
| 3 |
|
| 4 |
--source include/big_test.inc |
| 5 |
--source include/not_valgrind.inc |
| 6 |
--source include/have_debug.inc |
| 7 |
|
| 8 |
# Create table with R-tree index. |
| 9 |
create table t1 (c1 int, c2 geometry not null SRID 0, spatial index (c2))engine=innodb; |
| 10 |
|
| 11 |
# Insert enough values to let R-tree split. |
| 12 |
delimiter |; |
| 13 |
create procedure insert_t1(IN total int) |
| 14 |
begin |
| 15 |
declare i int default 1; |
| 16 |
while (i <= total) DO |
| 17 |
insert into t1 values |
| 18 |
(i, Point(i, i)), |
| 19 |
(i + 1, Point(i + 1, i + 1)), |
| 20 |
(i + 2, Point(i + 2, i + 2)), |
| 21 |
(i + 3, Point(i + 3, i + 3)), |
| 22 |
(i + 4, Point(i + 4, i + 4)), |
| 23 |
(i + 5, Point(i + 5, i + 5)), |
| 24 |
(i + 6, Point(i + 6, i + 6)), |
| 25 |
(i + 7, Point(i + 7, i + 7)), |
| 26 |
(i + 8, Point(i + 8, i + 8)), |
| 27 |
(i + 9, Point(i + 9, i + 9)); |
| 28 |
set i = i + 10; |
| 29 |
end while; |
| 30 |
end| |
| 31 |
delimiter ;| |
| 32 |
|
| 33 |
# Test level 1 rtree. |
| 34 |
CALL insert_t1(5000); |
| 35 |
select count(*) from t1; |
| 36 |
|
| 37 |
# Check table. |
| 38 |
check table t1; |
| 39 |
|
| 40 |
# Test level 2 rtree. |
| 41 |
truncate table t1; |
| 42 |
CALL insert_t1(10000); |
| 43 |
select count(*) from t1; |
| 44 |
|
| 45 |
drop index c2 on t1; |
| 46 |
|
| 47 |
create spatial index idx on t1(c2); |
| 48 |
|
| 49 |
show create table t1; |
| 50 |
|
| 51 |
SET DEBUG='+d,ddl_ins_spatial_fail'; |
| 52 |
--error ER_GET_ERRNO |
| 53 |
create spatial index idx2 on t1(c2); |
| 54 |
SET DEBUG='-d,ddl_ins_spatial_fail'; |
| 55 |
show create table t1; |
| 56 |
|
| 57 |
# Check table. |
| 58 |
check table t1; |
| 59 |
|
| 60 |
# Test level 3 rtree. |
| 61 |
truncate table t1; |
| 62 |
CALL insert_t1(100000); |
| 63 |
select count(*) from t1; |
| 64 |
|
| 65 |
# Check table. |
| 66 |
check table t1; |
| 67 |
|
| 68 |
truncate table t1; |
| 69 |
|
| 70 |
# Clean up. |
| 71 |
drop procedure insert_t1; |
| 72 |
drop table t1; |