diff options
author | Daniel Black <daniel@mariadb.org> | 2021-03-24 15:41:10 +1100 |
---|---|---|
committer | Daniel Black <daniel@mariadb.org> | 2021-04-08 16:51:36 +1000 |
commit | 058484687aa49326b8a7909499e7a8d1aba02953 (patch) | |
tree | 27d1dbef16c0043cfdf4051d6f4fa2ea1b925eed /mysys/thr_lock.c | |
parent | cf552f5886968fc022122960d3a9274ce9f27819 (diff) | |
download | mariadb-git-058484687aa49326b8a7909499e7a8d1aba02953.tar.gz |
Add TL_FIRST_WRITE in SQL layer for determining R/W
Use < TL_FIRST_WRITE for determining a READ transaction.
Use TL_FIRST_WRITE as the relative operator replacing TL_WRITE_ALLOW_WRITE
as the minimium WRITE lock type.
Diffstat (limited to 'mysys/thr_lock.c')
-rw-r--r-- | mysys/thr_lock.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index 5004428505a..fe9ecbf22f9 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -216,8 +216,8 @@ static int check_lock(struct st_lock_list *list, const char* lock_type, lock_type, where); return 1; } - if ((read_lock && data->type > TL_READ_NO_INSERT) || - (!read_lock && data->type <= TL_READ_NO_INSERT)) + if ((read_lock && data->type >= TL_FIRST_WRITE) || + (!read_lock && data->type < TL_FIRST_WRITE)) { fprintf(stderr, "Warning: Found %s lock in %s queue at %s: %s\n", @@ -765,9 +765,9 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout) DBUG_PRINT("lock",("data:%p thread:%lu lock:%p type: %d", data, (ulong) data->owner->thread_id, lock, (int) lock_type)); - check_locks(lock,(uint) lock_type <= (uint) TL_READ_NO_INSERT ? + check_locks(lock,(uint) lock_type < (uint) TL_FIRST_WRITE ? "enter read_lock" : "enter write_lock", lock_type, 0); - if ((int) lock_type <= (int) TL_READ_NO_INSERT) + if ((int) lock_type < (int) TL_FIRST_WRITE) { /* Request for READ lock */ if (lock->write.data) |