MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lock0lock.cc File Reference
#include "lock0lock.h"
#include "lock0priv.h"
#include "ha_prototypes.h"
#include "usr0sess.h"
#include "trx0purge.h"
#include "dict0mem.h"
#include "dict0boot.h"
#include "trx0sys.h"
#include "pars0pars.h"
#include "que0que.h"
#include "row0mysql.h"
#include "row0sel.h"
#include "row0types.h"
#include "srv0mon.h"
#include "ut0vec.h"
#include "btr0btr.h"
#include <set>
Include dependency graph for lock0lock.cc:

Go to the source code of this file.

Classes

struct  lock_deadlock_ctx_t
struct  lock_stack_t

Macros

#define LOCK_MODULE_IMPLEMENTATION
#define LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK   1000000
#define LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK   200
#define LOCK_RELEASE_INTERVAL   1000
#define LOCK_PAGE_BITMAP_MARGIN   64
#define LOCK_STACK_SIZE   OS_THREAD_MAX_N
#define lock_deadlock_too_deep(c)
#define IS_LOCK_S_OR_X(lock)

Enumerations

enum  lock_rec_req_status { LOCK_REC_FAIL, LOCK_REC_SUCCESS, LOCK_REC_SUCCESS_CREATED }

Functions

UNIV_INLINE ibool lock_rec_get_nth_bit (const lock_t *lock, ulint i)
UNIV_INTERN void lock_report_trx_id_insanity (trx_id_t trx_id, const rec_t *rec, dict_index_t *index, const ulint *offsets, trx_id_t max_trx_id)
 ut_ad (rec_offs_validate(rec, index, offsets))
 if (UNIV_UNLIKELY(!is_ok))
 return (is_ok)
