| 1 |
# WL#6745 InnoDB R-tree support |
| 2 |
# This test case test R-tree crash/recovery. |
| 3 |
|
| 4 |
--source include/no_valgrind_without_big.inc |
| 5 |
|
| 6 |
# Do a clean shutdown and restart so that the redo log is cleaned up from previous tests. |
| 7 |
--source include/restart_mysqld.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 |
delimiter |; |
| 14 |
create procedure insert_t1(IN total int) |
| 15 |
begin |
| 16 |
declare i int default 1; |
| 17 |
while (i <= total) DO |
| 18 |
insert into t1 values (i, Point(i, i)); |
| 19 |
set i = i + 1; |
| 20 |
end while; |
| 21 |
end| |
| 22 |
delimiter ;| |
| 23 |
|
| 24 |
# Update values |
| 25 |
delimiter |; |
| 26 |
create procedure update_t1(IN total int) |
| 27 |
begin |
| 28 |
declare i int default 1; |
| 29 |
while (i <= total) DO |
| 30 |
update t1 set c2 = Point(i + 10000, i + 10000) where c2 = Point(i, i); |
| 31 |
set i = i + 1; |
| 32 |
end while; |
| 33 |
end| |
| 34 |
delimiter ;| |
| 35 |
|
| 36 |
|
| 37 |
# Test crash recovery. |
| 38 |
# |
| 39 |
|
| 40 |
# Test level 1 rtree. |
| 41 |
CALL insert_t1(367); |
| 42 |
COMMIT; |
| 43 |
|
| 44 |
--source include/kill_and_restart_mysqld.inc |
| 45 |
|
| 46 |
# Check table. |
| 47 |
check table t1; |
| 48 |
|
| 49 |
# Clean up. |
| 50 |
drop table t1; |
| 51 |
|
| 52 |
# Test crash recovery on point spatial index. |
| 53 |
create table t1 (c1 int, c2 point not null SRID 0, spatial index (c2))engine=innodb; |
| 54 |
|
| 55 |
# Some DML on point spatial index. |
| 56 |
CALL insert_t1(367); |
| 57 |
CALL update_t1(367); |
| 58 |
|
| 59 |
SET @poly1 = ST_GeomFromText('POLYGON((10000 10000, 10000 10350, 10350 10350, 10350 10000, 10000 10000))'); |
| 60 |
delete from t1 where ST_Contains(@poly1, c2); |
| 61 |
COMMIT; |
| 62 |
|
| 63 |
--source include/kill_and_restart_mysqld.inc |
| 64 |
|
| 65 |
# Check table. |
| 66 |
check table t1; |
| 67 |
|
| 68 |
select count(*) from t1; |
| 69 |
select c1, ST_astext(c2) from t1; |
| 70 |
|
| 71 |
# Clean up. |
| 72 |
drop procedure insert_t1; |
| 73 |
drop procedure update_t1; |
| 74 |
drop table t1; |