1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-13115: Implement SELECT SKIP LOCKED

Adds an implementation for SELECT ... FOR UPDATE SKIP LOCKED /
SELECT ... LOCK IN SHARED MODE SKIP LOCKED

This is implemented only InnoDB at the moment, not in RockDB yet.

This adds a new hander flag HA_CAN_SKIP_LOCKED than
will be used when the storage engine advertises the flag.

When a storage engine indicates this flag it will get
TL_WRITE_SKIP_LOCKED and TL_READ_SKIP_LOCKED transaction types.

The Lex structure has been updated to store both the FOR UPDATE/LOCK IN
SHARE as well as the SKIP LOCKED so the SHOW CREATE VIEW
implementation is simplier.

"SELECT FOR UPDATE ... SKIP LOCKED" combined with CREATE TABLE AS or
INSERT.. SELECT on the result set is not safe for STATEMENT based
replication. MIXED replication will replicate this as row based events."

Thanks to guidance from Facebook commit
193896c466
This helped verify basic test case, and components that need implementing
(even though every part was implemented differently).

Thanks Marko for guidance on simplier InnoDB implementation.

Reviewers: Marko, Monty
This commit is contained in:
Daniel Black
2021-03-05 17:25:15 +11:00
parent 058484687a
commit 553ef1a78b
28 changed files with 446 additions and 43 deletions

View File

@ -1323,6 +1323,16 @@ let $statement= select f2_temp();
let $cleanup_stmt= delete from t1_temp limit 1;
--source include/check_ftwrl_compatible.inc
--echo # 30.f) SELECT ... FOR UPDATE SKIP LOCKED is incompatible with FTWRL.
let $statement= select count(*) from t1_base for update skip locked;
let $cleanup_stmt1= ;
--source include/check_ftwrl_incompatible.inc
--echo # 30.g) SELECT ... LOCK IN SHARE MODE SKIP LOCKED is compatible with FTWRL.
let $statement= select count(*) from t1_base lock in share mode skip locked;
let $cleanup_stmt= ;
--source include/check_ftwrl_compatible.inc
--echo #
--echo # 31) Compatibility of SET statement with FTWRL depends on its