UNIV_INTERN bool lock_clust_rec_cons_read_sees (const rec_t *rec, dict_index_t *index, const ulint *offsets, read_view_t *view)
UNIV_INTERN bool lock_sec_rec_cons_read_sees (const rec_t *rec, const read_view_t *view)
UNIV_INTERN void lock_sys_create (ulint n_cells)
UNIV_INTERN void lock_sys_close (void)
UNIV_INTERN ulint lock_get_size (void)
UNIV_INLINE enum lock_mode lock_get_mode (const lock_t *lock)
UNIV_INLINE ulint lock_get_wait (const lock_t *lock)
UNIV_INTERN dict_table_tlock_get_src_table (trx_t *trx, dict_table_t *dest, enum lock_mode *mode)
UNIV_INTERN ibool lock_is_table_exclusive (const dict_table_t *table, const trx_t *trx)
UNIV_INLINE void lock_set_lock_and_trx_wait (lock_t *lock, trx_t *trx)
UNIV_INLINE void lock_reset_lock_and_trx_wait (lock_t *lock)
UNIV_INLINE ulint lock_rec_get_gap (const lock_t *lock)
UNIV_INLINE ulint lock_rec_get_rec_not_gap (const lock_t *lock)
UNIV_INLINE ulint lock_rec_get_insert_intention (const lock_t *lock)
UNIV_INLINE ulint lock_mode_stronger_or_eq (enum lock_mode mode1, enum lock_mode mode2)
UNIV_INLINE ulint lock_mode_compatible (enum lock_mode mode1, enum lock_mode mode2)
UNIV_INLINE ibool lock_rec_has_to_wait (const trx_t *trx, ulint type_mode, const lock_t *lock2, ibool lock_is_on_supremum)
UNIV_INTERN ibool lock_has_to_wait (const lock_t *lock1, const lock_t *lock2)
UNIV_INLINE ulint lock_rec_get_n_bits (const lock_t *lock)
UNIV_INLINE void lock_rec_set_nth_bit (lock_t *lock, ulint i)
UNIV_INTERN ulint lock_rec_find_set_bit (const lock_t *lock)
UNIV_INLINE void lock_rec_reset_nth_bit (lock_t *lock, ulint i)
UNIV_INLINE const lock_tlock_rec_get_next_on_page_const (const lock_t *lock)
UNIV_INLINE lock_tlock_rec_get_next_on_page (lock_t *lock)
UNIV_INLINE lock_tlock_rec_get_first_on_page_addr (ulint space, ulint page_no)
UNIV_INTERN lock_tlock_rec_expl_exist_on_page (ulint space, ulint page_no)
UNIV_INLINE lock_tlock_rec_get_first_on_page (const buf_block_t *block)
UNIV_INLINE lock_tlock_rec_get_next (ulint heap_no, lock_t *lock)
UNIV_INLINE const lock_tlock_rec_get_next_const (ulint heap_no, const lock_t *lock)
UNIV_INLINE lock_tlock_rec_get_first (const buf_block_t *block, ulint heap_no)
UNIV_INTERN const lock_tlock_rec_get_prev (const lock_t *in_lock, ulint heap_no)
UNIV_INLINE const lock_tlock_table_has (const trx_t *trx, const dict_table_t *table, enum lock_mode mode)
UNIV_INLINE lock_tlock_rec_has_expl (ulint precise_mode, const buf_block_t *block, ulint heap_no, const trx_t *trx)
UNIV_INLINE lock_tlock_rec_find_similar_on_page (ulint type_mode, ulint heap_no, lock_t *lock, const trx_t *trx)
UNIV_INTERN ulint lock_number_of_rows_locked (const trx_lock_t *trx_lock)
UNIV_INLINE enum
lock_rec_req_status 
lock_rec_lock_fast (ibool impl, ulint mode, const buf_block_t *block, ulint heap_no, dict_index_t *index, que_thr_t *thr)
UNIV_INTERN void lock_move_reorganize_page (const buf_block_t *block, const buf_block_t *oblock)
UNIV_INTERN void lock_move_rec_list_end (const buf_block_t *new_block, const buf_block_t *block, const rec_t *rec)
UNIV_INTERN void lock_move_rec_list_start (const buf_block_t *new_block, const buf_block_t *block, const rec_t *rec, const rec_t *old_end)
UNIV_INTERN void lock_update_split_right (const buf_block_t *right_block, const buf_block_t *left_block)
UNIV_INTERN void lock_update_merge_right (const buf_block_t *right_block, const rec_t *orig_succ, const buf_block_t *left_block)
UNIV_INTERN void lock_update_root_raise (const buf_block_t *block, const buf_block_t *root)
UNIV_INTERN void lock_update_copy_and_discard (const buf_block_t *new_block, const buf_block_t *block)
UNIV_INTERN void lock_update_split_left (const buf_block_t *right_block, const buf_block_t *left_block)
UNIV_INTERN void lock_update_merge_left (const buf_block_t *left_block, const rec_t *orig_pred, const buf_block_t *right_block)
UNIV_INTERN void lock_rec_reset_and_inherit_gap_locks (const buf_block_t *heir_block, const buf_block_t *block, ulint heir_heap_no, ulint heap_no)
UNIV_INTERN void lock_update_discard (const buf_block_t *heir_block, ulint heir_heap_no, const buf_block_t *block)
UNIV_INTERN void lock_update_insert (const buf_block_t *block, const rec_t *rec)
UNIV_INTERN void lock_update_delete (const buf_block_t *block, const rec_t *rec)
UNIV_INTERN void lock_rec_store_on_page_infimum (const buf_block_t *block, const rec_t *rec)
UNIV_INTERN void lock_rec_restore_from_page_infimum (const buf_block_t *block, const rec_t *rec, const buf_block_t *donator)
UNIV_INLINE void lock_deadlock_start_print ()
UNIV_INLINE void lock_deadlock_fputs (const char *msg)
UNIV_INLINE void lock_deadlock_trx_print (const trx_t *trx, ulint max_query_len)
UNIV_INLINE void lock_deadlock_lock_print (const lock_t *lock)
UNIV_INLINE lock_tlock_table_create (dict_table_t *table, ulint type_mode, trx_t *trx)
UNIV_INLINE void lock_table_pop_autoinc_locks (trx_t *trx)
UNIV_INLINE void lock_table_remove_autoinc_lock (lock_t *lock, trx_t *trx)
UNIV_INLINE void lock_table_remove_low (lock_t *lock)
UNIV_INLINE const lock_tlock_table_other_has_incompatible (const trx_t *trx, ulint wait, const dict_table_t *table, enum lock_mode mode)
UNIV_INTERN dberr_t lock_table (ulint flags, dict_table_t *table, enum lock_mode mode, que_thr_t *thr)
UNIV_INTERN void lock_table_ix_resurrect (dict_table_t *table, trx_t *trx)
UNIV_INTERN void lock_rec_unlock (trx_t *trx, const buf_block_t *block, const rec_t *rec, enum lock_mode lock_mode)
UNIV_INTERN void lock_remove_all_on_table (dict_table_t *table, ibool remove_also_table_sx_locks)
UNIV_INTERN void lock_table_print (FILE *file, const lock_t *lock)
UNIV_INTERN void lock_rec_print (FILE *file, const lock_t *lock)
UNIV_INTERN ibool lock_print_info_summary (FILE *file, ibool nowait)
UNIV_INTERN void lock_print_info_all_transactions (FILE *file)
UNIV_INTERN dberr_t lock_rec_insert_check_and_lock (ulint flags, const rec_t *rec, buf_block_t *block, dict_index_t *index, que_thr_t *thr, mtr_t *mtr, ibool *inherit)
UNIV_INTERN dberr_t lock_clust_rec_modify_check_and_lock (ulint flags, const buf_block_t *block, const rec_t *rec, dict_index_t *index, const ulint *offsets, que_thr_t *thr)
UNIV_INTERN dberr_t lock_sec_rec_modify_check_and_lock (ulint flags, buf_block_t *block, const rec_t *rec, dict_index_t *index, que_thr_t *thr, mtr_t *mtr)
UNIV_INTERN dberr_t lock_sec_rec_read_check_and_lock (ulint flags, const buf_block_t *block, const rec_t *rec, dict_index_t *index, const ulint *offsets, enum lock_mode mode, ulint gap_mode, que_thr_t *thr)
UNIV_INTERN dberr_t lock_clust_rec_read_check_and_lock (ulint flags, const buf_block_t *block, const rec_t *rec, dict_index_t *index, const ulint *offsets, enum lock_mode mode, ulint gap_mode, que_thr_t *thr)
UNIV_INTERN dberr_t lock_clust_rec_read_check_and_lock_alt (ulint flags, const buf_block_t *block, const rec_t *rec, dict_index_t *index, enum lock_mode mode, ulint gap_mode, que_thr_t *thr)
UNIV_INLINE void lock_release_autoinc_last_lock (ib_vector_t *autoinc_locks)
UNIV_INTERN ulint lock_get_type (const lock_t *lock)
UNIV_INTERN trx_id_t lock_get_trx_id (const lock_t *lock)
UNIV_INTERN const char * lock_get_mode_str (const lock_t *lock)
UNIV_INTERN const char * lock_get_type_str (const lock_t *lock)
UNIV_INLINE dict_table_tlock_get_table (const lock_t *lock)
UNIV_INTERN table_id_t lock_get_table_id (const lock_t *lock)
UNIV_INTERN const char * lock_get_table_name (const lock_t *lock)
UNIV_INTERN const dict_index_tlock_rec_get_index (const lock_t *lock)
UNIV_INTERN const char * lock_rec_get_index_name (const lock_t *lock)
UNIV_INTERN ulint lock_rec_get_space_id (const lock_t *lock)
UNIV_INTERN ulint lock_rec_get_page_no (const lock_t *lock)
UNIV_INTERN void lock_cancel_waiting_and_release (lock_t *lock)
UNIV_INTERN void lock_unlock_table_autoinc (trx_t *trx)
UNIV_INTERN void lock_trx_release_locks (trx_t *trx)
UNIV_INTERN dberr_t lock_trx_handle_wait (trx_t *trx)
UNIV_INTERN ulint lock_table_get_n_locks (const dict_table_t *table)
UNIV_INTERN ibool lock_table_has_locks (const dict_table_t *table)

