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