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

📄 page0page.h

📁 这是linux下运行的mysql软件包,可用于linux 下安装 php + mysql + apach 的网络配置
💻 H
📖 第 1 页 / 共 2 页
字号:
/******************************************************Index page routines(c) 1994-1996 Innobase OyCreated 2/2/1994 Heikki Tuuri*******************************************************/#ifndef page0page_h#define page0page_h#include "univ.i"#include "page0types.h"#include "fil0fil.h"#include "buf0buf.h"#include "data0data.h"#include "dict0dict.h"#include "rem0rec.h"#include "fsp0fsp.h"#include "mtr0mtr.h"#ifdef UNIV_MATERIALIZE#undef UNIV_INLINE#define UNIV_INLINE#endif/*			PAGE HEADER			===========Index page header starts at the first offset left free by the FIL-module */typedef	byte		page_header_t;#define	PAGE_HEADER	FSEG_PAGE_DATA	/* index page header starts at this				offset *//*-----------------------------*/#define PAGE_N_DIR_SLOTS 0	/* number of slots in page directory */#define	PAGE_HEAP_TOP	 2	/* pointer to record heap top */#define	PAGE_N_HEAP	 4	/* number of records in the heap,				bit 15=flag: new-style compact page format */#define	PAGE_FREE	 6	/* pointer to start of page free record list */#define	PAGE_GARBAGE	 8	/* number of bytes in deleted records */#define	PAGE_LAST_INSERT 10	/* pointer to the last inserted record, or				NULL if this info has been reset by a delete,				for example */#define	PAGE_DIRECTION	 12	/* last insert direction: PAGE_LEFT, ... */#define	PAGE_N_DIRECTION 14	/* number of consecutive inserts to the same				direction */#define	PAGE_N_RECS	 16	/* number of user records on the page */#define PAGE_MAX_TRX_ID	 18	/* highest id of a trx which may have modified				a record on the page; a dulint; defined only				in secondary indexes; specifically, not in an				ibuf tree; NOTE: this may be modified only				when the thread has an x-latch to the page,				and ALSO an x-latch to btr_search_latch				if there is a hash index to the page! */#define PAGE_HEADER_PRIV_END 26	/* end of private data structure of the page				header which are set in a page create *//*----*/#define	PAGE_LEVEL	 26	/* level of the node in an index tree; the				leaf level is the level 0 */#define	PAGE_INDEX_ID	 28	/* index id where the page belongs */#define PAGE_BTR_SEG_LEAF 36	/* file segment header for the leaf pages in				a B-tree: defined only on the root page of a				B-tree, but not in the root of an ibuf tree */#define PAGE_BTR_IBUF_FREE_LIST	PAGE_BTR_SEG_LEAF#define PAGE_BTR_IBUF_FREE_LIST_NODE PAGE_BTR_SEG_LEAF				/* in the place of PAGE_BTR_SEG_LEAF and _TOP				there is a free list base node if the page is				the root page of an ibuf tree, and at the same				place is the free list node if the page is in				a free list */#define PAGE_BTR_SEG_TOP (36 + FSEG_HEADER_SIZE)				/* file segment header for the non-leaf pages				in a B-tree: defined only on the root page of				a B-tree, but not in the root of an ibuf				tree *//*----*/#define PAGE_DATA	(PAGE_HEADER + 36 + 2 * FSEG_HEADER_SIZE)				/* start of data on the page */#define PAGE_OLD_INFIMUM	(PAGE_DATA + 1 + REC_N_OLD_EXTRA_BYTES)				/* offset of the page infimum record on an				old-style page */#define PAGE_OLD_SUPREMUM	(PAGE_DATA + 2 + 2 * REC_N_OLD_EXTRA_BYTES + 8)				/* offset of the page supremum record on an				old-style page */#define PAGE_OLD_SUPREMUM_END (PAGE_OLD_SUPREMUM + 9)				/* offset of the page supremum record end on				an old-style page */#define PAGE_NEW_INFIMUM	(PAGE_DATA + REC_N_NEW_EXTRA_BYTES)				/* offset of the page infimum record on a				new-style compact page */#define PAGE_NEW_SUPREMUM	(PAGE_DATA + 2 * REC_N_NEW_EXTRA_BYTES + 8)				/* offset of the page supremum record on a				new-style compact page */#define PAGE_NEW_SUPREMUM_END (PAGE_NEW_SUPREMUM + 8)				/* offset of the page supremum record end on				a new-style compact page *//*-----------------------------*//* Directions of cursor movement */#define	PAGE_LEFT		1#define	PAGE_RIGHT		2#define	PAGE_SAME_REC		3#define	PAGE_SAME_PAGE		4#define	PAGE_NO_DIRECTION	5/*			PAGE DIRECTORY			==============*/typedef	byte			page_dir_slot_t;typedef page_dir_slot_t		page_dir_t;/* Offset of the directory start down from the page end. We call theslot with the highest file address directory start, as it points to the first record in the list of records. */#define	PAGE_DIR		FIL_PAGE_DATA_END/* We define a slot in the page directory as two bytes */#define	PAGE_DIR_SLOT_SIZE	2/* The offset of the physically lower end of the directory, counted frompage end, when the page is empty */#define PAGE_EMPTY_DIR_START	(PAGE_DIR + 2 * PAGE_DIR_SLOT_SIZE)/* The maximum and minimum number of records owned by a directory slot. Thenumber may drop below the minimum in the first and the last slot in the directory. */#define PAGE_DIR_SLOT_MAX_N_OWNED	8#define	PAGE_DIR_SLOT_MIN_N_OWNED	4/*****************************************************************Returns the max trx id field value. */UNIV_INLINEdulintpage_get_max_trx_id(/*================*/	page_t*	page);	/* in: page *//*****************************************************************Sets the max trx id field value. */voidpage_set_max_trx_id(/*================*/	page_t*	page,	/* in: page */	dulint	trx_id);/* in: transaction id *//*****************************************************************Sets the max trx id field value if trx_id is bigger than the previousvalue. */UNIV_INLINEvoidpage_update_max_trx_id(/*===================*/	page_t*	page,	/* in: page */	dulint	trx_id);	/* in: transaction id *//*****************************************************************Reads the given header field. */UNIV_INLINEulintpage_header_get_field(/*==================*/	page_t*	page,	/* in: page */	ulint	field);	/* in: PAGE_N_DIR_SLOTS, ... *//*****************************************************************Sets the given header field. */UNIV_INLINEvoidpage_header_set_field(/*==================*/	page_t*	page,	/* in: page */	ulint	field,	/* in: PAGE_N_DIR_SLOTS, ... */	ulint	val);	/* in: value *//*****************************************************************Returns the pointer stored in the given header field. */UNIV_INLINEbyte*page_header_get_ptr(/*================*/			/* out: pointer or NULL */	page_t*	page,	/* in: page */	ulint	field);	/* in: PAGE_FREE, ... *//*****************************************************************Sets the pointer stored in the given header field. */UNIV_INLINEvoidpage_header_set_ptr(/*================*/	page_t*	page,	/* in: page */	ulint	field,	/* in: PAGE_FREE, ... */	byte*	ptr);	/* in: pointer or NULL*//*****************************************************************Resets the last insert info field in the page header. Writes to mlogabout this operation. */UNIV_INLINEvoidpage_header_reset_last_insert(/*==========================*/	page_t*	page,	/* in: page */	mtr_t*	mtr);	/* in: mtr *//****************************************************************Gets the first record on the page. */UNIV_INLINErec_t*page_get_infimum_rec(/*=================*/			/* out: the first record in record list */	page_t*	page);	/* in: page which must have record(s) *//****************************************************************Gets the last record on the page. */UNIV_INLINErec_t*page_get_supremum_rec(/*==================*/			/* out: the last record in record list */	page_t*	page);	/* in: page which must have record(s) *//****************************************************************Returns the middle record of record list. If there are an even numberof records in the list, returns the first record of upper half-list. */rec_t*page_get_middle_rec(/*================*/			/* out: middle record */	page_t*	page);	/* in: page *//*****************************************************************Compares a data tuple to a physical record. Differs from the functioncmp_dtuple_rec_with_match in the way that the record must reside on anindex page, and also page infimum and supremum records can be given inthe parameter rec. These are considered as the negative infinity andthe positive infinity in the alphabetical order. */UNIV_INLINEintpage_cmp_dtuple_rec_with_match(/*===========================*/					/* out: 1, 0, -1, if dtuple is greater, equal, 				less than rec, respectively, when only the 				common first fields are compared */	dtuple_t*	dtuple,	/* in: data tuple */	rec_t*		rec,	/* in: physical record on a page; may also 				be page infimum or supremum, in which case 				matched-parameter values below are not 				affected */	const ulint*	offsets,/* in: array returned by rec_get_offsets() */	ulint*	 	matched_fields, /* in/out: number of already completely 				matched fields; when function returns				contains the value for current comparison */	ulint*	  	matched_bytes); /* in/out: number of already matched 				bytes within the first field not completely				matched; when function returns contains the				value for current comparison *//*****************************************************************Gets the number of user records on page (the infimum and supremum recordsare not user records). */UNIV_INLINEulintpage_get_n_recs(/*============*/			/* out: number of user records */	page_t*	page);	/* in: index page *//*******************************************************************Returns the number of records before the given record in chain.The number includes infimum and supremum records. */ulintpage_rec_get_n_recs_before(/*=======================*/			/* out: number of records */	rec_t*	rec);	/* in: the physical record *//*****************************************************************Gets the number of records in the heap. */UNIV_INLINEulintpage_dir_get_n_heap(/*================*/			/* out: number of user records */	page_t*	page);	/* in: index page *//*****************************************************************Sets the number of records in the heap. */UNIV_INLINEvoidpage_dir_set_n_heap(/*================*/	page_t*	page,	/* in: index page */	ulint	n_heap);/* in: number of records *//*****************************************************************Gets the number of dir slots in directory. */UNIV_INLINEulintpage_dir_get_n_slots(/*=================*/			/* out: number of slots */	page_t*	page);	/* in: index page *//*****************************************************************Sets the number of dir slots in directory. */UNIV_INLINEvoidpage_dir_set_n_slots(/*=================*/			/* out: number of slots */	page_t*	page,	/* in: index page */	ulint	n_slots);/* in: number of slots *//*****************************************************************Gets pointer to nth directory slot. */UNIV_INLINEpage_dir_slot_t*page_dir_get_nth_slot(/*==================*/			/* out: pointer to dir slot */	page_t*	page,	/* in: index page */	ulint	n);	/* in: position *//******************************************************************Used to check the consistency of a record on a page. */UNIV_INLINEiboolpage_rec_check(/*===========*/			/* out: TRUE if succeed */	rec_t*	rec);	/* in: record *//*******************************************************************Gets the record pointed to by a directory slot. */UNIV_INLINErec_t*page_dir_slot_get_rec(/*==================*/					/* out: pointer to record */	page_dir_slot_t*	slot);	/* in: directory slot *//*******************************************************************This is used to set the record offset in a directory slot. */UNIV_INLINEvoidpage_dir_slot_set_rec(/*==================*/	page_dir_slot_t* slot,	/* in: directory slot */	rec_t*		 rec);	/* in: record on the page *//*******************************************************************Gets the number of records owned by a directory slot. */UNIV_INLINEulintpage_dir_slot_get_n_owned(/*======================*/					/* out: number of records */	page_dir_slot_t* 	slot);	/* in: page directory slot *//*******************************************************************This is used to set the owned records field of a directory slot. */UNIV_INLINEvoidpage_dir_slot_set_n_owned(/*======================*/	page_dir_slot_t*	slot,	/* in: directory slot */	ulint			n);	/* in: number of records owned 					by the slot *//****************************************************************Calculates the space reserved for directory slots of a givennumber of records. The exact value is a fraction numbern * PAGE_DIR_SLOT_SIZE / PAGE_DIR_SLOT_MIN_N_OWNED, and it isrounded upwards to an integer. */UNIV_INLINEulintpage_dir_calc_reserved_space(/*=========================*/	ulint	n_recs);	/* in: number of records *//*******************************************************************Looks for the directory slot which owns the given record. */ulintpage_dir_find_owner_slot(/*=====================*/				/* out: the directory slot number */	rec_t*		rec);	/* in: the physical record *//****************************************************************Determine whether the page is in new-style compact format. */UNIV_INLINEulintpage_is_comp(/*=========*/			/* out: nonzero if the page is in compact			format, zero if it is in old-style format */	page_t*	page);	/* in: index page *//****************************************************************TRUE if the record is on a page in compact format. */UNIV_INLINEulintpage_rec_is_comp(/*=============*/				/* out: nonzero if in compact format */	const rec_t*	rec);	/* in: record *//****************************************************************Gets the pointer to the next record on the page. */UNIV_INLINErec_t*page_rec_get_next(/*==============*/			/* out: pointer to next record */	rec_t*	rec);	/* in: pointer to record, must not be page			supremum *//****************************************************************Sets the pointer to the next record on the page. */ UNIV_INLINEvoid

⌨️ 快捷键说明

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