Variables

UNIV_INTERN lock_sys_tlock_sys = NULL
UNIV_INTERN ibool lock_deadlock_found = FALSE
static const rec_t * rec
static const rec_t dict_index_tindex
static const rec_t
dict_index_t const ulint
*offsets bool 
is_ok = trx_id < max_trx_id
trx_id_t max_trx_id = trx_sys_get_max_trx_id()

Detailed Description

The transaction lock system

Created 5/7/1996 Heikki Tuuri

Definition in file lock0lock.cc.

Macro Definition Documentation

#define IS_LOCK_S_OR_X (   lock)
Value:
(lock_get_mode(lock) == LOCK_S \
|| lock_get_mode(lock) == LOCK_X)

Definition at line 4710 of file lock0lock.cc.

#define lock_deadlock_too_deep (   c)
Value:
(c->depth > LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK \
|| c->cost > LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK)

Check if the search is too deep.

Definition at line 3580 of file lock0lock.cc.

Enumeration Type Documentation

Record locking request status

Enumerator:
LOCK_REC_FAIL 

Failed to acquire a lock

LOCK_REC_SUCCESS 

Succeeded in acquiring a lock (implicit or already acquired)

LOCK_REC_SUCCESS_CREATED 

Explicitly created a new lock

Definition at line 2068 of file lock0lock.cc.

Function Documentation

UNIV_INTERN void lock_cancel_waiting_and_release ( lock_t lock)

Cancels a waiting lock request and releases possible other transactions waiting behind it.

Parameters
lockin/out: waiting lock request

Definition at line 6719 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN bool lock_clust_rec_cons_read_sees ( const rec_t *  rec,
dict_index_t index,
const ulint *  offsets,
read_view_t view 
)

Checks that a record is seen in a consistent read.

Returns
true if sees, or false if an earlier version of the record should be retrieved
Parameters
recin: user record which should be read or passed over by a read cursor
indexin: clustered index
offsetsin: rec_get_offsets(rec, index)
viewin: consistent read view

Definition at line 526 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN dberr_t lock_clust_rec_modify_check_and_lock ( ulint  flags,
const buf_block_t block,
const rec_t *  rec,
dict_index_t index,
const ulint *  offsets,
que_thr_t thr 
)

Checks if locks of other transactions prevent an immediate modify (update, delete mark, or delete unmark) of a clustered index record. If they do, first tests if the query thread should anyway be suspended for some reason; if not, then puts the transaction and the query thread to the lock wait state and inserts a waiting request for a record x-lock to the lock queue.

Returns
DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED
Parameters
flagsin: if BTR_NO_LOCKING_FLAG bit is set, does nothing
blockin: buffer block of rec
recin: record which should be modified
indexin: clustered index
offsetsin: rec_get_offsets(rec, index)
thrin: query thread

Definition at line 6099 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN dberr_t lock_clust_rec_read_check_and_lock ( ulint  flags,
const buf_block_t block,
const rec_t *  rec,
dict_index_t index,
const ulint *  offsets,
enum lock_mode  mode,
ulint  gap_mode,
que_thr_t thr 
)

Checks if locks of other transactions prevent an immediate read, or passing over by a read cursor, of a clustered index record. If they do, first tests if the query thread should anyway be suspended for some reason; if not, then puts the transaction and the query thread to the lock wait state and inserts a waiting request for a record lock to the lock queue. Sets the requested mode lock on the record.

Returns
DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED
Parameters
flagsin: if BTR_NO_LOCKING_FLAG bit is set, does nothing
blockin: buffer block of rec
recin: user record or page supremum record which should be read or passed over by a read cursor
indexin: clustered index
offsetsin: rec_get_offsets(rec, index)
modein: mode of the lock which the read cursor should set on records: LOCK_S or LOCK_X; the latter is possible in SELECT FOR UPDATE
gap_modein: LOCK_ORDINARY, LOCK_GAP, or LOCK_REC_NOT_GAP
thrin: query thread

Definition at line 6320 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN dberr_t lock_clust_rec_read_check_and_lock_alt ( ulint  flags,
const buf_block_t block,
const rec_t *  rec,
dict_index_t index,
enum lock_mode  mode,
ulint  gap_mode,
que_thr_t thr 
)

Checks if locks of other transactions prevent an immediate read, or passing over by a read cursor, of a clustered index record. If they do, first tests if the query thread should anyway be suspended for some reason; if not, then puts the transaction and the query thread to the lock wait state and inserts a waiting request for a record lock to the lock queue. Sets the requested mode lock on the record. This is an alternative version of lock_clust_rec_read_check_and_lock() that does not require the parameter "offsets".

Returns
DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED
Parameters
flagsin: if BTR_NO_LOCKING_FLAG bit is set, does nothing
blockin: buffer block of rec
recin: user record or page supremum record which should be read or passed over by a read cursor
indexin: clustered index
modein: mode of the lock which the read cursor should set on records: LOCK_S or LOCK_X; the latter is possible in SELECT FOR UPDATE
gap_modein: LOCK_ORDINARY, LOCK_GAP, or LOCK_REC_NOT_GAP
thrin: query thread

Definition at line 6392 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INLINE void lock_deadlock_fputs ( const char *  msg)

Print a message to the deadlock file and possibly to stderr.

Parameters
msgin: message to print

Definition at line 3507 of file lock0lock.cc.

UNIV_INLINE void lock_deadlock_lock_print ( const lock_t lock)

Print lock data to the deadlock file and possibly to stderr.

Parameters
lockin: record or table type lock

Definition at line 3554 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INLINE void lock_deadlock_start_print ( )

rewind(3) the file used for storing the latest detected deadlock and print a heading message to stderr if printing of all deadlocks to stderr is enabled.

