Create record locks.  
 More...
#include <lock0priv.h>
|  | 
|  | RecLock (que_thr_t *thr, dict_index_t *index, const RecID &rec_id, ulint mode) | 
|  | 
|  | RecLock (que_thr_t *thr, dict_index_t *index, const buf_block_t *block, ulint heap_no, ulint mode) | 
|  | 
|  | RecLock (dict_index_t *index, const RecID &rec_id, ulint mode) | 
|  | 
|  | RecLock (dict_index_t *index, const buf_block_t *block, ulint heap_no, ulint mode) | 
|  | 
| dberr_t | add_to_waitq (const lock_t *wait_for, const lock_prdt_t *prdt=nullptr) | 
|  | Enqueue a lock wait for a transaction.  More... 
 | 
|  | 
| lock_t * | create (trx_t *trx, const lock_prdt_t *prdt=nullptr) | 
|  | Create a lock for a transaction and initialise it.  More... 
 | 
|  | 
◆ RecLock() [1/4]
- Parameters
- 
  
    | [in,out] | thr | Transaction query thread requesting the record lock |  | [in] | index | Index on which record lock requested |  | [in] | rec_id | Record lock tuple {space, page_no, heap_no} |  | [in] | mode | The lock mode |  
 
 
 
◆ RecLock() [2/4]
- Parameters
- 
  
    | [in,out] | thr | Transaction query thread requesting the record lock |  | [in] | index | Index on which record lock requested |  | [in] | block | Buffer page containing record |  | [in] | heap_no | Heap number within the block |  | [in] | mode | The lock mode |  
 
 
 
◆ RecLock() [3/4]
- Parameters
- 
  
    | [in] | index | Index on which record lock requested |  | [in] | rec_id | Record lock tuple {space, page_no, heap_no} |  | [in] | mode | The lock mode |  
 
 
 
◆ RecLock() [4/4]
- Parameters
- 
  
    | [in] | index | Index on which record lock requested |  | [in] | block | Buffer page containing record |  | [in] | heap_no | Heap number within block |  | [in] | mode | The lock mode |  
 
 
 
◆ add_to_waitq()
Enqueue a lock wait for a transaction. 
If it is a high priority transaction (cannot rollback) then try to jump ahead in the record lock wait queue. Also check if async rollback was request for our trx. 
- Parameters
- 
  
    | [in,out] | wait_for | The lock that the the joining transaction is waiting for |  | [in] | prdt | Predicate [optional] |  
 
- Returns
- DB_LOCK_WAIT, DB_DEADLOCK, or DB_SUCCESS_LOCKED_REC 
- Return values
- 
  
    | DB_DEADLOCK | means that async rollback was requested for our trx |  | DB_SUCCESS_LOCKED_REC | means that we are High Priority transaction and we've managed to jump in front of other waiting transactions and got the lock granted, so there is no need to wait. |  
 
 
 
◆ create()
Create a lock for a transaction and initialise it. 
- Parameters
- 
  
    | [in,out] | trx | Transaction requesting the new lock |  | [in] | prdt | Predicate lock (optional) |  
 
- Returns
- new lock instance 
 
 
◆ init()
  
  | 
        
          | void RecLock::init | ( | const page_t * | page | ) |  |  | inlineprivate | 
 
Setup the context from the requirements. 
If rec is the supremum record, then we reset the gap and LOCK_REC_NOT_GAP bits, as all locks on the supremum are automatically of the gap type
 
 
◆ is_predicate_lock()
  
  | 
        
          | static bool RecLock::is_predicate_lock | ( | ulint | mode | ) |  |  | inlinestaticprivate | 
 
- Returns
- true if the requested lock mode is for a predicate or page lock 
 
 
◆ lock_add()
  
  | 
        
          | void RecLock::lock_add | ( | lock_t * | lock | ) |  |  | private | 
 
Add the lock to the record lock hash and the transaction's lock list. 
- Parameters
- 
  
    | [in,out] | lock | Newly created record lock to add to the rec hash and the transaction lock list |  
 
 
 
◆ lock_alloc()
Create the lock instance. 
- Parameters
- 
  
    | [in,out] | trx | The transaction requesting the lock |  | [in,out] | index | Index on which record lock is required |  | [in] | mode | The lock mode desired |  | [in] | rec_id | The record id |  | [in] | size | Size of the lock + bitmap requested |  
 
- Returns
- a record lock instance 
 
 
◆ lock_size() [1/3]
  
  | 
        
          | size_t RecLock::lock_size | ( |  | ) | const |  | inlineprivate | 
 
 
◆ lock_size() [2/3]
  
  | 
        
          | static size_t RecLock::lock_size | ( | const page_t * | page | ) |  |  | inlinestaticprivate | 
 
Calculate the record lock physical size required, non-predicate lock. 
- Parameters
- 
  
    | [in] | page | For non-predicate locks the buffer page |  
 
- Returns
- the size of the lock data structure required in bytes 
 
 
◆ lock_size() [3/3]
  
  | 
        
          | static size_t RecLock::lock_size | ( | ulint | mode | ) |  |  | inlinestaticprivate | 
 
Calculate the record lock physical size required for a predicate lock. 
- Parameters
- 
  
    | [in] | mode | For predicate locks the lock mode |  
 
- Returns
- the size of the lock data structure required in bytes 
 
 
◆ prepare()
  
  | 
        
          | void RecLock::prepare | ( |  | ) | const |  | private | 
 
Do some checks and prepare for creating a new record lock. 
 
 
◆ set_wait_state()
  
  | 
        
          | void RecLock::set_wait_state | ( | lock_t * | lock | ) |  |  | private | 
 
Setup the requesting transaction state for lock grant. 
- Parameters
- 
  
    | [in,out] | lock | Lock for which to change state |  
 
 
 
◆ m_index
Index on which the record lock is required. 
 
 
◆ m_mode
◆ m_rec_id
The record lock tuple {space, page_no, heap_no}. 
 
 
◆ m_size
Size of the record lock in bytes. 
 
 
◆ m_thr
The query thread of the transaction. 
 
 
◆ m_trx
Transaction requesting the record lock. 
 
 
The documentation for this class was generated from the following files: