Drizzled Public API Documentation

lock0lock.h File Reference

#include "univ.i"
#include "buf0types.h"
#include "trx0types.h"
#include "mtr0types.h"
#include "rem0types.h"
#include "dict0types.h"
#include "que0types.h"
#include "lock0types.h"
#include "read0types.h"
#include "hash0hash.h"
#include "ut0vec.h"
#include "lock0lock.ic"

Go to the source code of this file.

Classes

struct  lock_op_struct
struct  lock_sys_struct

Defines

#define LOCK_MODE_MASK   0xFUL
#define LOCK_TABLE   16
#define LOCK_REC   32
#define LOCK_TYPE_MASK   0xF0UL
#define LOCK_WAIT   256
#define LOCK_ORDINARY   0
#define LOCK_GAP   512
#define LOCK_REC_NOT_GAP   1024
#define LOCK_INSERT_INTENTION   2048

Typedefs

typedef struct lock_op_struct lock_op_t

Functions

UNIV_INTERN ulint lock_get_size (void)
UNIV_INTERN void lock_sys_create (ulint n_cells)
UNIV_INTERN void lock_sys_close (void)
UNIV_INLINE trx_tlock_clust_rec_some_has_impl (const rec_t *rec, dict_index_t *index, const ulint *offsets)
UNIV_INLINE ulint lock_get_min_heap_no (const buf_block_t *block)
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_INTERN ibool lock_rec_expl_exist_on_page (ulint space, ulint page_no)
UNIV_INTERN ulint 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 ulint 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 ulint 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 enum db_err 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 enum db_err 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 ulint 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_INTERN ibool lock_clust_rec_cons_read_sees (const rec_t *rec, dict_index_t *index, const ulint *offsets, read_view_t *view)
UNIV_INTERN ulint lock_sec_rec_cons_read_sees (const rec_t *rec, const read_view_t *view)
UNIV_INTERN ulint lock_table (ulint flags, dict_table_t *table, enum lock_mode mode, que_thr_t *thr)
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_release_off_kernel (trx_t *trx)
UNIV_INTERN void lock_cancel_waiting_and_release (lock_t *lock)
UNIV_INTERN void lock_remove_all_on_table (dict_table_t *table, ibool remove_also_table_sx_locks)
UNIV_INLINE ulint lock_rec_fold (ulint space, ulint page_no) __attribute__((const ))
UNIV_INLINE ulint lock_rec_hash (ulint space, ulint page_no)
UNIV_INTERN ulint lock_rec_find_set_bit (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 (dict_table_t *table, trx_t *trx)
UNIV_INTERN ibool lock_has_to_wait (const lock_t *lock1, const lock_t *lock2)
UNIV_INTERN ibool lock_check_trx_id_sanity (trx_id_t trx_id, const rec_t *rec, dict_index_t *index, const ulint *offsets, ibool has_kernel_mutex)
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 ulint lock_number_of_rows_locked (const trx_t *trx)
UNIV_INTERN ibool lock_trx_holds_autoinc_locks (const trx_t *trx)
UNIV_INTERN void lock_release_autoinc_locks (trx_t *trx)
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_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)

Variables

FILE * lock_latest_err_file
lock_sys_tlock_sys

Detailed Description

The transaction lock system

Created 5/7/1996 Heikki Tuuri

Definition in file lock0lock.h.


Define Documentation

#define LOCK_GAP   512

when this bit is set, it means that the lock holds only on the gap before the record; for instance, an x-lock on the gap does not give permission to modify the record on which the bit is set; locks of this type are created when records are removed from the index chain of records

Definition at line 777 of file lock0lock.h.

Referenced by row_ins_check_foreign_constraint(), and row_search_for_mysql().

#define LOCK_INSERT_INTENTION   2048

this bit is set when we place a waiting gap type record lock request in order to let an insert of an index record to wait until there are no conflicting locks by other transactions on the gap; note that this flag remains set when the waiting lock is granted, or if the lock is inherited to a neighboring record

Definition at line 792 of file lock0lock.h.

#define LOCK_MODE_MASK   0xFUL

Lock modes and types mask used to extract mode from the type_mode field in a lock

Definition at line 757 of file lock0lock.h.

#define LOCK_ORDINARY   0

