![]() |
MySQL
8.0.23
Source Code Documentation
|
#include <stddef.h>
#include <sys/types.h>
#include "univ.i"
#include "buf0buf.h"
#include "data0data.h"
#include "dict0dict.h"
#include "fil0fil.h"
#include "fsp0fsp.h"
#include "mtr0mtr.h"
#include "page0types.h"
#include "rem0rec.h"
#include "page0page.ic"
Go to the source code of this file.
Macros | |
#define | PAGE_DIR FIL_PAGE_DATA_END |
#define | PAGE_DIR_SLOT_SIZE 2 |
#define | PAGE_EMPTY_DIR_START (PAGE_DIR + 2 * PAGE_DIR_SLOT_SIZE) |
#define | PAGE_DIR_SLOT_MAX_N_OWNED 8 |
#define | PAGE_DIR_SLOT_MIN_N_OWNED 4 |
#define | page_header_get_ptr(page, field) |
Returns the pointer stored in the given header field, or NULL. More... | |
#define | page_get_infimum_rec(page) ((page) + page_get_infimum_offset(page)) |
#define | page_get_supremum_rec(page) ((page) + page_get_supremum_offset(page)) |
Typedefs | |
typedef byte | page_dir_slot_t |
typedef page_dir_slot_t | page_dir_t |
Functions | |
UNIV_INLINE page_t * | page_align (const void *ptr) |
Gets the start of a page. More... | |
UNIV_INLINE ulint | page_offset (const void *ptr) |
Gets the offset within a page. More... | |
UNIV_INLINE trx_id_t | page_get_max_trx_id (const page_t *page) |
Returns the max trx id field value. More... | |
void | page_set_max_trx_id (buf_block_t *block, page_zip_des_t *page_zip, trx_id_t trx_id, mtr_t *mtr) |
Sets the max trx id field value. More... | |
UNIV_INLINE void | page_update_max_trx_id (buf_block_t *block, page_zip_des_t *page_zip, trx_id_t trx_id, mtr_t *mtr) |
Sets the max trx id field value if trx_id is bigger than the previous value. More... | |
UNIV_INLINE node_seq_t | page_get_ssn_id (const page_t *page) |
Returns the RTREE SPLIT SEQUENCE NUMBER (FIL_RTREE_SPLIT_SEQ_NUM). More... | |
UNIV_INLINE void | page_set_ssn_id (buf_block_t *block, page_zip_des_t *page_zip, node_seq_t ssn_id, mtr_t *mtr) |
Sets the RTREE SPLIT SEQUENCE NUMBER field value. More... | |
UNIV_INLINE ulint | page_header_get_field (const page_t *page, ulint field) |
Reads the given header field. More... | |
UNIV_INLINE void | page_header_set_field (page_t *page, page_zip_des_t *page_zip, ulint field, ulint val) |
Sets the given header field. More... | |
UNIV_INLINE ulint | page_header_get_offs (const page_t *page, ulint field) |
Returns the offset stored in the given header field. More... | |
UNIV_INLINE void | page_header_set_ptr (page_t *page, page_zip_des_t *page_zip, ulint field, const byte *ptr) |
Sets the pointer stored in the given header field. More... | |
UNIV_INLINE void | page_header_reset_last_insert (page_t *page, page_zip_des_t *page_zip, mtr_t *mtr) |
Resets the last insert info field in the page header. More... | |
UNIV_INLINE ulint | page_get_infimum_offset (const page_t *page) |
Gets the offset of the first record on the page. More... | |
UNIV_INLINE ulint | page_get_supremum_offset (const page_t *page) |
Gets the offset of the last record on the page. More... | |
const rec_t * | page_rec_get_nth_const (const page_t *page, ulint nth) |
Returns the nth record of the record list. More... | |
UNIV_INLINE rec_t * | page_rec_get_nth (page_t *page, ulint nth) |
Returns the nth record of the record list. More... | |
UNIV_INLINE rec_t * | page_get_middle_rec (page_t *page) |
Returns the middle record of the records on the page. More... | |
UNIV_INLINE page_no_t | page_get_page_no (const page_t *page) |
Gets the page number. More... | |
UNIV_INLINE space_id_t | page_get_space_id (const page_t *page) |
Gets the tablespace identifier. More... | |
UNIV_INLINE page_id_t | page_get_page_id (const page_t *page) |
Gets the space id and page number identifying the page. More... | |
UNIV_INLINE ulint | page_get_n_recs (const page_t *page) |
Gets the number of user records on page (the infimum and supremum records are not user records). More... | |
ulint | page_rec_get_n_recs_before (const rec_t *rec) |
Returns the number of records before the given record in chain. More... | |
UNIV_INLINE ulint | page_dir_get_n_heap (const page_t *page) |
Gets the number of records in the heap. More... | |
UNIV_INLINE void | page_dir_set_n_heap (page_t *page, page_zip_des_t *page_zip, ulint n_heap) |
Sets the number of records in the heap. More... | |
UNIV_INLINE ulint | page_dir_get_n_slots (const page_t *page) |
Gets the number of dir slots in directory. More... | |
UNIV_INLINE void | page_dir_set_n_slots (page_t *page, page_zip_des_t *page_zip, ulint n_slots) |
Sets the number of dir slots in directory. More... | |
UNIV_INLINE page_dir_slot_t * | page_dir_get_nth_slot (const page_t *page, ulint n) |
Gets pointer to nth directory slot. More... | |
UNIV_INLINE ibool | page_rec_check (const rec_t *rec) |
Used to check the consistency of a record on a page. More... | |
UNIV_INLINE const rec_t * | page_dir_slot_get_rec (const page_dir_slot_t *slot) |
Gets the record pointed to by a directory slot. More... | |
UNIV_INLINE void | page_dir_slot_set_rec (page_dir_slot_t *slot, rec_t *rec) |
This is used to set the record offset in a directory slot. More... | |
UNIV_INLINE ulint | page_dir_slot_get_n_owned (const page_dir_slot_t *slot) |
Gets the number of records owned by a directory slot. More... | |
UNIV_INLINE void | page_dir_slot_set_n_owned (page_dir_slot_t *slot, page_zip_des_t *page_zip, ulint n) |
This is used to set the owned records field of a directory slot. More... | |
UNIV_INLINE ulint | page_dir_calc_reserved_space (ulint n_recs) |
Calculates the space reserved for directory slots of a given number of records. More... | |
ulint | page_dir_find_owner_slot (const rec_t *rec) |
Looks for the directory slot which owns the given record. More... | |
UNIV_INLINE ulint | page_is_comp (const page_t *page) |
Determine whether the page is in new-style compact format. More... | |
UNIV_INLINE ulint | page_rec_is_comp (const rec_t *rec) |
TRUE if the record is on a page in compact format. More... | |
UNIV_INLINE ulint | page_rec_get_heap_no (const rec_t *rec) |
Returns the heap number of a record. More... | |
UNIV_INLINE bool | page_is_leaf (const page_t *page) |
Determine whether the page is a B-tree leaf. More... | |
UNIV_INLINE bool | page_is_empty (const page_t *page) |
Determine whether the page is empty. More... | |
UNIV_INLINE bool | page_is_root (const page_t *page) |
Determine whether a page is an index root page. More... | |
UNIV_INLINE bool | page_has_garbage (const page_t *page) |
Determine whether the page contains garbage. More... | |
UNIV_INLINE const rec_t * | page_rec_get_next_low (const rec_t *rec, ulint comp) |
Gets the pointer to the next record on the page. More... | |
UNIV_INLINE rec_t * | page_rec_get_next (rec_t *rec) |
Gets the pointer to the next record on the page. More... | |
UNIV_INLINE const rec_t * | page_rec_get_next_const (const rec_t *rec) |
Gets the pointer to the next record on the page. More... | |
UNIV_INLINE const rec_t * | page_rec_get_next_non_del_marked (const rec_t *rec) |
Gets the pointer to the next non delete-marked record on the page. More... | |
UNIV_INLINE void | page_rec_set_next (rec_t *rec, const rec_t *next) |
Sets the pointer to the next record on the page. More... | |
UNIV_INLINE const rec_t * | page_rec_get_prev_const (const rec_t *rec) |
Gets the pointer to the previous record. More... | |
UNIV_INLINE rec_t * | page_rec_get_prev (rec_t *rec) |
Gets the pointer to the previous record. More... | |
UNIV_INLINE ibool | page_rec_is_user_rec_low (ulint offset) |
TRUE if the record is a user record on the page. More... | |
UNIV_INLINE ibool | page_rec_is_supremum_low (ulint offset) |
TRUE if the record is the supremum record on a page. More... | |
UNIV_INLINE ibool | page_rec_is_infimum_low (ulint offset) |
TRUE if the record is the infimum record on a page. More... | |
UNIV_INLINE ibool | page_rec_is_user_rec (const rec_t *rec) |
TRUE if the record is a user record on the page. More... | |
UNIV_INLINE ibool | page_rec_is_supremum (const rec_t *rec) |
TRUE if the record is the supremum record on a page. More... | |
UNIV_INLINE ibool | page_rec_is_infimum (const rec_t *rec) |
TRUE if the record is the infimum record on a page. More... | |
UNIV_INLINE bool | page_rec_is_first (const rec_t *rec, const page_t *page) |
true if the record is the first user record on a page. More... | |
UNIV_INLINE bool | page_rec_is_second (const rec_t *rec, const page_t *page) |
true if the record is the second user record on a page. More... | |
UNIV_INLINE bool | page_rec_is_last (const rec_t *rec, const page_t *page) |
true if the record is the last user record on a page. More... | |
UNIV_INLINE bool | page_rec_distance_is_at_most (const rec_t *left_rec, const rec_t *right_rec, ulint val) |
true if distance between the records (measured in number of times we have to move to the next record) is at most the specified value More... | |
UNIV_INLINE bool | page_rec_is_second_last (const rec_t *rec, const page_t *page) |
true if the record is the second last user record on a page. More... | |
UNIV_INLINE rec_t * | page_rec_find_owner_rec (rec_t *rec) |
Looks for the record which owns the given record. More... | |
UNIV_INLINE void | page_rec_write_field (rec_t *rec, ulint i, ulint val, mtr_t *mtr) |
Write a 32-bit field in a data dictionary record. More... | |
UNIV_INLINE ulint | page_get_max_insert_size (const page_t *page, ulint n_recs) |
Returns the maximum combined size of records which can be inserted on top of record heap. More... | |
UNIV_INLINE ulint | page_get_max_insert_size_after_reorganize (const page_t *page, ulint n_recs) |
Returns the maximum combined size of records which can be inserted on top of record heap if page is first reorganized. More... | |
UNIV_INLINE ulint | page_get_free_space_of_empty (ulint comp) |
Calculates free space if a page is emptied. More... | |
UNIV_INLINE ulint | page_rec_get_base_extra_size (const rec_t *rec) |
Returns the base extra size of a physical record. More... | |
UNIV_INLINE ulint | page_get_data_size (const page_t *page) |
Returns the sum of the sizes of the records in the record list excluding the infimum and supremum records. More... | |
UNIV_INLINE void | page_mem_alloc_free (page_t *page, page_zip_des_t *page_zip, rec_t *next_rec, ulint need) |
Allocates a block of memory from the head of the free list of an index page. More... | |
byte * | page_mem_alloc_heap (page_t *page, page_zip_des_t *page_zip, ulint need, ulint *heap_no) |
Allocates a block of memory from the heap of an index page. More... | |
UNIV_INLINE void | page_mem_free (page_t *page, page_zip_des_t *page_zip, rec_t *rec, const dict_index_t *index, const ulint *offsets) |
Puts a record to free list. More... | |
page_t * | page_create (buf_block_t *block, mtr_t *mtr, ulint comp, page_type_t page_type) |
Create an uncompressed B-tree or R-tree or SDI index page. More... | |
page_t * | page_create_zip (buf_block_t *block, dict_index_t *index, ulint level, trx_id_t max_trx_id, mtr_t *mtr, page_type_t page_type) |
Create a compressed B-tree index page. More... | |
void | page_create_empty (buf_block_t *block, dict_index_t *index, mtr_t *mtr) |
Empty a previously created B-tree index page. More... | |
void | page_copy_rec_list_end_no_locks (buf_block_t *new_block, buf_block_t *block, rec_t *rec, dict_index_t *index, mtr_t *mtr) |
Differs from page_copy_rec_list_end, because this function does not touch the lock table and max trx id on page or compress the page. More... | |
rec_t * | page_copy_rec_list_end (buf_block_t *new_block, buf_block_t *block, rec_t *rec, dict_index_t *index, mtr_t *mtr) |
Copies records from page to new_page, from the given record onward, including that record. More... | |
rec_t * | page_copy_rec_list_start (buf_block_t *new_block, buf_block_t *block, rec_t *rec, dict_index_t *index, mtr_t *mtr) |
Copies records from page to new_page, up to the given record, NOT including that record. More... | |
void | page_delete_rec_list_end (rec_t *rec, buf_block_t *block, dict_index_t *index, ulint n_recs, ulint size, mtr_t *mtr) |
Deletes records from a page from a given record onward, including that record. More... | |
void | page_delete_rec_list_start (rec_t *rec, buf_block_t *block, dict_index_t *index, mtr_t *mtr) |
Deletes records from page, up to the given record, NOT including that record. More... | |
ibool | page_move_rec_list_end (buf_block_t *new_block, buf_block_t *block, rec_t *split_rec, dict_index_t *index, mtr_t *mtr) |
Moves record list end to another page. More... | |
ibool | page_move_rec_list_start (buf_block_t *new_block, buf_block_t *block, rec_t *split_rec, dict_index_t *index, mtr_t *mtr) |
Moves record list start to another page. More... | |
void | page_dir_split_slot (page_t *page, page_zip_des_t *page_zip, ulint slot_no) |
Splits a directory slot which owns too many records. More... | |
void | page_dir_balance_slot (page_t *page, page_zip_des_t *page_zip, ulint slot_no) |
Tries to balance the given directory slot with too few records with the upper neighbor, so that there are at least the minimum number of records owned by the slot; this may result in the merging of two slots. More... | |
byte * | page_parse_delete_rec_list (mlog_id_t type, byte *ptr, byte *end_ptr, buf_block_t *block, dict_index_t *index, mtr_t *mtr) |
Parses a log record of a record list end or start deletion. More... | |
void | page_parse_create (buf_block_t *block, ulint comp, page_type_t page_type) |
Parses a redo log record of creating a page. More... | |
void | page_rec_print (const rec_t *rec, const ulint *offsets) |
Prints record contents including the data relevant only in the index page context. More... | |
ibool | page_rec_validate (const rec_t *rec, const ulint *offsets) |
The following is used to validate a record on a page. More... | |
void | page_check_dir (const page_t *page) |
Checks that the first directory slot points to the infimum record and the last to the supremum. More... | |
ibool | page_simple_validate_old (const page_t *page) |
This function checks the consistency of an index page when we do not know the index. More... | |
ibool | page_simple_validate_new (const page_t *page) |
This function checks the consistency of an index page when we do not know the index. More... | |
ibool | page_validate (const page_t *page, dict_index_t *index) |
This function checks the consistency of an index page. More... | |
const rec_t * | page_find_rec_with_heap_no (const page_t *page, ulint heap_no) |
Looks in the page record list for a record with the given heap number. More... | |
const rec_t * | page_find_rec_last_not_deleted (const page_t *page) |
Get the last non-delete-marked record on a page. More... | |
void | page_warn_strict_checksum (srv_checksum_algorithm_t curr_algo, srv_checksum_algorithm_t page_checksum, const page_id_t &page_id) |
Issue a warning when the checksum that is stored in the page is valid, but different than the global setting innodb_checksum_algorithm. More... | |
ulong | page_size_validate (ulong page_size) |
Check that a page_size is correct for InnoDB. More... | |
bool | page_is_spatial_non_leaf (const rec_t *rec, dict_index_t *index) |
This function checks if the page in which record is present is a non-leaf node of a spatial index. More... | |
Variables | |
static const byte | infimum_extra [] |
Extra bytes of an infimum record. More... | |
static const byte | infimum_data [] |
Data bytes of an infimum record. More... | |
static const byte | supremum_extra_data [] |
Extra bytes and data bytes of a supremum record. More... | |
Index page routines
Created 2/2/1994 Heikki Tuuri
#define PAGE_DIR FIL_PAGE_DATA_END |
#define PAGE_DIR_SLOT_MAX_N_OWNED 8 |
#define PAGE_DIR_SLOT_MIN_N_OWNED 4 |
#define PAGE_DIR_SLOT_SIZE 2 |
#define PAGE_EMPTY_DIR_START (PAGE_DIR + 2 * PAGE_DIR_SLOT_SIZE) |
#define page_get_infimum_rec | ( | page | ) | ((page) + page_get_infimum_offset(page)) |
#define page_get_supremum_rec | ( | page | ) | ((page) + page_get_supremum_offset(page)) |
#define page_header_get_ptr | ( | page, | |
field | |||
) |
Returns the pointer stored in the given header field, or NULL.
typedef byte page_dir_slot_t |
typedef page_dir_slot_t page_dir_t |
UNIV_INLINE page_t* page_align | ( | const void * | ptr | ) |
Gets the start of a page.
[in] | ptr | pointer to page frame |
void page_check_dir | ( | const page_t * | page | ) |
Checks that the first directory slot points to the infimum record and the last to the supremum.
This function is intended to track if the bug fixed in 4.0.14 has caused corruption to users' databases. in: index page
This function is intended to track if the bug fixed in 4.0.14 has caused corruption to users' databases.
rec_t* page_copy_rec_list_end | ( | buf_block_t * | new_block, |
buf_block_t * | block, | ||
rec_t * | rec, | ||
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Copies records from page to new_page, from the given record onward, including that record.
Infimum and supremum records are not copied. The records are copied to the start of the record list on new_page.
IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if new_block is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit().
Copies records from page to new_page, from the given record onward, including that record.
Infimum and supremum records are not copied. The records are copied to the start of the record list on new_page.
IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if new_block is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit().
void page_copy_rec_list_end_no_locks | ( | buf_block_t * | new_block, |
buf_block_t * | block, | ||
rec_t * | rec, | ||
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Differs from page_copy_rec_list_end, because this function does not touch the lock table and max trx id on page or compress the page.
IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if new_block is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit(). in: mtr
IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if new_block is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit().
rec_t* page_copy_rec_list_start | ( | buf_block_t * | new_block, |
buf_block_t * | block, | ||
rec_t * | rec, | ||
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Copies records from page to new_page, up to the given record, NOT including that record.
Infimum and supremum records are not copied. The records are copied to the end of the record list on new_page.
IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if new_block is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit().
Infimum and supremum records are not copied. The records are copied to the end of the record list on new_page.
IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if new_block is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit().
page_t* page_create | ( | buf_block_t * | block, |
mtr_t * | mtr, | ||
ulint | comp, | ||
page_type_t | page_type | ||
) |
Create an uncompressed B-tree or R-tree or SDI index page.
[in] | block | A buffer block where the page is created |
[in] | mtr | Mini-transaction handle |
[in] | comp | nonzero=compact page format |
[in] | page_type | Page type |
void page_create_empty | ( | buf_block_t * | block, |
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Empty a previously created B-tree index page.
[in,out] | block | B-tree block |
[in] | index | The index of the page |
[in,out] | mtr | Mini-transaction |
page_t* page_create_zip | ( | buf_block_t * | block, |
dict_index_t * | index, | ||
ulint | level, | ||
trx_id_t | max_trx_id, | ||
mtr_t * | mtr, | ||
page_type_t | page_type | ||
) |
Create a compressed B-tree index page.
[in,out] | block | Buffer frame where the page is created |
[in] | index | Index of the page, or NULL when applying TRUNCATE log record during recovery |
[in] | level | The B-tree level of the page |
[in] | max_trx_id | PAGE_MAX_TRX_ID |
[in] | mtr | Mini-transaction handle |
[in] | page_type | Page type to be created. Only FIL_PAGE_INDEX, FIL_PAGE_RTREE, FIL_PAGE_SDI allowed |
void page_delete_rec_list_end | ( | rec_t * | rec, |
buf_block_t * | block, | ||
dict_index_t * | index, | ||
ulint | n_recs, | ||
ulint | size, | ||
mtr_t * | mtr | ||
) |
Deletes records from a page from a given record onward, including that record.
The infimum and supremum records are not deleted. in: mtr
The infimum and supremum records are not deleted.
void page_delete_rec_list_start | ( | rec_t * | rec, |
buf_block_t * | block, | ||
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Deletes records from page, up to the given record, NOT including that record.
Infimum and supremum records are not deleted. in: mtr
Infimum and supremum records are not deleted.
void page_dir_balance_slot | ( | page_t * | page, |
page_zip_des_t * | page_zip, | ||
ulint | slot_no | ||
) |
Tries to balance the given directory slot with too few records with the upper neighbor, so that there are at least the minimum number of records owned by the slot; this may result in the merging of two slots.
[in,out] | page | Index page |
[in,out] | page_zip | Compressed page, or null |
[in] | slot_no | The directory slot |
UNIV_INLINE ulint page_dir_calc_reserved_space | ( | ulint | n_recs | ) |
Calculates the space reserved for directory slots of a given number of records.
The exact value is a fraction number n * PAGE_DIR_SLOT_SIZE / PAGE_DIR_SLOT_MIN_N_OWNED, and it is rounded upwards to an integer. in: number of records
ulint page_dir_find_owner_slot | ( | const rec_t * | rec | ) |
Looks for the directory slot which owns the given record.
UNIV_INLINE ulint page_dir_get_n_heap | ( | const page_t * | page | ) |
Gets the number of records in the heap.
UNIV_INLINE ulint page_dir_get_n_slots | ( | const page_t * | page | ) |
Gets the number of dir slots in directory.
UNIV_INLINE page_dir_slot_t* page_dir_get_nth_slot | ( | const page_t * | page, |
ulint | n | ||
) |
Gets pointer to nth directory slot.
[in] | page | index page |
[in] | n | position |
UNIV_INLINE void page_dir_set_n_heap | ( | page_t * | page, |
page_zip_des_t * | page_zip, | ||
ulint | n_heap | ||
) |
Sets the number of records in the heap.
[in,out] | page | index page |
[in,out] | page_zip | compressed page whose uncompressed part will be updated, or NULL. Note that the size of the dense page directory in the compressed page trailer is n_heap * PAGE_ZIP_DIR_SLOT_SIZE. |
[in] | n_heap | number of records |
UNIV_INLINE void page_dir_set_n_slots | ( | page_t * | page, |
page_zip_des_t * | page_zip, | ||
ulint | n_slots | ||
) |
Sets the number of dir slots in directory.
[in,out] | page | page |
[in,out] | page_zip | compressed page whose uncompressed part will be updated, or NULL |
[in] | n_slots | number of slots |
UNIV_INLINE ulint page_dir_slot_get_n_owned | ( | const page_dir_slot_t * | slot | ) |
Gets the number of records owned by a directory slot.
UNIV_INLINE const rec_t* page_dir_slot_get_rec | ( | const page_dir_slot_t * | slot | ) |
Gets the record pointed to by a directory slot.
UNIV_INLINE void page_dir_slot_set_n_owned | ( | page_dir_slot_t * | slot, |
page_zip_des_t * | page_zip, | ||
ulint | n | ||
) |
This is used to set the owned records field of a directory slot.
[in,out] | slot | directory slot |
[in,out] | page_zip | compressed page, or NULL |
[in] | n | number of records owned by the slot |
UNIV_INLINE void page_dir_slot_set_rec | ( | page_dir_slot_t * | slot, |
rec_t * | rec | ||
) |
This is used to set the record offset in a directory slot.
[in] | rec | record on the page |
[in] | slot | directory slot |
void page_dir_split_slot | ( | page_t * | page, |
page_zip_des_t * | page_zip, | ||
ulint | slot_no | ||
) |
Splits a directory slot which owns too many records.
[in,out] | page | Index page |
[in,out] | page_zip | Compressed page whose uncompressed part will be written, or null |
[in] | slot_no | The directory slot |
Get the last non-delete-marked record on a page.
[in] | page | index tree leaf page |
infimum | record if all records are delete-marked |
Looks in the page record list for a record with the given heap number.
UNIV_INLINE ulint page_get_data_size | ( | const page_t * | page | ) |
Returns the sum of the sizes of the records in the record list excluding the infimum and supremum records.
UNIV_INLINE ulint page_get_free_space_of_empty | ( | ulint | comp | ) |
Calculates free space if a page is emptied.
[in] | comp | nonzero=compact page format |
UNIV_INLINE ulint page_get_infimum_offset | ( | const page_t * | page | ) |
Gets the offset of the first record on the page.
UNIV_INLINE ulint page_get_max_insert_size | ( | const page_t * | page, |
ulint | n_recs | ||
) |
Returns the maximum combined size of records which can be inserted on top of record heap.
[in] | page | index page |
[in] | n_recs | number of records |
UNIV_INLINE ulint page_get_max_insert_size_after_reorganize | ( | const page_t * | page, |
ulint | n_recs | ||
) |
Returns the maximum combined size of records which can be inserted on top of record heap if page is first reorganized.
[in] | page | index page |
[in] | n_recs | number of records |
Returns the max trx id field value.
in: page
Returns the middle record of the records on the page.
If there is an even number of records in the list, returns the first record of the upper half-list.
page | in: page |
UNIV_INLINE ulint page_get_n_recs | ( | const page_t * | page | ) |
Gets the number of user records on page (the infimum and supremum records are not user records).
Gets the space id and page number identifying the page.
Gets the page number.
UNIV_INLINE space_id_t page_get_space_id | ( | const page_t * | page | ) |
Gets the tablespace identifier.
UNIV_INLINE node_seq_t page_get_ssn_id | ( | const page_t * | page | ) |
Returns the RTREE SPLIT SEQUENCE NUMBER (FIL_RTREE_SPLIT_SEQ_NUM).
[in] | page | page |
UNIV_INLINE ulint page_get_supremum_offset | ( | const page_t * | page | ) |
Gets the offset of the last record on the page.
Determine whether the page contains garbage.
page | in: page |
UNIV_INLINE ulint page_header_get_field | ( | const page_t * | page, |
ulint | field | ||
) |
Reads the given header field.
[in] | page | page |
[in] | field | PAGE_N_DIR_SLOTS, ... |
UNIV_INLINE ulint page_header_get_offs | ( | const page_t * | page, |
ulint | field | ||
) |
Returns the offset stored in the given header field.
page | in: page |
field | in: PAGE_FREE, ... |
UNIV_INLINE void page_header_reset_last_insert | ( | page_t * | page, |
page_zip_des_t * | page_zip, | ||
mtr_t * | mtr | ||
) |
Resets the last insert info field in the page header.
Writes to mlog about this operation.
[in] | page | page |
[in,out] | page_zip | compressed page whose uncompressed part will be updated, or NULL |
[in] | mtr | mtr |
UNIV_INLINE void page_header_set_field | ( | page_t * | page, |
page_zip_des_t * | page_zip, | ||
ulint | field, | ||
ulint | val | ||
) |
Sets the given header field.
[in,out] | page | page |
[in,out] | page_zip | compressed page whose uncompressed part will be updated, or NULL |
[in] | field | PAGE_N_DIR_SLOTS, ... |
[in] | val | value |
UNIV_INLINE void page_header_set_ptr | ( | page_t * | page, |
page_zip_des_t * | page_zip, | ||
ulint | field, | ||
const byte * | ptr | ||
) |
Sets the pointer stored in the given header field.
[in,out] | page | page |
[in,out] | page_zip | compressed page whose uncompressed part will be updated, or NULL |
[in,out] | field | PAGE_FREE, ... |
[in] | ptr | pointer or NULL |
UNIV_INLINE ulint page_is_comp | ( | const page_t * | page | ) |
Determine whether the page is in new-style compact format.
Determine whether the page is empty.
page | in: page |
Determine whether the page is a B-tree leaf.
page | in: page |
Determine whether a page is an index root page.
[in] | page | page frame |
bool page_is_spatial_non_leaf | ( | const rec_t * | rec, |
dict_index_t * | index | ||
) |
This function checks if the page in which record is present is a non-leaf node of a spatial index.
param[in] rec Btree record param[in] index index
UNIV_INLINE void page_mem_alloc_free | ( | page_t * | page, |
page_zip_des_t * | page_zip, | ||
rec_t * | next_rec, | ||
ulint | need | ||
) |
Allocates a block of memory from the head of the free list of an index page.
[in,out] | page | index page |
[in,out] | page_zip | compressed page with enough space available for inserting the record, or NULL |
[in] | next_rec | pointer to the new head of the free record list |
[in] | need | number of bytes allocated |
byte* page_mem_alloc_heap | ( | page_t * | page, |
page_zip_des_t * | page_zip, | ||
ulint | need, | ||
ulint * | heap_no | ||
) |
Allocates a block of memory from the heap of an index page.
UNIV_INLINE void page_mem_free | ( | page_t * | page, |
page_zip_des_t * | page_zip, | ||
rec_t * | rec, | ||
const dict_index_t * | index, | ||
const ulint * | offsets | ||
) |
Puts a record to free list.
[in,out] | page | index page |
[in,out] | page_zip | compressed page, or NULL |
[in] | rec | pointer to the (origin of) record |
[in] | index | index of rec |
[in] | offsets | array returned by rec_get_offsets() |
ibool page_move_rec_list_end | ( | buf_block_t * | new_block, |
buf_block_t * | block, | ||
rec_t * | split_rec, | ||
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Moves record list end to another page.
Moved records include split_rec.
IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if new_block is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit().
Moved records include split_rec.
IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if new_block is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit().
ibool page_move_rec_list_start | ( | buf_block_t * | new_block, |
buf_block_t * | block, | ||
rec_t * | split_rec, | ||
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Moves record list start to another page.
Moved records do not include split_rec.
IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if new_block is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit().
Moved records do not include split_rec.
IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if new_block is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit().
UNIV_INLINE ulint page_offset | ( | const void * | ptr | ) |
Gets the offset within a page.
[in] | ptr | pointer to page frame |
void page_parse_create | ( | buf_block_t * | block, |
ulint | comp, | ||
page_type_t | page_type | ||
) |
Parses a redo log record of creating a page.
[in,out] | block | buffer block, or NULL |
[in] | comp | nonzero=compact page format |
[in] | page_type | page type (FIL_PAGE_INDEX, FIL_PAGE_RTREE or FIL_PAGE_SDI) |
byte* page_parse_delete_rec_list | ( | mlog_id_t | type, |
byte * | ptr, | ||
byte * | end_ptr, | ||
buf_block_t * | block, | ||
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Parses a log record of a record list end or start deletion.
UNIV_INLINE ibool page_rec_check | ( | const rec_t * | rec | ) |
Used to check the consistency of a record on a page.
UNIV_INLINE bool page_rec_distance_is_at_most | ( | const rec_t * | left_rec, |
const rec_t * | right_rec, | ||
ulint | val | ||
) |
true if distance between the records (measured in number of times we have to move to the next record) is at most the specified value
[in] | left_rec | lefter record |
[in] | right_rec | righter record |
[in] | val | specified value to compare |
Looks for the record which owns the given record.
UNIV_INLINE ulint page_rec_get_base_extra_size | ( | const rec_t * | rec | ) |
Returns the base extra size of a physical record.
This is the size of the fixed header, independent of the record size.
UNIV_INLINE ulint page_rec_get_heap_no | ( | const rec_t * | rec | ) |
Returns the heap number of a record.
ulint page_rec_get_n_recs_before | ( | const rec_t * | rec | ) |
Returns the number of records before the given record in chain.
The number includes infimum and supremum records. This is the inverse function of page_rec_get_nth().
The number includes infimum and supremum records.
Gets the pointer to the next record on the page.
Gets the pointer to the next record on the page.
Gets the pointer to the next record on the page.
[in] | rec | pointer to record |
[in] | comp | nonzero=compact page layout |
Gets the pointer to the next non delete-marked record on the page.
If all subsequent records are delete-marked, then this function will return the supremum record.
Returns the nth record of the record list.
This is the inverse function of page_rec_get_n_recs_before().
[in] | page | page |
[in] | nth | nth record |
Returns the nth record of the record list.
This is the inverse function of page_rec_get_n_recs_before().
Gets the pointer to the previous record.
Gets the pointer to the previous record.
UNIV_INLINE ulint page_rec_is_comp | ( | const rec_t * | rec | ) |
TRUE if the record is on a page in compact format.
true if the record is the first user record on a page.
rec | in: record |
page | in: page |
UNIV_INLINE ibool page_rec_is_infimum | ( | const rec_t * | rec | ) |
TRUE if the record is the infimum record on a page.
rec | in: record |
UNIV_INLINE ibool page_rec_is_infimum_low | ( | ulint | offset | ) |
TRUE if the record is the infimum record on a page.
[in] | offset | record offset on page |
true if the record is the last user record on a page.
rec | in: record |
page | in: page |
true if the record is the second user record on a page.
rec | in: record |
page | in: page |
true if the record is the second last user record on a page.
rec | in: record |
page | in: page |
UNIV_INLINE ibool page_rec_is_supremum | ( | const rec_t * | rec | ) |
TRUE if the record is the supremum record on a page.
rec | in: record |
UNIV_INLINE ibool page_rec_is_supremum_low | ( | ulint | offset | ) |
TRUE if the record is the supremum record on a page.
[in] | offset | record offset on page |
UNIV_INLINE ibool page_rec_is_user_rec | ( | const rec_t * | rec | ) |
TRUE if the record is a user record on the page.
rec | in: record |
UNIV_INLINE ibool page_rec_is_user_rec_low | ( | ulint | offset | ) |
TRUE if the record is a user record on the page.
[in] | offset | record offset on page |
void page_rec_print | ( | const rec_t * | rec, |
const ulint * | offsets | ||
) |
Prints record contents including the data relevant only in the index page context.
[in] | rec | Physical record |
[in] | offsets | Record descriptor |
Sets the pointer to the next record on the page.
[in] | rec | pointer to record, must not be page supremum |
[in] | next | pointer to next record, must not be page infimum |
ibool page_rec_validate | ( | const rec_t * | rec, |
const ulint * | offsets | ||
) |
The following is used to validate a record on a page.
This function differs from rec_validate as it can also check the n_owned field and the heap_no field.
This function differs from rec_validate as it can also check the n_owned field and the heap_no field.
Write a 32-bit field in a data dictionary record.
[in,out] | rec | Record to update |
[in] | i | Index of the field to update |
[in] | val | Value to write |
[in,out] | mtr | Mini-transaction |
void page_set_max_trx_id | ( | buf_block_t * | block, |
page_zip_des_t * | page_zip, | ||
trx_id_t | trx_id, | ||
mtr_t * | mtr | ||
) |
Sets the max trx id field value.
[in,out] | block | Page |
[in,out] | page_zip | Compressed page, or NULL |
[in] | trx_id | Transaction id |
[in,out] | mtr | Mini-transaction, or NULL |
UNIV_INLINE void page_set_ssn_id | ( | buf_block_t * | block, |
page_zip_des_t * | page_zip, | ||
node_seq_t | ssn_id, | ||
mtr_t * | mtr | ||
) |
Sets the RTREE SPLIT SEQUENCE NUMBER field value.
[in,out] | block | Page |
[in,out] | page_zip | Compressed page whose uncompressed part will be updated, or NULL |
[in] | ssn_id | Split sequence id |
[in,out] | mtr | Mini-transaction |
ibool page_simple_validate_new | ( | const page_t * | page | ) |
This function checks the consistency of an index page when we do not know the index.
This is also resilient so that this should never crash even if the page is total garbage.
This is also resilient so that this should never crash even if the page is total garbage.
ibool page_simple_validate_old | ( | const page_t * | page | ) |
This function checks the consistency of an index page when we do not know the index.
This is also resilient so that this should never crash even if the page is total garbage.
This is also resilient so that this should never crash even if the page is total garbage.
|
inline |
Check that a page_size is correct for InnoDB.
If correct, set the associated page_size_shift which is the power of 2 for this page size.
[in] | page_size | Page Size to evaluate |
UNIV_INLINE void page_update_max_trx_id | ( | buf_block_t * | block, |
page_zip_des_t * | page_zip, | ||
trx_id_t | trx_id, | ||
mtr_t * | mtr | ||
) |
Sets the max trx id field value if trx_id is bigger than the previous value.
[in,out] | block | Page |
[in,out] | page_zip | Compressed page whose uncompressed part will be updated, or NULL |
[in] | trx_id | Transaction id |
[in,out] | mtr | Mini-transaction |
ibool page_validate | ( | const page_t * | page, |
dict_index_t * | index | ||
) |
This function checks the consistency of an index page.
void page_warn_strict_checksum | ( | srv_checksum_algorithm_t | curr_algo, |
srv_checksum_algorithm_t | page_checksum, | ||
const page_id_t & | page_id | ||
) |
Issue a warning when the checksum that is stored in the page is valid, but different than the global setting innodb_checksum_algorithm.
[in] | curr_algo | current checksum algorithm |
[in] | page_checksum | page valid checksum |
[in] | page_id | page identifier |
|
static |
Data bytes of an infimum record.
|
static |
Extra bytes of an infimum record.
|
static |
Extra bytes and data bytes of a supremum record.