Definition at line 3486 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INLINE void lock_deadlock_trx_print ( const trx_t trx,
ulint  max_query_len 
)

Print transaction data to the deadlock file and possibly to stderr.

Parameters
trxin: transaction
max_query_lenin: max query length to print, or 0 to use the default max length

Definition at line 3524 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INLINE enum lock_mode lock_get_mode ( const lock_t lock)

Gets the mode of a lock.

Returns
mode
Parameters
lockin: lock

Definition at line 664 of file lock0lock.cc.

Here is the caller graph for this function:

UNIV_INTERN const char* lock_get_mode_str ( const lock_t lock)

Gets the mode of a lock in a human readable string. The string should not be free()'d or modified.

Returns
lock mode
Parameters
lockin: lock

Definition at line 6537 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN ulint lock_get_size ( void  )

Gets the size of a lock struct.

Returns
size in bytes

Definition at line 653 of file lock0lock.cc.

Here is the caller graph for this function:

UNIV_INTERN dict_table_t* lock_get_src_table ( trx_t trx,
dict_table_t dest,
enum lock_mode *  mode 
)

Gets the source table of an ALTER TABLE transaction. The table must be covered by an IX or IS table lock.

Returns
the source table of transaction, if it is covered by an IX or IS table lock; dest if there is no source table, and NULL if the transaction is locking more than two tables or an inconsistency is found
Parameters
trxin: transaction
destin: destination of ALTER TABLE
modeout: lock mode of the source table

Definition at line 696 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE dict_table_t* lock_get_table ( const lock_t lock)

Gets the table on which the lock is.

Returns
table
Parameters
lockin: lock

Definition at line 6603 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN table_id_t lock_get_table_id ( const lock_t lock)

Gets the id of the table on which the lock is.

Returns
id of the table
Parameters
lockin: lock

Definition at line 6625 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN const char* lock_get_table_name ( const lock_t lock)

Gets the name of the table on which the lock is. The string should not be free()'d or modified.

Returns
name of the table
Parameters
lockin: lock

Definition at line 6642 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN trx_id_t lock_get_trx_id ( const lock_t lock)

Gets the id of the transaction owning a lock.

Returns
transaction id
Parameters
lockin: lock

Definition at line 6524 of file lock0lock.cc.

UNIV_INTERN ulint lock_get_type ( const lock_t lock)

Gets the type of a lock. Non-inline version for using outside of the lock module.

Returns
LOCK_TABLE or LOCK_REC
Parameters
lockin: lock

Definition at line 6512 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN const char* lock_get_type_str ( const lock_t lock)

Gets the type of a lock in a human readable string. The string should not be free()'d or modified.

Returns
lock type
Parameters
lockin: lock

Definition at line 6584 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INLINE ulint lock_get_wait ( const lock_t lock)

Gets the wait flag of a lock.

Returns
LOCK_WAIT if waiting, 0 if not
Parameters
lockin: lock

Definition at line 678 of file lock0lock.cc.

Here is the caller graph for this function:

UNIV_INTERN ibool lock_has_to_wait ( const lock_t lock1,
const lock_t lock2 
)

Checks if a lock request lock1 has to wait for request lock2.

Returns
TRUE if lock1 has to wait for lock2 to be removed
Parameters
lock1in: waiting lock
lock2in: another lock; NOTE that it is assumed that this has a lock bit set on the same record as in lock1 if the locks are record locks

Definition at line 1034 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN ibool lock_is_table_exclusive ( const dict_table_t table,
const trx_t trx 
)

Determine if the given table is exclusively "owned" by the given transaction, i.e., transaction holds LOCK_IX and possibly LOCK_AUTO_INC on the table.

Returns
TRUE if table is only locked by trx, with LOCK_IX, and possibly LOCK_AUTO_INC
Parameters
tablein: table
trxin: transaction

Definition at line 779 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE ulint lock_mode_compatible ( enum lock_mode  mode1,
enum lock_mode  mode2 
)

Calculates if lock mode 1 is compatible with lock mode 2.

Returns
nonzero if mode1 compatible with mode2
Parameters
mode1in: lock mode
mode2in: lock mode

Definition at line 935 of file lock0lock.cc.

Here is the caller graph for this function:

UNIV_INLINE ulint lock_mode_stronger_or_eq ( enum lock_mode  mode1,
enum lock_mode  mode2 
)

Calculates if lock mode 1 is stronger or equal to lock mode 2.

Returns
nonzero if mode1 stronger or equal to mode2
Parameters
mode1in: lock mode
mode2in: lock mode

Definition at line 919 of file lock0lock.cc.

Here is the caller graph for this function:

UNIV_INTERN void lock_move_rec_list_end ( const buf_block_t new_block,
const buf_block_t block,
const rec_t *  rec 
)

Moves the explicit locks on user records to another page if a record list end is moved to another page.

Parameters
new_blockin: index page to move to
blockin: index page
recin: record on page: this is the first record moved

Definition at line 2886 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void lock_move_rec_list_start ( const buf_block_t new_block,
const buf_block_t block,
const rec_t *  rec,
const rec_t *  old_end 
)

Moves the explicit locks on user records to another page if a record list start is moved to another page.

Parameters
new_blockin: index page to move to
blockin: index page
recin: record on page: this is the first record NOT copied
old_endin: old previous-to-last record on new_page before the records were copied

Definition at line 2975 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void lock_move_reorganize_page ( const buf_block_t block,
const buf_block_t oblock 
)

Updates the lock table when we have reorganized a page. NOTE: we copy also the locks set on the infimum of the page; the infimum may carry locks if an update of a record is occurring on the page, and its locks were temporarily stored on the infimum.

Parameters
blockin: old index page, now reorganized
oblockin: copy of the old, not reorganized page

Definition at line 2740 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN ulint lock_number_of_rows_locked ( const trx_lock_t trx_lock)

Return approximate number or record locks (bits set in the bitmap) for this transaction. Since delete-marked records may be removed, the record count will not be precise. The caller must be holding lock_sys->mutex.

