|
| | lock_core_m (const sm_options &options) |
| |
| | ~lock_core_m () |
| |
| int | collect (vtable_t &, bool names_too) |
| |
| void | assert_empty () const |
| |
| void | dump (std::ostream &o) |
| |
| lil_global_table * | get_lil_global_table () |
| |
| w_error_codes | acquire_lock (RawXct *xct, uint32_t hash, const okvl_mode &mode, bool check, bool wait, bool acquire, int32_t timeout, RawLock **out) |
| | Adds a new lock in the given mode to this queue, waiting until it is granted. More...
|
| |
| w_error_codes | retry_acquire (RawLock **lock, bool check_only, int32_t timeout) |
| |
| void | release_lock (RawLock *lock, lsn_t commit_lsn=lsn_t::null) |
| |
| void | release_duration (bool read_lock_only=false, lsn_t commit_lsn=lsn_t::null) |
| |
| RawXct * | allocate_xct () |
| |
| void | deallocate_xct (RawXct *xct) |
| |
Lock table implementation class.
This is the gut of lock management in Foster B-trees. Most of the implementation has been moved to lock_raw.h/cpp.
Adds a new lock in the given mode to this queue, waiting until it is granted.
- Parameters
-
| [in] | xct | the transaction to own the new lock |
| [in] | hash | precise hash of the resource to lock. |
| [in] | mode | requested lock mode |
| [in] | check | If true, this method doesn't wait at all and also it leaves the inserted lock entry even if it wasn't granted immediately. |
| [in] | wait | if false, this method doesn't actually create a new lock object but just checks if the requested lock mode can be granted or not. |
| [in] | timeout | int maximum length to wait in milliseconds. negative number means forever. If conditional, this parameter is ignored. |
| [out] | out | out pointer to the successfully acquired lock. it returns NULL if we couldn't get the lock except conditional==true case. |
check_only=true can give a false positive in concurrent unlock case, but give no false negative assuming a conflicting lock is not concurrently taken for the key. This assumption holds for our only check_only=true use case, which is the tentative NX lock check before inserting a new key, because we then have an EX latch! Thus, this is a safe and efficient check for B-tree insertion.
conditional locking is the standard way to take a lock in DBMS without leaving latches long time. B-tree first requests a lock without releasing latch (conditional). If it fails, it releases latch and unconditionally lock, which needs re-check of LSN after lock and re-latch. The purpose of this conditional parameter is that we don't want to insert the same lock entry twice when the first conditional locking fails. When conditional==true, we leave the lock entry and return it in out even if it wasn't granted. The caller MUST be responsible to call retry_acquire() after the failed acquire (which returns eCONDLOCKTIMEOUT if it failed) or release the lock. It is anyway released at commit time, but waiting lock entry should be removed before the transaction does anything else.
- Precondition
- out != NULL