← Back to team overview

maria-developers team mailing list archive

Re: FOR UPDATE behavior change in 10.3-MDEV-11953

 

Hi, Alexander!

I think it's a bug that needs to be fixed.

On Apr 11, Alexander Barkov wrote:
> Hi Sanja, and Igor,
> 
> 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.

Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx


References