mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Fixed bug #31310.
Locked rows of the InnoDB storage was silently skipped in the read-committed isolation level. QUICK_RANGE_SELECT for unique ranges lacks second (blocking) read of the record that was read semi-consistently and just skip it. The handler::read_multi_range_next method has been modified to retry previous unique range if the previous read was semi-consistent.
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4;
|
||||
drop procedure if exists p1;
|
||||
create table t1 (
|
||||
c_id int(11) not null default '0',
|
||||
org_id int(11) default null,
|
||||
@ -1419,4 +1420,83 @@ select if(@a=@b,"ok","wrong");
|
||||
if(@a=@b,"ok","wrong")
|
||||
ok
|
||||
drop table t1;
|
||||
SET SESSION AUTOCOMMIT = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
# Switch to connection con1
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256))
|
||||
ENGINE = InnoDB;
|
||||
INSERT INTO t1 VALUES (1,2);
|
||||
BEGIN;
|
||||
UPDATE t1 SET b = 12 WHERE a = 1;
|
||||
affected rows: 1
|
||||
info: Rows matched: 1 Changed: 1 Warnings: 0
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 12
|
||||
# Switch to connection con2
|
||||
UPDATE t1 SET b = 21 WHERE a = 1;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
# Switch to connection con1
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 12
|
||||
ROLLBACK;
|
||||
# 2. test for serialized update:
|
||||
CREATE TABLE t2 (a INT);
|
||||
TRUNCATE t1;
|
||||
INSERT INTO t1 VALUES (1,'init');
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
|
||||
INSERT INTO t2 VALUES ();
|
||||
END|
|
||||
BEGIN;
|
||||
UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1;
|
||||
affected rows: 1
|
||||
info: Rows matched: 1 Changed: 1 Warnings: 0
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 init+con1
|
||||
# Switch to connection con2
|
||||
CALL p1;;
|
||||
# Switch to connection con1
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 init+con1
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 init+con1
|
||||
# Switch to connection con2
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 init+con1+con2
|
||||
# Switch to connection con1
|
||||
# 3. test for updated key column:
|
||||
TRUNCATE t1;
|
||||
TRUNCATE t2;
|
||||
INSERT INTO t1 VALUES (1,'init');
|
||||
BEGIN;
|
||||
UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1;
|
||||
affected rows: 1
|
||||
info: Rows matched: 1 Changed: 1 Warnings: 0
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
2 init+con1
|
||||
# Switch to connection con2
|
||||
CALL p1;;
|
||||
# Switch to connection con1
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
2 init+con1
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
2 init+con1
|
||||
# Switch to connection con2
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
2 init+con1
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.1 tests
|
||||
|
Reference in New Issue
Block a user