Skip to content

Commit 66d3c8f

Browse files
author
Allen Lai
committed
Bug 27577612 - CONCURRENT SERIALIZABLE TRANSACTIONS CAN INSERT INTO
AN AREA SELECTED FOR UPDATE Followup patch for this bug. Move the new added test out from rtree_concurrent_srch, since the new test is only for 16k page size.
1 parent e52921d commit 66d3c8f

File tree

4 files changed

+101
-93
lines changed

4 files changed

+101
-93
lines changed

mysql-test/suite/innodb_gis/r/rtree_concurrent_srch.result

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -323,39 +323,4 @@ count(*)
323323
drop procedure insert_t1;
324324
DROP TABLE t1;
325325
SET SESSION debug="-d,rtr_pcur_move_to_next_return";
326-
CREATE TABLE g (
327-
id INT PRIMARY KEY,
328-
p GEOMETRY NOT NULL,
329-
SPATIAL KEY p_idx(p)
330-
) ENGINE=InnoDB;
331-
create procedure populate_g(IN `rows` INT)
332-
begin
333-
declare i int default 1;
334-
while (i <= `rows`) DO
335-
insert into test.g (id, p) values (i, POINT(i, i));
336-
set i = i + 1;
337-
end while;
338-
end|
339-
call populate_g(650);
340-
start transaction;
341-
select id from g WHERE MBRContains(ST_GeomFromText('Polygon((100 0,100 5,105
342-
5,105 0,100 0))'),p) for update;
343-
id
344-
set innodb_lock_wait_timeout = 1;
345-
set transaction isolation level serializable;
346-
insert into g values(1103, POINT(100, 1));
347-
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
348-
start transaction;
349-
select id from g WHERE MBRContains(ST_GeomFromText('Polygon((100 0,100 5,105
350-
5,105 0,100 0))'),p) for update;
351-
id
352-
commit;
353-
set innodb_lock_wait_timeout = 1;
354-
set transaction isolation level serializable;
355-
insert into g values(1103, POINT(100, 1));
356-
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
357-
commit;
358-
DROP TABLE g;
359-
DROP PROCEDURE populate_g;
360-
set innodb_lock_wait_timeout = default;
361326
SET DEBUG_SYNC = 'RESET';
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
CREATE TABLE g (
2+
id INT PRIMARY KEY,
3+
p GEOMETRY NOT NULL,
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;

mysql-test/suite/innodb_gis/t/rtree_concurrent_srch.test

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -448,62 +448,4 @@ disconnect b;
448448
--source include/wait_until_disconnected.inc
449449

450450
connection default;
451-
CREATE TABLE g (
452-
id INT PRIMARY KEY,
453-
p GEOMETRY NOT NULL,
454-
SPATIAL KEY p_idx(p)
455-
) ENGINE=InnoDB;
456-
457-
delimiter |;
458-
create procedure populate_g(IN `rows` INT)
459-
begin
460-
declare i int default 1;
461-
while (i <= `rows`) DO
462-
insert into test.g (id, p) values (i, POINT(i, i));
463-
set i = i + 1;
464-
end while;
465-
end|
466-
delimiter ;|
467-
468-
call populate_g(650);
469-
470-
start transaction;
471-
select id from g WHERE MBRContains(ST_GeomFromText('Polygon((100 0,100 5,105
472-
5,105 0,100 0))'),p) for update;
473-
474-
connect (a,localhost,root,,);
475-
connection a;
476-
set innodb_lock_wait_timeout = 1;
477-
set transaction isolation level serializable;
478-
479-
--error ER_LOCK_WAIT_TIMEOUT
480-
insert into g values(1103, POINT(100, 1));
481-
482-
connect (b,localhost,root,,);
483-
connection b;
484-
start transaction;
485-
select id from g WHERE MBRContains(ST_GeomFromText('Polygon((100 0,100 5,105
486-
5,105 0,100 0))'),p) for update;
487-
488-
connection default;
489-
commit;
490-
491-
connection a;
492-
set innodb_lock_wait_timeout = 1;
493-
set transaction isolation level serializable;
494-
495-
--error ER_LOCK_WAIT_TIMEOUT
496-
insert into g values(1103, POINT(100, 1));
497-
disconnect a;
498-
--source include/wait_until_disconnected.inc
499-
500-
connection b;
501-
commit;
502-
disconnect b;
503-
--source include/wait_until_disconnected.inc
504-
505-
connection default;
506-
DROP TABLE g;
507-
DROP PROCEDURE populate_g;
508-
set innodb_lock_wait_timeout = default;
509451
SET DEBUG_SYNC = 'RESET';
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# This test case will test concurrent search on R-tree.
2+
# Not supported in embedded
3+
--source include/not_embedded.inc
4+
5+
--source include/have_innodb.inc
6+
--source include/have_debug.inc
7+
--source include/have_innodb_16k.inc
8+
9+
CREATE TABLE g (
10+
id INT PRIMARY KEY,
11+
p GEOMETRY NOT NULL,
12+
SPATIAL KEY p_idx(p)
13+
) ENGINE=InnoDB;
14+
15+
delimiter |;
16+
create procedure populate_g(IN `rows` INT)
17+
begin
18+
declare i int default 1;
19+
while (i <= `rows`) DO
20+
insert into test.g (id, p) values (i, POINT(i, i));
21+
set i = i + 1;
22+
end while;
23+
end|
24+
delimiter ;|
25+
26+
call populate_g(650);
27+
28+
start transaction;
29+
select id from g WHERE MBRContains(ST_GeomFromText('Polygon((100 0,100 5,105
30+
5,105 0,100 0))'),p) for update;
31+
32+
connect (a,localhost,root,,);
33+
connection a;
34+
set innodb_lock_wait_timeout = 1;
35+
set transaction isolation level serializable;
36+
37+
--error ER_LOCK_WAIT_TIMEOUT
38+
insert into g values(1103, POINT(100, 1));
39+
40+
connect (b,localhost,root,,);
41+
connection b;
42+
start transaction;
43+
select id from g WHERE MBRContains(ST_GeomFromText('Polygon((100 0,100 5,105
44+
5,105 0,100 0))'),p) for update;
45+
46+
connection default;
47+
commit;
48+
49+
connection a;
50+
set innodb_lock_wait_timeout = 1;
51+
set transaction isolation level serializable;
52+
53+
--error ER_LOCK_WAIT_TIMEOUT
54+
insert into g values(1103, POINT(100, 1));
55+
disconnect a;
56+
--source include/wait_until_disconnected.inc
57+
58+
connection b;
59+
commit;
60+
disconnect b;
61+
--source include/wait_until_disconnected.inc
62+
63+
connection default;
64+
DROP TABLE g;
65+
DROP PROCEDURE populate_g;
66+
set innodb_lock_wait_timeout = default;

0 commit comments

Comments
 (0)