|
Zero
0.1.0
|
A lock queue to hold granted and waiting lock requests (lock_queue_entry_t's) for a given lock. More...
#include <lock_bucket.h>
Classes | |
| struct | check_grant_result |
Public Member Functions | |
| lock_queue_t (uint32_t hash) | |
| ~lock_queue_t () | |
| uint32_t | hash () const |
| uint32_t | hit_count () const |
Private Member Functions | |
| void | increase_hit_count () |
| lock_queue_t * | next () |
| void | set_next (lock_queue_t *new_next) |
| const lsn_t & | x_lock_tag () const |
| void | update_x_lock_tag (const lsn_t &new_tag) |
| lock_queue_entry_t * | find_request (const xct_lock_info_t *li) |
| void | append_request (lock_queue_entry_t *myreq) |
| void | detach_request (lock_queue_entry_t *myreq) |
| bool | grant_request (lock_queue_entry_t *myreq, lsn_t &observed) |
| void | check_can_grant (lock_queue_entry_t *myreq, check_grant_result &result) |
| bool | _check_compatible (const okvl_mode &granted_mode, const okvl_mode &requested_mode, lock_queue_entry_t *other_request, bool proceeds_me, lsn_t &observed) |
| void | wakeup_waiters (const okvl_mode &released_requested) |
Static Private Member Functions | |
| static lock_queue_t * | allocate_lock_queue (uint32_t hash) |
| static void | deallocate_lock_queue (lock_queue_t *obj) |
Private Attributes | |
| const uint32_t | _hash |
| precise hash for this lock queue. More... | |
| uint32_t | _hit_counts |
| uint64_t | _release_version |
| Monotonically increasing counter that is incremented when some xct releases some lock in this queue. More... | |
| lock_queue_t * | _next |
| srwlock_t | _requests_latch |
| lsn_t | _x_lock_tag |
| lock_queue_entry_t * | _head |
| lock_queue_entry_t * | _tail |
Friends | |
| class | bucket_t |
| class | lock_core_m |
A lock queue to hold granted and waiting lock requests (lock_queue_entry_t's) for a given lock.
NOTE objects of this class are created via the container of this object (bucket_t) calling allocate_lock_queue / deallocate_lock_queue.
WARNING: lock_queue_t's are currently only deleted at shutdown. There is no mechanism presently to prevent one thread from deleting a lock_queue_t out from under another thread. FIXME?
|
inline |
|
inline |
|
inlineprivate |
|
staticprivate |
Allocate a new queue object. Uses TLS cache in lock_core.cpp.
|
private |
|
private |
Checkif my request can be granted, and also check deadlocks.
|
staticprivate |
Deallocate a new queue object. Uses TLS cache in lock_core.cpp. Shutdown time only.
|
private |
|
private |
|
private |
try getting a lock.
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
Requires read access for the bucket containing us if any's _queue_latch.
|
inlineprivate |
Requires write access for the bucket containing us if any's _queue_latch.
|
inlineprivate |
Requires write access for _request_latch, new_tag may be lsn_t::null.
|
private |
opportunistically wake up waiters. called when some lock is released.
|
inlineprivate |
Requires read access for _request_latch.
|
friend |
|
friend |
|
private |
precise hash for this lock queue.
|
private |
The first entry in this queue or NULL if queue empty; protected by _requests_latch.
|
private |
How popular this lock is (approximately, so, no protection). Intended for background cleanup to save memory, but not currently used. Someday, the queue may be revoked in background cleanup. FIXME
NOTE this is NOT a pin-count that is precisely incremented/decremented to control when deletion could occur.
|
private |
Forms a singly-linked list for other queues in the same bucket as us; protected by the bucket containing us's _queue_latch if any.
|
private |
Monotonically increasing counter that is incremented when some xct releases some lock in this queue.
This is NOT protected by latch because it is used only for quick check to opportunistically prevent false deadlock detection. This counter was previously just a true/false flag (_wait_map_obsolete flag) in waitmap, but turns out that a granular checking prevents false deadlock detections more precisely and efficiently.
|
private |
R/W latch to protect remaining fields as well as our lock_queue_entry_t's fields.
|
private |
The last entry in this queue or NULL if queue empty; protected by _requests_latch.
|
private |
Stores the commit timestamp of the latest transaction that released an X lock on this queue; holds lsn_t::null if no such transaction exists; protected by _requests_latch.
1.8.12