Parameters
trx_lockin: transaction locks

Definition at line 1698 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN void lock_print_info_all_transactions ( FILE *  file)

Prints info of locks for each transaction. This function assumes that the caller holds the lock mutex and more importantly it will release the lock mutex on behalf of the caller. (This should be fixed in the future).

Parameters
filein: file where to print

Definition at line 5223 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN ibool lock_print_info_summary ( FILE *  file,
ibool  nowait 
)

Prints info of locks for all transactions.

Returns
FALSE if not able to obtain lock mutex and exits without printing info
Parameters
filein: file where to print
nowaitin: whether to wait for the lock mutex

Definition at line 5137 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN lock_t* lock_rec_expl_exist_on_page ( ulint  space,
ulint  page_no 
)

Determines if there are explicit record locks on a page.

Returns
an explicit record lock on the page, or NULL if there are none
Parameters
spacein: space id
page_noin: page number

Definition at line 1232 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN ulint lock_rec_find_set_bit ( const lock_t lock)

Looks for a set bit in a record lock bitmap. Returns ULINT_UNDEFINED, if none found.

Returns
bit index == heap number of the record, or ULINT_UNDEFINED if none found
Parameters
lockin: record lock with at least one bit set

Definition at line 1108 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE lock_t* lock_rec_find_similar_on_page ( ulint  type_mode,
ulint  heap_no,
lock_t lock,
const trx_t trx 
)

Looks for a suitable type record lock struct by the same trx on the same page. This can be used to save space when a new record lock should be set on a page: no new struct is needed, if a suitable old is found.

Returns
lock or NULL
Parameters
type_modein: lock type_mode field
heap_noin: heap number of the record
lockin: lock_rec_get_first_on_page()
trxin: transaction

Definition at line 1613 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INLINE lock_t* lock_rec_get_first ( const buf_block_t block,
ulint  heap_no 
)

Gets the first explicit lock request on a record.

Returns
first lock, NULL if none exists
Parameters
blockin: block containing the record
heap_noin: heap number of the record

Definition at line 1318 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE lock_t* lock_rec_get_first_on_page ( const buf_block_t block)

Gets the first record lock on a page, where the page is identified by a pointer to it.

Returns
first lock, NULL if none exists
Parameters
blockin: buffer block

Definition at line 1252 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE lock_t* lock_rec_get_first_on_page_addr ( ulint  space,
ulint  page_no 
)

Gets the first record lock on a page, where the page is identified by its file address.

Returns
first lock, NULL if none exists
Parameters
spacein: space
page_noin: page number

Definition at line 1202 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE ulint lock_rec_get_gap ( const lock_t lock)

Gets the gap flag of a record lock.

Returns
LOCK_GAP or 0
Parameters
lockin: record lock

Definition at line 874 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN const dict_index_t* lock_rec_get_index ( const lock_t lock)

For a record lock, gets the index on which the lock is.

Returns
index
Parameters
lockin: lock

Definition at line 6658 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN const char* lock_rec_get_index_name ( const lock_t lock)

For a record lock, gets the name of the index on which the lock is. The string should not be free()'d or modified.

Returns
name of the index
Parameters
lockin: lock

Definition at line 6675 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INLINE ulint lock_rec_get_insert_intention ( const lock_t lock)

Gets the waiting insert flag of a record lock.

Returns
LOCK_INSERT_INTENTION or 0
Parameters
lockin: record lock

Definition at line 904 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE ulint lock_rec_get_n_bits ( const lock_t lock)

Gets the number of bits in a record lock bitmap.

Returns
number of bits
Parameters
lockin: record lock

Definition at line 1072 of file lock0lock.cc.

Here is the caller graph for this function:

UNIV_INLINE lock_t* lock_rec_get_next ( ulint  heap_no,
lock_t lock 
)

Gets the next explicit lock request on a record.

Returns
next lock, NULL if none exists or if heap_no == ULINT_UNDEFINED
Parameters
heap_noin: heap number of the record
lockin: lock

Definition at line 1285 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE const lock_t* lock_rec_get_next_const ( ulint  heap_no,
const lock_t lock 
)

Gets the next explicit lock request on a record.

Returns
next lock, NULL if none exists or if heap_no == ULINT_UNDEFINED
Parameters
heap_noin: heap number of the record
lockin: lock

Definition at line 1305 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INLINE lock_t* lock_rec_get_next_on_page ( lock_t lock)

Gets the first or next record lock on a page.

Returns
next lock, NULL if none exists
Parameters
lockin: a record lock

Definition at line 1189 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE const lock_t* lock_rec_get_next_on_page_const ( const lock_t lock)

Gets the first or next record lock on a page.

Returns
next lock, NULL if none exists
Parameters
lockin: a record lock

Definition at line 1153 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE ibool lock_rec_get_nth_bit ( const lock_t lock,
ulint  i 
)

Gets the nth bit of a record lock.

Returns
TRUE if bit set also if i == ULINT_UNDEFINED return FALSE
Parameters
lockin: record lock
iin: index of the bit

Definition at line 442 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN ulint lock_rec_get_page_no ( const lock_t lock)

For a record lock, gets the page number on which the lock is.

Returns
page number
Parameters
lockin: lock

Definition at line 6705 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN const lock_t* lock_rec_get_prev ( const lock_t in_lock,
ulint  heap_no 
)

Gets the previous record lock set on a record.

Returns
previous lock on the same record, NULL if none exists
Parameters
in_lockin: record lock
heap_noin: heap number of the record

Definition at line 1385 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE ulint lock_rec_get_rec_not_gap ( const lock_t lock)

Gets the LOCK_REC_NOT_GAP flag of a record lock.

Returns
LOCK_REC_NOT_GAP or 0
Parameters
lockin: record lock

Definition at line 889 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN ulint lock_rec_get_space_id ( const lock_t lock)

For a record lock, gets the tablespace number on which the lock is.

