← Back to team overview

maria-developers team mailing list archive

FOR UPDATE behavior change in 10.3-MDEV-11953

 

Hi Sanja, and Igor,


(resending with Igor on CC)


I noticed a FOR UPDATE behavior change in 10.3-MDEV-11953

In 10.3 I run this script in a client session:

CREATE OR REPLACE TABLE t1 (a INT NOT NULL PRIMARY KEY);
CREATE OR REPLACE TABLE t2 (a INT NOT NULL PRIMARY KEY);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
BEGIN;
SELECT * FROM t1 UNION SELECT * FROM t2 FOR UPDATE;

Notice no COMMIT yet! It returns this result:
+---+
| a |
+---+
| 1 |
| 2 |
+---+

Now I open a new console, start a new client session and run this script:

BEGIN;
SELECT * FROM t2 FOR UPDATE;

The second session gets locked, as expected.

Now I return to the first console and run "COMMIT;".
The second console gets unlocked and returns
+---+
| a |
+---+
| 2 |
+---+


Now if I do the same in 10.3-MDEV-11953, the second session does not get
locked, it returns the result immediately, even before I typed "COMMIT;"
in the first session.


Note, if in 10.3-MDEV-11953 I start a transaction with a simpler query
(without UNION) in the first session:

BEGIN;
SELECT * FROM t2 FOR UPDATE;

and run the same script in the second session

BEGIN;
SELECT * FROM t2 FOR UPDATE;

then the second session gets locked as expected.


Is this behavior change expected?


Thanks!


Follow ups