MySQL 8.0.39
Source Code Documentation
|
Index page routines. More...
#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.
Typedefs | |
typedef byte | page_dir_slot_t |
typedef page_dir_slot_t | page_dir_t |
Functions | |
static page_t * | page_align (const void *ptr) |
Gets the start of a page. More... | |
static ulint | page_offset (const void *ptr) |
Gets the offset within a page. More... | |
static 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... | |
static 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... | |
static node_seq_t | page_get_ssn_id (const page_t *page) |
Returns the RTREE SPLIT SEQUENCE NUMBER (FIL_RTREE_SPLIT_SEQ_NUM). More... | |
static 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... | |
static uint16_t | page_header_get_field (const page_t *page, ulint field) |
Reads the given header field. More... | |
static void | page_header_set_field (page_t *page, page_zip_des_t *page_zip, ulint field, ulint val) |
Sets the given header field. More... | |
static ulint | page_header_get_offs (const page_t *page, ulint field) |
Returns the offset stored in the given header field. More... | |
static byte * | page_header_get_ptr (page_t *page, uint32_t field) |
Returns the pointer stored in the given header field, or NULL. More... | |
static const byte * | page_header_get_ptr (const page_t *page, uint32_t field) |
static 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... | |
static 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... | |
static ulint | page_get_infimum_offset (const page_t *page) |
Gets the offset of the first record on the page. More... | |
static ulint | page_get_supremum_offset (const page_t *page) |
Gets the offset of the last record on the page. More... | |
static byte * | page_get_infimum_rec (byte *page) |
static const byte * | page_get_infimum_rec (const byte *page) |
static byte * | page_get_supremum_rec (byte *page) |
static const byte * | page_get_supremum_rec (const byte *page) |
const rec_t * | page_rec_get_nth_const (const page_t *page, ulint nth) |
Returns the nth record of the record list. More... | |
static rec_t * | page_rec_get_nth (page_t *page, ulint nth) |
Returns the nth record of the record list. More... | |
static rec_t * | page_get_middle_rec (page_t *page) |
Returns the middle record of the records on the page. More... | |
static page_no_t | page_get_page_no (const page_t *page) |
Gets the page number. More... | |
static space_id_t | page_get_space_id (const page_t *page) |
Gets the tablespace identifier. More... | |
static page_id_t | page_get_page_id (const page_t *page) |
Gets the space id and page number identifying the page. More... | |
static 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... | |
static uint16_t | page_dir_get_n_heap (const page_t *page) |
Gets the number of records in the heap. More... | |
static 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... | |
static ulint | page_dir_get_n_slots (const page_t *page) |
Gets the number of dir slots in directory. More... | |
static 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... | |
static page_dir_slot_t * | page_dir_get_nth_slot (const page_t *page, ulint n) |
Gets pointer to nth directory slot. More... | |
static bool | page_rec_check (const rec_t *rec) |
Used to check the consistency of a record on a page. More... | |
static const rec_t * | page_dir_slot_get_rec (const page_dir_slot_t *slot) |
Gets the record pointed to by a directory slot. More... | |
static 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... | |
static ulint | page_dir_slot_get_n_owned (const page_dir_slot_t *slot) |
Gets the number of records owned by a directory slot. More... | |
static 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... | |
static 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... | |
static bool | page_is_comp (const page_t *page) |
Determine whether the page is in new-style compact format. More... | |
static bool | page_rec_is_comp (const rec_t *rec) |
true if the record is on a page in compact format. More... | |
static ulint | page_rec_get_heap_no (const rec_t *rec) |
Returns the heap number of a record. More... | |
static bool | page_is_leaf (const page_t *page) |
Determine whether the page is a B-tree leaf. More... | |
static bool | page_is_empty (const page_t *page) |
Determine whether the page is empty. More... | |
static bool | page_is_root (const page_t *page) |
Determine whether a page is an index root page. More... | |
static bool | page_has_garbage (const page_t *page) |
Determine whether the page contains garbage. More... | |
static 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... | |
static rec_t * | page_rec_get_next (rec_t *rec) |
Gets the pointer to the next record on the page. More... | |
static const rec_t * | page_rec_get_next_const (const rec_t *rec) |
Gets the pointer to the next record on the page. More... | |
static 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... | |
static void | page_rec_set_next (rec_t *rec, const rec_t *next) |
Sets the pointer to the next record on the page. More... | |
static const rec_t * | page_rec_get_prev_const (const rec_t *rec) |
Gets the pointer to the previous record. More... | |
static rec_t * | page_rec_get_prev (rec_t *rec) |
Gets the pointer to the previous record. More... | |
static bool | page_rec_is_user_rec_low (ulint offset) |
true if the record is a user record on the page. More... | |
static bool | page_rec_is_supremum_low (ulint offset) |
true if the record is the supremum record on a page. More... | |
static bool | page_rec_is_infimum_low (ulint offset) |
true if the record is the infimum record on a page. More... | |
static bool | page_rec_is_user_rec (const rec_t *rec) |
true if the record is a user record on the page. More... | |
static bool | page_rec_is_supremum (const rec_t *rec) |
true if the record is the supremum record on a page. More... | |
static bool | page_rec_is_infimum (const rec_t *rec) |
true if the record is the infimum record on a page. More... | |
static 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... | |
static 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... | |
static 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... | |
static 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... | |
static 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... | |
static rec_t * | page_rec_find_owner_rec (rec_t *rec) |
Looks for the record which owns the given record. More... | |
static 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... | |
static 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... | |
static ulint | page_get_free_space_of_empty (bool comp) |
Calculates free space if a page is emptied. More... | |
static ulint | page_rec_get_base_extra_size (const rec_t *rec) |
Returns the base extra size of a physical record. More... | |
static 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... | |
static 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... | |
static 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... | |
bool | 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... | |
bool | 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... | |
bool | 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... | |
bool | 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... | |
bool | 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... | |
bool | 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 | |
constexpr uint32_t | PAGE_DIR = FIL_PAGE_DATA_END |
constexpr uint32_t | PAGE_DIR_SLOT_SIZE = 2 |
constexpr uint32_t | PAGE_EMPTY_DIR_START = PAGE_DIR + 2 * PAGE_DIR_SLOT_SIZE |
constexpr uint32_t | PAGE_DIR_SLOT_MAX_N_OWNED = 8 |
constexpr uint32_t | PAGE_DIR_SLOT_MIN_N_OWNED = 4 |
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
typedef byte page_dir_slot_t |
typedef page_dir_slot_t page_dir_t |
|
inlinestatic |
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.
page | in: index page |
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().
new_block | in/out: index page to copy to |
block | in: index page containing rec |
rec | in: record on page |
index | in: record descriptor |
mtr | in: mtr |
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().
new_block | in: index page to copy to |
block | in: index page of rec |
rec | in: record on page |
index | in: record descriptor |
mtr | in: mtr |
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().
new_block | in/out: index page to copy to |
block | in: index page containing rec |
rec | in: record on page |
index | in: record descriptor |
mtr | in: mtr |
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.
rec | in: pointer to record on page |
block | in: buffer block of the page |
index | in: record descriptor |
n_recs | in: number of records to delete, or ULINT_UNDEFINED if not known |
size | in: the sum of the sizes of the records in the end of the chain to delete, or ULINT_UNDEFINED if not known |
mtr | in: mtr |
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.
rec | in: record on page |
block | in: buffer block of the page |
index | in: record descriptor |
mtr | in: mtr |
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 |
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
Looks for the directory slot which owns the given record.
rec | in: the physical record |
|
inlinestatic |
Gets the number of records in the heap.
[in] | page | index page |
Gets the number of dir slots in directory.
|
inlinestatic |
Gets pointer to nth directory slot.
[in] | page | index page |
[in] | n | position |
|
inlinestatic |
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 |
|
inlinestatic |
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 |
|
inlinestatic |
Gets the number of records owned by a directory slot.
|
inlinestatic |
Gets the record pointed to by a directory slot.
|
inlinestatic |
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 |
|
inlinestatic |
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.
page | in: index page |
heap_no | in: heap number |
Returns the sum of the sizes of the records in the record list excluding the infimum and supremum records.
|
inlinestatic |
Calculates free space if a page is emptied.
[in] | comp | nonzero=compact page format |
Gets the offset of the first record on the page.
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 |
|
inlinestatic |
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.
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.
|
inlinestatic |
Gets the tablespace identifier.
|
inlinestatic |
Returns the RTREE SPLIT SEQUENCE NUMBER (FIL_RTREE_SPLIT_SEQ_NUM).
[in] | page | page |
Gets the offset of the last record on the page.
|
inlinestatic |
Determine whether the page contains garbage.
Reads the given header field.
[in] | page | page |
[in] | field | PAGE_N_DIR_SLOTS, ... |
Returns the offset stored in the given header field.
[in] | page | Page. |
[in] | field | PAGE_FREE, ... |
Returns the pointer stored in the given header field, or NULL.
|
inlinestatic |
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 |
|
inlinestatic |
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 |
|
inlinestatic |
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 |
|
inlinestatic |
Determine whether the page is in new-style compact format.
|
inlinestatic |
Determine whether the page is empty.
|
inlinestatic |
Determine whether the page is a B-tree leaf.
|
inlinestatic |
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
|
inlinestatic |
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.
page | in/out: index page |
page_zip | in/out: compressed page with enough space available for inserting the record, or NULL |
need | in: total number of bytes needed |
heap_no | out: this contains the heap number of the allocated record if allocation succeeds |
|
inlinestatic |
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() |
bool 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().
new_block | in/out: index page where to move |
block | in: index page from where to move |
split_rec | in: first record to move |
index | in: record descriptor |
mtr | in: mtr |
bool 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().
new_block | in/out: index page where to move |
block | in/out: page containing split_rec |
split_rec | in: first record not to move |
index | in: record descriptor |
mtr | in: mtr |
|
inlinestatic |
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.
type | in: MLOG_LIST_END_DELETE, MLOG_LIST_START_DELETE, MLOG_COMP_LIST_END_DELETE or MLOG_COMP_LIST_START_DELETE |
ptr | in: buffer |
end_ptr | in: buffer end |
block | in/out: buffer block or NULL |
index | in: record descriptor |
mtr | in: mtr or NULL |
|
inlinestatic |
Used to check the consistency of a record on a page.
|
inlinestatic |
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.
Returns the base extra size of a physical record.
This is the size of the fixed header, independent of the record size.
Returns the heap number of a record.
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.
rec | in: the physical record |
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().
This is the inverse function of page_rec_get_n_recs_before().
page | in: page |
nth | in: nth record |
Gets the pointer to the previous record.
Gets the pointer to the previous record.
|
inlinestatic |
true if the record is on a page in compact format.
true if the record is the first user record on a page.
[in] | rec | Record. |
[in] | page | Page. |
|
inlinestatic |
true if the record is the infimum record on a page.
|
inlinestatic |
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.
[in] | rec | Record. |
[in] | page | Page. |
true if the record is the second user record on a page.
[in] | rec | Record. |
[in] | page | Page. |
true if the record is the second last user record on a page.
[in] | rec | Record. |
[in] | page | Page. |
|
inlinestatic |
true if the record is the supremum record on a page.
|
inlinestatic |
true if the record is the supremum record on a page.
[in] | offset | record offset on page |
|
inlinestatic |
true if the record is a user record on the page.
|
inlinestatic |
true if the record is a user record on the page.
[in] | offset | record offset on page |
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 |
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.
rec | in: physical record |
offsets | in: array returned by rec_get_offsets() |
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 |
|
inlinestatic |
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 |
bool 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.
page | in: index page in ROW_FORMAT!=REDUNDANT |
bool 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.
page | in: index page in ROW_FORMAT=REDUNDANT |
|
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 |
|
inlinestatic |
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 |
bool page_validate | ( | const page_t * | page, |
dict_index_t * | index | ||
) |
This function checks the consistency of an index page.
[in] | page | index page |
[in] | index | data dictionary index containing the page record type definition |
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.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
static |
Extra bytes and data bytes of a supremum record.