Returns
tablespace number
Parameters
lockin: lock

Definition at line 6691 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INLINE lock_t* lock_rec_has_expl ( ulint  precise_mode,
const buf_block_t block,
ulint  heap_no,
const trx_t trx 
)

Checks if a transaction has a GRANTED explicit lock on rec stronger or equal to precise_mode.

Returns
lock or NULL
Parameters
precise_modein: LOCK_S or LOCK_X possibly ORed to LOCK_GAP or LOCK_REC_NOT_GAP, for a supremum record we regard this always a gap type request
blockin: buffer block containing the record
heap_noin: heap number of the record
trxin: transaction

Definition at line 1478 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INLINE ibool lock_rec_has_to_wait ( const trx_t trx,
ulint  type_mode,
const lock_t lock2,
ibool  lock_is_on_supremum 
)

Checks if a lock request for a new lock has to wait for request lock2.

Returns
TRUE if new lock has to wait for lock2 to be removed
Parameters
trxin: trx of new lock
type_modein: precise mode of the new lock to set: LOCK_S or LOCK_X, possibly ORed to LOCK_GAP or LOCK_REC_NOT_GAP, LOCK_INSERT_INTENTION
lock2in: another record lock; NOTE that it is assumed that this has a lock bit set on the same record as in the new lock we are setting
lock_is_on_supremumin: TRUE if we are setting the lock on the 'supremum' record of an index page: we know then that the lock request is really for a 'gap' type lock

Definition at line 951 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN dberr_t lock_rec_insert_check_and_lock ( ulint  flags,
const rec_t *  rec,
buf_block_t block,
dict_index_t index,
que_thr_t thr,
mtr_t mtr,
ibool *  inherit 
)

Checks if locks of other transactions prevent an immediate insert of a record. If they do, first tests if the query thread should anyway be suspended for some reason; if not, then puts the transaction and the query thread to the lock wait state and inserts a waiting request for a gap x-lock to the lock queue.

Returns
DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED
Parameters
flagsin: if BTR_NO_LOCKING_FLAG bit is set, does nothing
recin: record after which to insert
blockin/out: buffer block of rec
indexin: index
thrin: query thread
mtrin/out: mini-transaction
inheritout: set to TRUE if the new inserted record maybe should inherit LOCK_GAP type locks from the successor record

Definition at line 5881 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INLINE enum lock_rec_req_status lock_rec_lock_fast ( ibool  impl,
ulint  mode,
const buf_block_t block,
ulint  heap_no,
dict_index_t index,
que_thr_t thr 
)

This is a fast routine for locking a record in the most common cases: there are no explicit locks on the page, or there is just one lock, owned by this transaction, and of the right type_mode. This is a low-level function which does NOT look at implicit locks! Checks lock compatibility within explicit locks. This function sets a normal next-key lock, or in the case of a page supremum record, a gap type lock.

Returns
whether the locking succeeded
Parameters
implin: if TRUE, no lock is set if no wait is necessary: we assume that the caller will set an implicit lock
modein: lock mode: LOCK_X or LOCK_S possibly ORed to either LOCK_GAP or LOCK_REC_NOT_GAP
blockin: buffer block containing the record
heap_noin: heap number of record
indexin: index of record
thrin: query thread

Definition at line 2087 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN void lock_rec_print ( FILE *  file,
const lock_t lock 
)

Prints info of a record lock.

Parameters
filein: file where to print
lockin: record type lock

Definition at line 5005 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void lock_rec_reset_and_inherit_gap_locks ( const buf_block_t heir_block,
const buf_block_t block,
ulint  heir_heap_no,
ulint  heap_no 
)

Resets the original locks on heir and replaces them with gap type locks inherited from rec.

Parameters
heir_blockin: block containing the record which inherits
blockin: block containing the record from which inherited; does NOT reset the locks on this record
heir_heap_noin: heap_no of the inheriting record
heap_noin: heap_no of the donating record

Definition at line 3268 of file lock0lock.cc.

UNIV_INLINE void lock_rec_reset_nth_bit ( lock_t lock,
ulint  i 
)

Resets the nth bit of a record lock.

Parameters
lockin: record lock
iin: index of the bit which must be set to TRUE when this function is called

Definition at line 1129 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void lock_rec_restore_from_page_infimum ( const buf_block_t block,
const rec_t *  rec,
const buf_block_t donator 
)

Restores the state of explicit lock requests on a single record, where the state was stored on the infimum of the page.

Parameters
blockin: buffer block containing rec
recin: record whose lock state is restored
donatorin: page (rec is not necessarily on this page) whose infimum stored the lock state; lock bits are reset on the infimum

Definition at line 3458 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INLINE void lock_rec_set_nth_bit ( lock_t lock,
ulint  i 
)

Sets the nth bit of a record lock to TRUE.

Parameters
lockin: record lock
iin: index of the bit

Definition at line 1083 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void lock_rec_store_on_page_infimum ( const buf_block_t block,
const rec_t *  rec 
)

Stores on the page infimum record the explicit locks of another record. This function is used to store the lock state of a record when it is updated and the size of the record changes in the update. The record is moved in such an update, perhaps to another page. The infimum record acts as a dummy carrier record, taking care of lock releases while the actual record is being moved.

Parameters
blockin: buffer block containing rec
recin: record whose lock state is stored on the infimum record of the same page; lock bits are reset on the record

Definition at line 3433 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN void lock_rec_unlock ( trx_t trx,
const buf_block_t block,
const rec_t *  rec,
enum lock_mode lock_mode   
)

Removes a granted record lock of a transaction from the queue and grants locks to other transactions waiting in the queue if they now are entitled to a lock.

Parameters
trxin/out: transaction that has set a record lock
blockin: buffer block containing rec
recin: record

Definition at line 4541 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE void lock_release_autoinc_last_lock ( ib_vector_t autoinc_locks)

Release the last lock from the transaction's autoinc locks.