this flag denotes an ordinary next-key lock in contrast to LOCK_GAP or LOCK_REC_NOT_GAP

Definition at line 774 of file lock0lock.h.

Referenced by lock_clust_rec_read_check_and_lock(), row_ins_check_foreign_constraint(), and row_search_for_mysql().

#define LOCK_REC_NOT_GAP   1024

this bit means that the lock is only on the index record and does NOT block inserts to the gap before the index record; this is used in the case when we retrieve a record with a unique key, and is also used in locking plain SELECTs (not part of UPDATE or DELETE) when the user has set the READ COMMITTED isolation level

Definition at line 784 of file lock0lock.h.

Referenced by row_ins_check_foreign_constraint(), and row_search_for_mysql().

#define LOCK_TYPE_MASK   0xF0UL

mask used to extract lock type from the type_mode field in a lock

Definition at line 763 of file lock0lock.h.

#define LOCK_WAIT   256

Waiting lock flag; when set, it means that the lock has not yet been granted, it is just waiting for its turn in the wait queue

Definition at line 769 of file lock0lock.h.


Typedef Documentation

typedef struct lock_op_struct lock_op_t

Lock operation struct

Definition at line 809 of file lock0lock.h.


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. in: waiting lock request

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

Parameters:
lockin: waiting lock request

Definition at line 4056 of file lock0lock.cc.

References lock_cancel_waiting_and_release(), lock_get_type_low(), LOCK_REC, lock_release_autoinc_locks(), LOCK_TABLE, lock_struct::trx, trx_end_lock_wait(), and ut_ad.

Referenced by lock_cancel_waiting_and_release(), row_search_for_mysql(), and srv_lock_timeout_thread().

UNIV_INTERN ibool lock_check_trx_id_sanity ( trx_id_t  trx_id,
const rec_t *  rec,
dict_index_t index,
const ulint *  offsets,
ibool  has_kernel_mutex 
)

Checks that a transaction id is sensible, i.e., not in the future.

Returns:
TRUE if ok in: TRUE if the caller owns the kernel mutex

Checks that a transaction id is sensible, i.e., not in the future.

Returns:
TRUE if ok
Parameters:
trx_idin: trx id
recin: user record
indexin: index
offsetsin: rec_get_offsets(rec, index)
has_kernel_mutexin: TRUE if the caller owns the kernel mutex

Definition at line 449 of file lock0lock.cc.

References lock_check_trx_id_sanity(), trx_sys_struct::max_trx_id, rec_offs_validate(), rec_print_new(), TRX_ID_FMT, trx_sys, ut_ad, and ut_print_timestamp().

Referenced by lock_check_trx_id_sanity(), and row_vers_impl_x_locked_off_kernel().

UNIV_INTERN ibool 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 in: consistent read 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 500 of file lock0lock.cc.

References dict_index_is_clust(), lock_clust_rec_cons_read_sees(), page_rec_is_user_rec(), read_view_sees_trx_id(), rec_offs_validate(), row_get_rec_trx_id(), and ut_ad.

Referenced by lock_clust_rec_cons_read_sees(), and row_search_for_mysql().

UNIV_INTERN ulint 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 in: query thread

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 5156 of file lock0lock.cc.

References DB_SUCCESS_LOCKED_REC, dict_index_is_clust(), buf_block_struct::frame, lock_clust_rec_modify_check_and_lock(), page_align(), rec_get_heap_no_new(), rec_get_heap_no_old(), rec_offs_comp(), rec_offs_validate(), dict_index_struct::table, thr_get_trx(), and ut_ad.

Referenced by btr_cur_del_mark_set_clust_rec(), and lock_clust_rec_modify_check_and_lock().

UNIV_INTERN enum db_err 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 in: query thread

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 5369 of file lock0lock.cc.

References dict_index_is_clust(), buf_block_struct::frame, lock_clust_rec_read_check_and_lock(), LOCK_ORDINARY, page_align(), page_rec_get_heap_no(), page_rec_is_supremum(), page_rec_is_user_rec(), rec_offs_validate(), dict_index_struct::table, thr_get_trx(), and ut_ad.

Referenced by lock_clust_rec_read_check_and_lock(), and lock_clust_rec_read_check_and_lock_alt().

