polardbxengine/mysql-test/suite/innodb_gis/t/rtree_concurrent_srch_2.test

63 lines
1.4 KiB
Plaintext

# This test case will test concurrent search on R-tree.
--source include/have_debug.inc
--source include/have_innodb_16k.inc
CREATE TABLE g (
id INT PRIMARY KEY,
p GEOMETRY NOT NULL SRID 0,
SPATIAL KEY p_idx(p)
) ENGINE=InnoDB;
delimiter |;
create procedure populate_g(IN `rows` INT)
begin
declare i int default 1;
while (i <= `rows`) DO
insert into test.g (id, p) values (i, POINT(i, i));
set i = i + 1;
end while;
end|
delimiter ;|
call populate_g(650);
start transaction;
select id from g WHERE MBRContains(ST_GeomFromText('Polygon((100 0,100 5,105
5,105 0,100 0))'),p) for update;
connect (a,localhost,root,,);
connection a;
set innodb_lock_wait_timeout = 1;
set transaction isolation level serializable;
--error ER_LOCK_WAIT_TIMEOUT
insert into g values(1103, POINT(100, 1));
connect (b,localhost,root,,);
connection b;
start transaction;
select id from g WHERE MBRContains(ST_GeomFromText('Polygon((100 0,100 5,105
5,105 0,100 0))'),p) for update;
connection default;
commit;
connection a;
set innodb_lock_wait_timeout = 1;
set transaction isolation level serializable;
--error ER_LOCK_WAIT_TIMEOUT
insert into g values(1103, POINT(100, 1));
disconnect a;
--source include/wait_until_disconnected.inc
connection b;
commit;
disconnect b;
--source include/wait_until_disconnected.inc
connection default;
DROP TABLE g;
DROP PROCEDURE populate_g;
set innodb_lock_wait_timeout = default;