⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lock0lock.h

📁 这是linux下运行的mysql软件包,可用于linux 下安装 php + mysql + apach 的网络配置
💻 H
📖 第 1 页 / 共 2 页
字号:
/******************************************************The transaction lock system(c) 1996 Innobase OyCreated 5/7/1996 Heikki Tuuri*******************************************************/#ifndef lock0lock_h#define lock0lock_h#include "univ.i"#include "trx0types.h"#include "rem0types.h"#include "dict0types.h"#include "que0types.h"#include "page0types.h"#include "lock0types.h"#include "read0types.h"#include "hash0hash.h"#ifdef UNIV_DEBUGextern ibool	lock_print_waits;#endif /* UNIV_DEBUG *//* Buffer for storing information about the most recent deadlock error */extern FILE*	lock_latest_err_file;/*************************************************************************Gets the size of a lock struct. */ulintlock_get_size(void);/*===============*/			/* out: size in bytes *//*************************************************************************Creates the lock system at database start. */voidlock_sys_create(/*============*/	ulint	n_cells);	/* in: number of slots in lock hash table *//*************************************************************************Checks if some transaction has an implicit x-lock on a record in a secondaryindex. */trx_t*lock_sec_rec_some_has_impl_off_kernel(/*==================================*/				/* out: transaction which has the x-lock, or				NULL */	rec_t*		rec,	/* in: user record */	dict_index_t*	index,	/* in: secondary index */	const ulint*	offsets);/* in: rec_get_offsets(rec, index) *//*************************************************************************Checks if some transaction has an implicit x-lock on a record in a clusteredindex. */UNIV_INLINEtrx_t*lock_clust_rec_some_has_impl(/*=========================*/				/* out: transaction which has the x-lock, or				NULL */	rec_t*		rec,	/* in: user record */	dict_index_t*	index,	/* in: clustered index */	const ulint*	offsets);/* in: rec_get_offsets(rec, index) *//*****************************************************************Makes a record to inherit the locks of another record as gap typelocks, but does not reset the lock bits of the other record. Alsowaiting lock requests on rec are inherited as GRANTED gap locks. */voidlock_rec_inherit_to_gap(/*====================*/	rec_t*	heir,	/* in: record which inherits */	rec_t*	rec);	/* in: record from which inherited; does NOT reset			the locks on this record *//*****************************************************************Updates the lock table when we have reorganized a page. NOTE: we copyalso the locks set on the infimum of the page; the infimum may carrylocks if an update of a record is occurring on the page, and its lockswere temporarily stored on the infimum. */voidlock_move_reorganize_page(/*======================*/	page_t*	page,		/* in: old index page */	page_t*	new_page);	/* in: reorganized page *//*****************************************************************Moves the explicit locks on user records to another page if a recordlist end is moved to another page. */voidlock_move_rec_list_end(/*===================*/	page_t*	new_page,	/* in: index page to move to */	page_t*	page,		/* in: index page */	rec_t*	rec);		/* in: record on page: this is the				first record moved *//*****************************************************************Moves the explicit locks on user records to another page if a recordlist start is moved to another page. */voidlock_move_rec_list_start(/*=====================*/	page_t*	new_page,	/* in: index page to move to */	page_t*	page,		/* in: index page */	rec_t*	rec,		/* in: record on page: this is the				first record NOT copied */	rec_t*	old_end);	/* in: old previous-to-last record on				new_page before the records were copied *//*****************************************************************Updates the lock table when a page is split to the right. */voidlock_update_split_right(/*====================*/	page_t*	right_page,	/* in: right page */	page_t*	left_page);	/* in: left page *//*****************************************************************Updates the lock table when a page is merged to the right. */voidlock_update_merge_right(/*====================*/	rec_t*	orig_succ,	/* in: original successor of infimum				on the right page before merge */	page_t*	left_page);	/* in: merged index page which will be				discarded *//*****************************************************************Updates the lock table when the root page is copied to another inbtr_root_raise_and_insert. Note that we leave lock structs on theroot page, even though they do not make sense on other than leafpages: the reason is that in a pessimistic update the infimum recordof the root page will act as a dummy carrier of the locks of the recordto be updated. */voidlock_update_root_raise(/*===================*/	page_t*	new_page,	/* in: index page to which copied */	page_t*	root);		/* in: root page *//*****************************************************************Updates the lock table when a page is copied to another and the original pageis removed from the chain of leaf pages, except if page is the root! */voidlock_update_copy_and_discard(/*=========================*/	page_t*	new_page,	/* in: index page to which copied */	page_t*	page);		/* in: index page; NOT the root! *//*****************************************************************Updates the lock table when a page is split to the left. */voidlock_update_split_left(/*===================*/	page_t*	right_page,	/* in: right page */	page_t*	left_page);	/* in: left page *//*****************************************************************Updates the lock table when a page is merged to the left. */voidlock_update_merge_left(/*===================*/	page_t*	left_page,	/* in: left page to which merged */	rec_t*	orig_pred,	/* in: original predecessor of supremum				on the left page before merge */	page_t*	right_page);	/* in: merged index page which will be				discarded *//*****************************************************************Resets the original locks on heir and replaces them with gap type locksinherited from rec. */voidlock_rec_reset_and_inherit_gap_locks(/*=================================*/	rec_t*	heir,	/* in: heir record */	rec_t*	rec);	/* in: record *//*****************************************************************Updates the lock table when a page is discarded. */voidlock_update_discard(/*================*/	rec_t*	heir,	/* in: record which will inherit the locks */	page_t*	page);	/* in: index page which will be discarded *//*****************************************************************Updates the lock table when a new user record is inserted. */voidlock_update_insert(/*===============*/	rec_t*	rec);	/* in: the inserted record *//*****************************************************************Updates the lock table when a record is removed. */voidlock_update_delete(/*===============*/	rec_t*	rec);	/* in: the record to be removed *//*************************************************************************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 isupdated and the size of the record changes in the update. The recordis in such an update moved, perhaps to another page. The infimum recordacts as a dummy carrier record, taking care of lock releases while theactual record is being moved. */voidlock_rec_store_on_page_infimum(/*===========================*/	page_t*	page,	/* in: page containing the record */	rec_t*	rec);	/* in: record whose lock state is stored			on the infimum record of the same page; lock			bits are reset on the record *//*************************************************************************Restores the state of explicit lock requests on a single record, where thestate was stored on the infimum of the page. */voidlock_rec_restore_from_page_infimum(/*===============================*/	rec_t*	rec,	/* in: record whose lock state is restored */	page_t*	page);	/* in: page (rec is not necessarily on this page)			whose infimum stored the lock state; lock bits are			reset on the infimum */ /*************************************************************************Returns TRUE if there are explicit record locks on a page. */iboollock_rec_expl_exist_on_page(/*========================*/			/* out: TRUE if there are explicit record locks on			the page */	ulint	space,	/* in: space id */	ulint	page_no);/* in: page number *//*************************************************************************Checks if locks of other transactions prevent an immediate insert ofa record. If they do, first tests if the query thread should anywaybe suspended for some reason; if not, then puts the transaction andthe query thread to the lock wait state and inserts a waiting requestfor a gap x-lock to the lock queue. */ulintlock_rec_insert_check_and_lock(/*===========================*/				/* out: DB_SUCCESS, DB_LOCK_WAIT,				DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */	ulint		flags,	/* in: if BTR_NO_LOCKING_FLAG bit is set,				does nothing */	rec_t*		rec,	/* in: record after which to insert */	dict_index_t*	index,	/* in: index */	que_thr_t*	thr,	/* in: query thread */	ibool*		inherit);/* 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 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 somereason; if not, then puts the transaction and the query thread to thelock wait state and inserts a waiting request for a record x-lock to thelock queue. */ulintlock_clust_rec_modify_check_and_lock(/*=================================*/				/* out: DB_SUCCESS, DB_LOCK_WAIT,				DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */	ulint		flags,	/* in: if BTR_NO_LOCKING_FLAG bit is set,				does nothing */	rec_t*		rec,	/* in: record which should be modified */	dict_index_t*	index,	/* in: clustered index */	const ulint*	offsets,/* in: rec_get_offsets(rec, index) */	que_thr_t*	thr);	/* in: query thread *//*************************************************************************Checks if locks of other transactions prevent an immediate modify(delete mark or delete unmark) of a secondary index record. */ulintlock_sec_rec_modify_check_and_lock(/*===============================*/				/* out: DB_SUCCESS, DB_LOCK_WAIT,				DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */	ulint		flags,	/* in: if BTR_NO_LOCKING_FLAG bit is set,				does nothing */	rec_t*		rec,	/* in: 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 */	dict_index_t*	index,	/* in: secondary index */	que_thr_t*	thr);	/* in: query thread *//*************************************************************************Like the counterpart for a clustered index below, but now we read asecondary index record. */ulintlock_sec_rec_read_check_and_lock(/*=============================*/				/* out: DB_SUCCESS, DB_LOCK_WAIT,				DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */	ulint		flags,	/* in: if BTR_NO_LOCKING_FLAG bit is set,				does nothing */	rec_t*		rec,	/* in: user record or page supremum record				which should be read or passed over by a read				cursor */	dict_index_t*	index,	/* in: secondary index */	const ulint*	offsets,/* in: rec_get_offsets(rec, index) */	ulint		mode,	/* in: 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 */	ulint		gap_mode,/* in: LOCK_ORDINARY, LOCK_GAP, or				LOCK_REC_NOT_GAP */	que_thr_t*	thr);	/* in: query thread *//*************************************************************************Checks if locks of other transactions prevent an immediate read, or passingover by a read cursor, of a clustered index record. If they do, first testsif the query thread should anyway be suspended for some reason; if not, thenputs the transaction and the query thread to the lock wait state and inserts awaiting request for a record lock to the lock queue. Sets the requested modelock on the record. */ulintlock_clust_rec_read_check_and_lock(/*===============================*/				/* out: DB_SUCCESS, DB_LOCK_WAIT,				DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */	ulint		flags,	/* in: if BTR_NO_LOCKING_FLAG bit is set,				does nothing */	rec_t*		rec,	/* in: user record or page supremum record				which should be read or passed over by a read				cursor */	dict_index_t*	index,	/* in: clustered index */	const ulint*	offsets,/* in: rec_get_offsets(rec, index) */	ulint		mode,	/* in: 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 */	ulint		gap_mode,/* in: LOCK_ORDINARY, LOCK_GAP, or				LOCK_REC_NOT_GAP */	que_thr_t*	thr);	/* in: query thread */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -