| 1 |
CREATE TABLE g ( |
| 2 |
id INT PRIMARY KEY, |
| 3 |
p GEOMETRY NOT NULL SRID 0, |
| 4 |
SPATIAL KEY p_idx(p) |
| 5 |
) ENGINE=InnoDB; |
| 6 |
create procedure populate_g(IN `rows` INT) |
| 7 |
begin |
| 8 |
declare i int default 1; |
| 9 |
while (i <= `rows`) DO |
| 10 |
insert into test.g (id, p) values (i, POINT(i, i)); |
| 11 |
set i = i + 1; |
| 12 |
end while; |
| 13 |
end| |
| 14 |
call populate_g(650); |
| 15 |
start transaction; |
| 16 |
select id from g WHERE MBRContains(ST_GeomFromText('Polygon((100 0,100 5,105 |
| 17 |
5,105 0,100 0))'),p) for update; |
| 18 |
id |
| 19 |
set innodb_lock_wait_timeout = 1; |
| 20 |
set transaction isolation level serializable; |
| 21 |
insert into g values(1103, POINT(100, 1)); |
| 22 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 23 |
start transaction; |
| 24 |
select id from g WHERE MBRContains(ST_GeomFromText('Polygon((100 0,100 5,105 |
| 25 |
5,105 0,100 0))'),p) for update; |
| 26 |
id |
| 27 |
commit; |
| 28 |
set innodb_lock_wait_timeout = 1; |
| 29 |
set transaction isolation level serializable; |
| 30 |
insert into g values(1103, POINT(100, 1)); |
| 31 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 32 |
commit; |
| 33 |
DROP TABLE g; |
| 34 |
DROP PROCEDURE populate_g; |
| 35 |
set innodb_lock_wait_timeout = default; |