UNIV_INTERN ulint 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 in: query thread

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 5439 of file lock0lock.cc.

References DB_SUCCESS_LOCKED_REC, lock_clust_rec_read_check_and_lock(), lock_clust_rec_read_check_and_lock_alt(), and mem_heap_free.

Referenced by lock_clust_rec_read_check_and_lock_alt().

UNIV_INLINE trx_t* lock_clust_rec_some_has_impl ( const rec_t *  rec,
dict_index_t index,
const ulint *  offsets 
)

Checks if some transaction has an implicit x-lock on a record in a clustered index.

Returns:
transaction which has the x-lock, or NULL in: rec_get_offsets(rec, index)
Parameters:
recin: user record
indexin: clustered index
UNIV_INLINE ulint lock_get_min_heap_no ( const buf_block_t block)

Gets the heap_no of the smallest user record on a page.

Returns:
heap_no of smallest user record, or PAGE_HEAP_NO_SUPREMUM in: buffer block

Referenced by btr_discard_page(), lock_update_split_left(), and lock_update_split_right().

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 in: 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 5578 of file lock0lock.cc.

References lock_get_mode_str(), lock_get_type_low(), and LOCK_REC.

Referenced by lock_get_mode_str().

UNIV_INTERN ulint lock_get_size ( void  )

Gets the size of a lock struct.

Returns:
size in bytes

Definition at line 601 of file lock0lock.cc.

References lock_get_size().

Referenced by dict_mem_table_create(), and lock_get_size().

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 out: lock mode of the source table

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 649 of file lock0lock.cc.

References lock_get_src_table(), lock_get_type_low(), LOCK_TABLE, dict_table_struct::locks, lock_struct::tab_lock, lock_table_struct::table, trx_struct::trx_locks, lock_struct::un_member, UT_LIST_GET_FIRST, UT_LIST_GET_LEN, and UT_LIST_GET_NEXT.

Referenced by ha_innobase::doInsertRecord(), and lock_get_src_table().

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 in: lock

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

Returns:
id of the table
Parameters:
lockin: lock

Definition at line 5664 of file lock0lock.cc.

References dict_table_struct::id, and lock_get_table_id().

Referenced by lock_get_table_id().

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 in: 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 5681 of file lock0lock.cc.

References lock_get_table_name(), and dict_table_struct::name.

Referenced by lock_get_table_name().

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 in: lock

Gets the id of the transaction owning a lock.

Returns:
transaction id
Parameters:
lockin: lock

Definition at line 5565 of file lock0lock.cc.

References trx_struct::id, lock_get_trx_id(), and lock_struct::trx.

Referenced by lock_get_trx_id().

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 in: 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 5553 of file lock0lock.cc.

References lock_get_type(), and lock_get_type_low().

Referenced by lock_get_type(), and lock_remove_all_on_table().

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 in: 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 5625 of file lock0lock.cc.

References lock_get_type_low(), lock_get_type_str(), LOCK_REC, and LOCK_TABLE.

Referenced by lock_get_type_str().

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 in: 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

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 983 of file lock0lock.cc.

References lock_get_type_low(), lock_has_to_wait(), LOCK_REC, lock_struct::trx, lock_struct::type_mode, and ut_ad.

Referenced by lock_has_to_wait().

