-
2025.01.20 get_lock, user level lockTIL 2025. 1. 20. 23:16
MySQL :: MySQL 8.4 Reference Manual :: 14.14 Locking Functions
This section describes functions used to manipulate user-level locks. Table 14.19 Locking Functions GET_LOCK(str,timeout) Tries to obtain a lock with a name given by the string str, using a timeout of timeout seconds. A negative timeout value means infin
dev.mysql.com
user level의 lock의 구현은 mata data table로 구현된다고 한다.
같은 이름으로 여러번 get_lock을 할 수는 있지만 ref의 count만 증가되고 table에 써지는 것은 아니다.
https://github.com/MariaDB/server/blob/11a6c1b30a12c448ddfe05e1b818a6a228e90e43/sql/item_func.cc#L4256 https://github.com/MariaDB/server/blob/11a6c1b30a12c448ddfe05e1b818a6a228e90e43/mysys/hash.c#L272 my_hash_search를 따라가면 hash->array을 통해 버킷을 화인하며 찾는다.
ull_hash는 user_level_lock이 부여되면서 hash table에 값이 들어가는 구조인 것으로 보인다.
동일 key는 ref의 count를 증가시키기만하고
'TIL' 카테고리의 다른 글
2025.02.11 spring kafka delay (0) 2025.02.11 2025.02.08 (0) 2025.02.08 2025.01.07 mariadb source code (0) 2025.01.07 2024.12.22 galera health check, xk6-sql (0) 2024.12.22 2024.12.04 WAL (0) 2024.12.04