Parameters
autoinc_locksin/out: vector of AUTOINC locks

Definition at line 6436 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN void lock_remove_all_on_table ( dict_table_t table,
ibool  remove_also_table_sx_locks 
)

Removes locks on a table to be dropped or truncated. If remove_also_table_sx_locks is TRUE then table-level S and X locks are also removed in addition to other table-level and record-level locks. No lock, that is going to be removed, is allowed to be a wait lock.

Parameters
tablein: table to be dropped or truncated
remove_also_table_sx_locksin: also removes table S and X locks

Definition at line 4891 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void lock_report_trx_id_insanity ( trx_id_t  trx_id,
const rec_t *  rec,
dict_index_t index,
const ulint *  offsets,
trx_id_t  max_trx_id 
)

Reports that a transaction id is insensible, i.e., in the future.

Parameters
trx_idin: trx id
recin: user record
indexin: index
offsetsin: rec_get_offsets(rec, index)
max_trx_idin: trx_sys_get_max_trx_id()

Definition at line 466 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE void lock_reset_lock_and_trx_wait ( lock_t lock)

The back pointer to a waiting lock request in the transaction is set to NULL and the wait bit in lock type_mode is reset.

Parameters
lockin/out: record lock

Definition at line 852 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN bool lock_sec_rec_cons_read_sees ( const rec_t *  rec,
const read_view_t view 
)

Checks that a non-clustered index record is seen in a consistent read.

NOTE that a non-clustered index page contains so little information on its modifications that also in the case false, the present version of rec may be the right, but we must check this from the clustered index record.

Returns
true if certainly sees, or false if an earlier version of the clustered index record might be needed
Parameters
recin: user record which should be read or passed over by a read cursor
viewin: consistent read view

Definition at line 560 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN dberr_t lock_sec_rec_modify_check_and_lock ( ulint  flags,
buf_block_t block,
const rec_t *  rec,
dict_index_t index,
que_thr_t thr,
mtr_t mtr 
)

Checks if locks of other transactions prevent an immediate modify (delete mark or delete unmark) of a secondary index record.

Returns
DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED
Parameters
flagsin: if BTR_NO_LOCKING_FLAG bit is set, does nothing
blockin/out: buffer block of rec
recin: record which should be modified; NOTE: as this is a secondary index, we always have to modify the clustered index record first: see the comment below
indexin: secondary index
thrin: query thread (can be NULL if BTR_NO_LOCKING_FLAG)
mtrin/out: mini-transaction

Definition at line 6157 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN dberr_t lock_sec_rec_read_check_and_lock ( ulint  flags,
const buf_block_t block,
const rec_t *  rec,
dict_index_t index,
const ulint *  offsets,
enum lock_mode  mode,
ulint  gap_mode,
que_thr_t thr 
)

Like lock_clust_rec_read_check_and_lock(), but reads a secondary index record.

Returns
DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED
Parameters
flagsin: if BTR_NO_LOCKING_FLAG bit is set, does nothing
blockin: buffer block of rec
recin: user record or page supremum record which should be read or passed over by a read cursor
indexin: secondary index
offsetsin: rec_get_offsets(rec, index)
modein: mode of the lock which the read cursor should set on records: LOCK_S or LOCK_X; the latter is possible in SELECT FOR UPDATE
gap_modein: LOCK_ORDINARY, LOCK_GAP, or LOCK_REC_NOT_GAP
thrin: query thread

Definition at line 6242 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INLINE void lock_set_lock_and_trx_wait ( lock_t lock,
trx_t trx 
)

Sets the wait flag of a lock and the back pointer in trx to lock.

Parameters
lockin: lock
trxin/out: trx

Definition at line 832 of file lock0lock.cc.

Here is the caller graph for this function:

UNIV_INTERN void lock_sys_close ( void  )

Closes the lock system at database shutdown.

Definition at line 628 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN void lock_sys_create ( ulint  n_cells)

Creates the lock system at database start.

Parameters
n_cellsin: number of slots in lock hash table

Definition at line 589 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN dberr_t lock_table ( ulint  flags,
dict_table_t table,
enum lock_mode  mode,
que_thr_t thr 
)

Locks the specified database table in the mode given. If the lock cannot be granted immediately, the query thread is put to wait.

Returns
DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED
Parameters
flagsin: if BTR_NO_LOCKING_FLAG bit is set, does nothing
tablein/out: database table in dictionary cache
modein: lock mode
thrin: query thread

Definition at line 4372 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INLINE lock_t* lock_table_create ( dict_table_t table,
ulint  type_mode,
trx_t trx 
)

Creates a table lock object and adds it as the last in the lock queue of the table. Does NOT check for deadlocks or lock compatibility.

Returns
own: new lock object
Parameters
tablein/out: database table in dictionary cache
type_modein: lock mode possibly ORed with LOCK_WAIT
trxin: trx

Definition at line 4040 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN ulint lock_table_get_n_locks ( const dict_table_t table)

Get the number of locks on a table.

Returns
number of locks
Parameters
tablein: table

Definition at line 6897 of file lock0lock.cc.

UNIV_INLINE const lock_t* lock_table_has ( const trx_t trx,
const dict_table_t table,
enum lock_mode  mode 
)

Checks if a transaction has the specified table lock, or stronger. This function should only be called by the thread that owns the transaction.

Returns
lock or NULL
Parameters
trxin: transaction
tablein: table
modein: lock mode

Definition at line 1427 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN ibool lock_table_has_locks ( const dict_table_t table)

Check if there are any locks (table or rec) against table.

Returns
TRUE if table has either table or record locks.
Parameters
tablein: check if there are any locks held on records in this table or on the table itself

Definition at line 6971 of file lock0lock.cc.

Here is the caller graph for this function:

UNIV_INTERN void lock_table_ix_resurrect ( dict_table_t table,
trx_t trx 
)

Creates a table IX lock object for a resurrected transaction.

Parameters
tablein/out: table
trxin/out: transaction