UNIV_INTERN ibool lock_is_table_exclusive ( dict_table_t table,
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 in: transaction

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 717 of file lock0lock.cc.

References lock_get_type_low(), lock_is_table_exclusive(), LOCK_TABLE, dict_table_struct::locks, lock_struct::tab_lock, lock_struct::trx, lock_struct::un_member, ut_ad, UT_LIST_GET_FIRST, and UT_LIST_GET_NEXT.

Referenced by ha_innobase::doInsertRecord(), and lock_is_table_exclusive().

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. in: record on page: this is the first record moved

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 2656 of file lock0lock.cc.

References buf_block_get_page_no(), buf_block_get_space(), lock_struct::index, lock_move_rec_list_end(), page_cur_is_after_last(), page_cur_is_before_first(), page_cur_move_to_next(), page_cur_position(), page_cur_set_before_first(), page_rec_is_comp(), rec_get_data_size_old(), rec_get_heap_no_new(), rec_get_heap_no_old(), lock_struct::trx, lock_struct::type_mode, and ut_ad.

Referenced by btr_page_split_and_insert(), btr_root_raise_and_insert(), lock_move_rec_list_end(), and page_copy_rec_list_end().

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. in: old previous-to-last record on new_page before the records were copied

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 2747 of file lock0lock.cc.

References buf_block_get_page_no(), buf_block_get_space(), buf_block_struct::frame, lock_struct::index, lock_move_rec_list_start(), page_align(), page_cur_move_to_next(), page_cur_position(), page_cur_set_before_first(), page_rec_is_comp(), page_rec_is_supremum(), rec_get_data_size_old(), rec_get_heap_no_new(), rec_get_heap_no_old(), lock_struct::trx, lock_struct::type_mode, ut_ad, and ut_error.

Referenced by btr_page_split_and_insert(), lock_move_rec_list_start(), and page_copy_rec_list_start().

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. in: copy of the old, not reorganized page

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 2510 of file lock0lock.cc.

References buf_block_get_page_no(), buf_block_get_space(), buf_block_struct::frame, lock_struct::index, lock_move_reorganize_page(), lock_rec_find_set_bit(), mem_heap_create, mem_heap_free, page_cur_move_to_next(), page_cur_set_before_first(), page_is_comp(), rec_get_data_size_old(), rec_get_heap_no_new(), rec_get_heap_no_old(), lock_struct::trx, lock_struct::type_mode, ut_ad, ut_d, ut_error, UT_LIST_ADD_LAST, UT_LIST_BASE_NODE_T(), UT_LIST_GET_FIRST, UT_LIST_GET_NEXT, and UT_LIST_INIT.

Referenced by lock_move_reorganize_page(), and page_zip_reorganize().

UNIV_INTERN ulint lock_number_of_rows_locked ( const trx_t trx)

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. in: transaction

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.

Parameters:
trxin: transaction

Definition at line 1621 of file lock0lock.cc.

References lock_get_type_low(), lock_number_of_rows_locked(), LOCK_REC, trx_struct::trx_locks, UT_LIST_GET_FIRST, and UT_LIST_GET_NEXT.

Referenced by lock_number_of_rows_locked(), and trx_print().

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 kernel mutex and exits without printing info in: whether to wait for the kernel mutex

Prints info of locks for all transactions.

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

Definition at line 4375 of file lock0lock.cc.

References lock_print_info_summary(), trx_sys_struct::max_trx_id, purge_sys, trx_purge_struct::purge_trx_no, trx_purge_struct::purge_undo_no, trx_sys_struct::rseg_history_len, TRX_ID_FMT, trx_sys, and ut_copy_file().

Referenced by lock_print_info_summary(), and srv_printf_innodb_monitor().

UNIV_INTERN ibool lock_rec_expl_exist_on_page ( ulint  space,
ulint  page_no 
)

Returns TRUE if there are explicit record locks on a page.

Returns:
TRUE if there are explicit record locks on the page in: page number

Returns TRUE if there are explicit record locks on a page.

Returns:
TRUE if there are explicit record locks on the page
Parameters:
spacein: space id
page_noin: page number

Definition at line 1168 of file lock0lock.cc.

References lock_rec_expl_exist_on_page().

Referenced by lock_rec_expl_exist_on_page().

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 in: record lock with at least one bit set

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 1057 of file lock0lock.cc.

References lock_rec_find_set_bit().

Referenced by lock_move_reorganize_page(), lock_queue_iterator_reset(), and lock_rec_find_set_bit().

UNIV_INLINE ulint lock_rec_fold ( ulint  space,
ulint  page_no 
) const

Calculates the fold value of a page file address: used in inserting or searching for a lock in the hash table.

Returns:
folded value
Parameters:
spacein: space
page_noin: page number
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 in: lock

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

Returns:
index
Parameters:
lockin: lock

Definition at line 5697 of file lock0lock.cc.

References lock_struct::index, lock_get_type_low(), LOCK_REC, lock_rec_get_index(), and ut_a.

Referenced by lock_rec_get_index().

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 in: 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 5712 of file lock0lock.cc.

References lock_struct::index, lock_get_type_low(), LOCK_REC, lock_rec_get_index_name(), dict_index_struct::name, and ut_a.

Referenced by lock_rec_get_index_name().

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 in: lock

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

Returns:
page number
Parameters:
lockin: lock

Definition at line 5740 of file lock0lock.cc.

References lock_get_type_low(), LOCK_REC, lock_rec_get_page_no(), lock_rec_struct::page_no, lock_struct::rec_lock, lock_struct::un_member, and ut_a.

Referenced by lock_rec_get_page_no().

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 in: lock

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

Returns:
tablespace number
Parameters:
lockin: lock

Definition at line 5726 of file lock0lock.cc.

References lock_get_type_low(), LOCK_REC, lock_rec_get_space_id(), lock_struct::rec_lock, lock_rec_struct::space, lock_struct::un_member, and ut_a.

Referenced by lock_rec_get_space_id().

UNIV_INLINE ulint lock_rec_hash ( ulint  space,
ulint  page_no 
)

Calculates the hash value of a page file address: used in inserting or searching for a lock in the hash table.

Returns:
hashed value in: page number
Parameters:
spacein: space

Referenced by buf_page_get_gen().

UNIV_INTERN ulint 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 out: set to TRUE if the new inserted record maybe should inherit LOCK_GAP type locks from the successor record

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 4983 of file lock0lock.cc.

References buf_block_get_page_zip, DB_SUCCESS_LOCKED_REC, dict_index_is_clust(), buf_block_struct::frame, trx_struct::id, lock_rec_insert_check_and_lock(), mem_heap_free, dict_index_struct::name, page_align(), page_rec_get_heap_no(), page_rec_get_next_const(), page_update_max_trx_id(), dict_index_struct::table, TEMP_INDEX_PREFIX, thr_get_trx(), and ut_ad.

Referenced by lock_rec_insert_check_and_lock().

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

Prints info of a record lock. in: record type lock

Prints info of a record lock.

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

Definition at line 4244 of file lock0lock.cc.

References buf_page_try_get, trx_struct::id, lock_struct::index, lock_get_type_low(), LOCK_REC, lock_rec_print(), mem_heap_free, mtr_commit(), mtr_start(), page_find_rec_with_heap_no(), lock_rec_struct::page_no, lock_struct::rec_lock, rec_print_new(), lock_rec_struct::space, lock_struct::trx, TRX_ID_FMT, lock_struct::un_member, ut_a, ut_ad, and ut_error.

Referenced by lock_print_info_all_transactions(), and lock_rec_print().

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. in: heap_no of the donating record

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 3040 of file lock0lock.cc.

References lock_rec_reset_and_inherit_gap_locks().

Referenced by lock_rec_reset_and_inherit_gap_locks().

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. in: page (rec is not necessarily on this page) whose infimum stored the lock state; lock bits are reset on the infimum

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 3232 of file lock0lock.cc.

References lock_rec_restore_from_page_infimum(), and page_rec_get_heap_no().

Referenced by btr_cur_optimistic_update(), btr_cur_pessimistic_update(), and lock_rec_restore_from_page_infimum().

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 in such an update moved, 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. in: record whose lock state is stored on the infimum record of the same page; lock bits are reset on the record

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 3207 of file lock0lock.cc.

References buf_block_struct::frame, lock_rec_store_on_page_infimum(), page_align(), page_rec_get_heap_no(), and ut_ad.

Referenced by btr_cur_optimistic_update(), btr_cur_pessimistic_update(), and lock_rec_store_on_page_infimum().

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. in: LOCK_S or LOCK_X

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: transaction that has set a record lock
blockin: buffer block containing rec
recin: record

Definition at line 3929 of file lock0lock.cc.

References buf_block_struct::frame, lock_rec_unlock(), page_align(), page_rec_get_heap_no(), lock_struct::trx, ut_a, ut_ad, and ut_print_timestamp().

Referenced by lock_rec_unlock(), and row_unlock_for_mysql().

UNIV_INTERN void lock_release_autoinc_locks ( trx_t trx)

Release all the transaction's autoinc locks. in/out: transaction

Release all the transaction's autoinc locks.

Parameters:
trxin/out: transaction

Definition at line 5525 of file lock0lock.cc.

References ib_vector_is_empty(), lock_release_autoinc_locks(), ut_a, and ut_ad.

Referenced by lock_cancel_waiting_and_release(), lock_release_autoinc_locks(), and row_unlock_table_autoinc_for_mysql().

UNIV_INTERN void lock_release_off_kernel ( trx_t trx)

Releases transaction locks, and releases possible other transactions waiting because of these locks. in: transaction

Releases transaction locks, and releases possible other transactions waiting because of these locks.

Parameters:
trxin: transaction

Definition at line 3992 of file lock0lock.cc.

References ib_vector_size(), lock_get_type_low(), trx_struct::lock_heap, LOCK_REC, lock_release_off_kernel(), LOCK_TABLE, trx_sys_struct::max_trx_id, mem_heap_empty(), dict_table_struct::query_cache_inv_trx_id, lock_struct::tab_lock, lock_table_struct::table, trx_struct::trx_locks, trx_sys, lock_struct::un_member, trx_struct::undo_no, ut_a, ut_ad, and UT_LIST_GET_LAST.

Referenced by lock_release_off_kernel(), and trx_commit_off_kernel().

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. in: also removes table S and X 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 4141 of file lock0lock.cc.

References lock_get_type(), lock_remove_all_on_table(), LOCK_TABLE, dict_table_struct::locks, lock_struct::trx, ut_a, UT_LIST_GET_FIRST, UT_LIST_GET_NEXT, and UT_LIST_GET_PREV.

Referenced by lock_remove_all_on_table(), row_discard_tablespace_for_mysql(), row_drop_table_for_mysql(), and row_truncate_table_for_mysql().

UNIV_INTERN ulint 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 in: consistent read 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 535 of file lock0lock.cc.

References lock_sec_rec_cons_read_sees(), page_align(), page_get_max_trx_id(), page_rec_is_user_rec(), recv_recovery_is_on(), and ut_ad.

Referenced by lock_sec_rec_cons_read_sees(), and row_search_for_mysql().

UNIV_INTERN ulint 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 in/out: mini-transaction

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
mtrin/out: mini-transaction

Definition at line 5212 of file lock0lock.cc.

References buf_block_get_page_zip, DB_SUCCESS_LOCKED_REC, dict_index_is_clust(), buf_block_struct::frame, lock_sec_rec_modify_check_and_lock(), mem_heap_free, page_align(), page_rec_get_heap_no(), page_update_max_trx_id(), dict_index_struct::table, thr_get_trx(), and ut_ad.

Referenced by btr_cur_del_mark_set_sec_rec(), and lock_sec_rec_modify_check_and_lock().

UNIV_INTERN enum db_err 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 in: query thread

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 5290 of file lock0lock.cc.

References DB_SUCCESS_LOCKED_REC, dict_index_is_clust(), buf_block_struct::frame, lock_sec_rec_read_check_and_lock(), page_align(), page_get_max_trx_id(), page_rec_get_heap_no(), page_rec_is_supremum(), page_rec_is_user_rec(), rec_offs_validate(), recv_recovery_is_on(), dict_index_struct::table, thr_get_trx(), trx_list_get_min_trx_id(), and ut_ad.

Referenced by lock_sec_rec_read_check_and_lock().

UNIV_INTERN void lock_sys_close ( void  )

Closes the lock system at database shutdown.

Definition at line 583 of file lock0lock.cc.

References lock_sys, lock_sys_close(), mem_free, and lock_sys_struct::rec_hash.

Referenced by innobase_shutdown_for_mysql(), and lock_sys_close().

UNIV_INTERN void lock_sys_create ( ulint  n_cells)

Creates the lock system at database start. in: number of slots in lock hash table

Creates the lock system at database start.

Parameters:
n_cellsin: number of slots in lock hash table

Definition at line 565 of file lock0lock.cc.

References lock_sys, lock_sys_create(), os_file_create_tmpfile(), lock_sys_struct::rec_hash, and ut_a.

Referenced by innobase_start_or_create_for_mysql(), and lock_sys_create().

UNIV_INTERN ulint 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 in: query thread

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: database table in dictionary cache
modein: lock mode
thrin: query thread

Definition at line 3795 of file lock0lock.cc.

References DB_SUCCESS_LOCKED_REC, lock_table(), thr_get_trx(), ut_a, and ut_ad.

Referenced by lock_table(), drizzled::Session::lock_table_names(), row_ins_check_foreign_constraint(), row_ins_step(), row_lock_table_autoinc_for_mysql(), row_lock_table_for_mysql(), row_search_for_mysql(), row_sel_step(), and row_upd_step().

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

Prints info of a table lock. in: table type lock

Prints info of a table lock.

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

Definition at line 4205 of file lock0lock.cc.

References trx_struct::id, lock_get_type_low(), LOCK_TABLE, lock_table_print(), dict_table_struct::name, lock_struct::tab_lock, lock_table_struct::table, lock_struct::trx, TRX_ID_FMT, lock_struct::un_member, ut_a, ut_ad, and ut_print_name().

Referenced by lock_print_info_all_transactions(), and lock_table_print().

UNIV_INTERN ibool lock_trx_holds_autoinc_locks ( const trx_t trx)

Check if a transaction holds any autoinc locks.

Returns:
TRUE if the transaction holds any AUTOINC locks. in: transaction

Check if a transaction holds any autoinc locks.

Returns:
TRUE if the transaction holds any AUTOINC locks.
Parameters:
trxin: transaction

Definition at line 5512 of file lock0lock.cc.

References ib_vector_is_empty(), lock_trx_holds_autoinc_locks(), and ut_a.

Referenced by lock_trx_holds_autoinc_locks(), and row_unlock_table_autoinc_for_mysql().

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! in: index page; NOT the root!

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 2945 of file lock0lock.cc.

References lock_update_copy_and_discard().

Referenced by lock_update_copy_and_discard().

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

Updates the lock table when a record is removed. in: the record to be removed

Updates the lock table when a record is removed.

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

Definition at line 3162 of file lock0lock.cc.

References buf_block_struct::frame, lock_update_delete(), page_align(), page_is_comp(), rec_get_heap_no_new(), rec_get_heap_no_old(), rec_get_next_offs(), and ut_ad.

Referenced by btr_cur_optimistic_delete(), btr_cur_pessimistic_delete(), and lock_update_delete().

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. in: index page which will be discarded

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 3066 of file lock0lock.cc.

References buf_block_struct::frame, lock_update_discard(), page_is_comp(), rec_get_heap_no_new(), rec_get_heap_no_old(), and rec_get_next_offs().

Referenced by btr_discard_page(), and lock_update_discard().

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. in: the inserted record

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

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

Definition at line 3129 of file lock0lock.cc.

References buf_block_struct::frame, lock_update_insert(), page_align(), page_rec_get_next_low(), page_rec_is_comp(), rec_get_heap_no_new(), rec_get_heap_no_old(), and ut_ad.

Referenced by btr_cur_optimistic_insert(), btr_cur_pessimistic_insert(), and lock_update_insert().

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. in: merged index page which will be discarded

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 2990 of file lock0lock.cc.

References buf_block_struct::frame, lock_update_merge_left(), page_align(), page_rec_get_heap_no(), page_rec_get_next_const(), page_rec_is_supremum(), and ut_ad.

Referenced by btr_compress(), and lock_update_merge_left().

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. in: merged index page which will be discarded

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 2883 of file lock0lock.cc.

References lock_update_merge_right(), and page_rec_get_heap_no().

Referenced by btr_compress(), and lock_update_merge_right().

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. in: root page

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 2925 of file lock0lock.cc.

References lock_update_root_raise().

Referenced by btr_root_raise_and_insert(), and lock_update_root_raise().

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. in: left page

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

Parameters:
right_blockin: right page
left_blockin: left page

Definition at line 2968 of file lock0lock.cc.

References lock_get_min_heap_no(), and lock_update_split_left().

Referenced by btr_page_split_and_insert(), and lock_update_split_left().

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. in: left page

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

Parameters:
right_blockin: right page
left_blockin: left page

Definition at line 2855 of file lock0lock.cc.

References lock_get_min_heap_no(), and lock_update_split_right().

Referenced by btr_page_split_and_insert(), and lock_update_split_right().


Variable Documentation

The lock system

Definition at line 367 of file lock0lock.cc.

Referenced by lock_sys_close(), and lock_sys_create().