summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Black <daniel@mariadb.org>2021-03-05 17:25:15 +1100
committerDaniel Black <daniel@mariadb.org>2021-04-08 16:51:36 +1000
commit553ef1a78ba7ba6961c3c99887d405694a04e91b (patch)
tree930ce270376bbaa0b52fe22576a83afbb1109ff7 /include
parent058484687aa49326b8a7909499e7a8d1aba02953 (diff)
downloadmariadb-git-553ef1a78ba7ba6961c3c99887d405694a04e91b.tar.gz
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 https://github.com/facebook/mysql-5.6/commit/193896c466d43fd905a62a60f1d73fd9c551a6e4 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
Diffstat (limited to 'include')
-rw-r--r--include/thr_lock.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/thr_lock.h b/include/thr_lock.h
index 38dc600951f..d918d6d74f4 100644
--- a/include/thr_lock.h
+++ b/include/thr_lock.h
@@ -47,6 +47,8 @@ enum thr_lock_type { TL_IGNORE=-1,
TL_READ_HIGH_PRIORITY,
/* READ, Don't allow concurrent insert */
TL_READ_NO_INSERT,
+ /* READ, but skip locks if found */
+ TL_READ_SKIP_LOCKED,
/*
Write lock, but allow other threads to read / write.
Used by BDB tables in MySQL to mark that someone is
@@ -67,6 +69,8 @@ enum thr_lock_type { TL_IGNORE=-1,
TL_WRITE_DEFAULT,
/* WRITE lock that has lower priority than TL_READ */
TL_WRITE_LOW_PRIORITY,
+ /* WRITE, but skip locks if found */
+ TL_WRITE_SKIP_LOCKED,
/* Normal WRITE lock */
TL_WRITE,
/* Abort new lock request with an error */