Definition at line 4440 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INLINE const lock_t* lock_table_other_has_incompatible ( const trx_t trx,
ulint  wait,
const dict_table_t table,
enum lock_mode  mode 
)

Checks if other transactions have an incompatible mode lock request in the lock queue.

Returns
lock or NULL
Parameters
trxin: transaction, or NULL if all transactions should be included
waitin: LOCK_WAIT if also waiting locks are taken into account, or 0 if not
tablein: table
modein: lock mode

Definition at line 4337 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE void lock_table_pop_autoinc_locks ( trx_t trx)

Pops autoinc lock requests from the transaction's autoinc_locks. We handle the case where there are gaps in the array and they need to be popped off the stack.

Parameters
trxin/out: transaction that owns the AUTOINC locks

Definition at line 4107 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void lock_table_print ( FILE *  file,
const lock_t lock 
)

Prints info of a table lock.

Parameters
filein: file where to print
lockin: table type lock

Definition at line 4966 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE void lock_table_remove_autoinc_lock ( lock_t lock,
trx_t trx 
)

Removes an autoinc lock request from the transaction's autoinc_locks.

Parameters
lockin: table lock
trxin/out: transaction that owns the lock

Definition at line 4131 of file lock0lock.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE void lock_table_remove_low ( lock_t lock)

Removes a table lock request from the queue and the trx list of locks; this is a low-level function which does NOT check if waiting requests can now be granted.

Parameters
lockin/out: table lock

Definition at line 4184 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN dberr_t lock_trx_handle_wait ( trx_t trx)

Check whether the transaction has already been rolled back because it was selected as a deadlock victim, or if it has to wait then cancel the wait lock.

Returns
DB_DEADLOCK, DB_LOCK_WAIT or DB_SUCCESS
Parameters
trxin/out: trx lock state

Definition at line 6866 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN void lock_trx_release_locks ( trx_t trx)

Releases a transaction's locks, and releases possible other transactions waiting because of these locks. Change the state of the transaction to TRX_STATE_COMMITTED_IN_MEMORY.

Parameters
trxin/out: transaction

Definition at line 6797 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN void lock_unlock_table_autoinc ( trx_t trx)

Unlocks AUTO_INC type locks that were possibly reserved by a trx. This function should be called at the the end of an SQL statement, by the connection thread that owns the transaction (trx->mysql_thd).

Parameters
trxin/out: transaction

Definition at line 6766 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN void lock_update_copy_and_discard ( const buf_block_t new_block,
const buf_block_t block 
)

Updates the lock table when a page is copied to another and the original page is removed from the chain of leaf pages, except if page is the root!

Parameters
new_blockin: index page to which copied
blockin: index page; NOT the root!

Definition at line 3173 of file lock0lock.cc.

UNIV_INTERN void lock_update_delete ( const buf_block_t block,
const rec_t *  rec 
)

Updates the lock table when a record is removed.

Parameters
blockin: buffer block containing rec
recin: the record to be removed

Definition at line 3388 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN void lock_update_discard ( const buf_block_t heir_block,
ulint  heir_heap_no,
const buf_block_t block 
)

Updates the lock table when a page is discarded.

Parameters
heir_blockin: index page which will inherit the locks
heir_heap_noin: heap_no of the record which will inherit the locks
blockin: index page which will be discarded

Definition at line 3294 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN void lock_update_insert ( const buf_block_t block,
const rec_t *  rec 
)

Updates the lock table when a new user record is inserted.

Parameters
blockin: buffer block containing rec
recin: the inserted record

Definition at line 3357 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN void lock_update_merge_left ( const buf_block_t left_block,
const rec_t *  orig_pred,
const buf_block_t right_block 
)

Updates the lock table when a page is merged to the left.

Parameters
left_blockin: left page to which merged
orig_predin: original predecessor of supremum on the left page before merge
right_blockin: merged index page which will be discarded

Definition at line 3218 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN void lock_update_merge_right ( const buf_block_t right_block,
const rec_t *  orig_succ,
const buf_block_t left_block 
)

Updates the lock table when a page is merged to the right.

Parameters
right_blockin: right page to which merged
orig_succin: original successor of infimum on the right page before merge
left_blockin: merged index page which will be discarded

Definition at line 3111 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN void lock_update_root_raise ( const buf_block_t block,
const buf_block_t root 
)

Updates the lock table when the root page is copied to another in btr_root_raise_and_insert. Note that we leave lock structs on the root page, even though they do not make sense on other than leaf pages: the reason is that in a pessimistic update the infimum record of the root page will act as a dummy carrier of the locks of the record to be updated.

Parameters
blockin: index page to which copied
rootin: root page

Definition at line 3153 of file lock0lock.cc.

UNIV_INTERN void lock_update_split_left ( const buf_block_t right_block,
const buf_block_t left_block 
)

Updates the lock table when a page is split to the left.

Parameters
right_blockin: right page
left_blockin: left page

Definition at line 3196 of file lock0lock.cc.

Here is the call graph for this function:

UNIV_INTERN void lock_update_split_right ( const buf_block_t right_block,
const buf_block_t left_block 
)

Updates the lock table when a page is split to the right.

Parameters
right_blockin: right page
left_blockin: left page

Definition at line 3083 of file lock0lock.cc.

Here is the call graph for this function:

Variable Documentation

const rec_t dict_index_t* index

in: index

Definition at line 500 of file lock0lock.cc.

is_ok = trx_id < max_trx_id

< in: rec_get_offsets(rec, index)

Definition at line 500 of file lock0lock.cc.

UNIV_INTERN ibool lock_deadlock_found = FALSE
We store info on the latest deadlock error to this buffer. InnoDB

Monitor will then fetch it and print

Definition at line 418 of file lock0lock.cc.

UNIV_INTERN lock_sys_t* lock_sys = NULL

The lock system

Definition at line 414 of file lock0lock.cc.

const rec_t* rec

< in: trx id in: user record

Definition at line 500 of file lock0lock.cc.