MySQL 8.4.2
Source Code Documentation
|
Index page routines. More...
#include "mach0data.h"
#include "log0recv.h"
#include "rem0cmp.h"
#include "mtr0log.h"
#include "page0zip.h"
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... | |
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 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) |
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 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 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 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) |
static bool | page_rec_is_second (const rec_t *rec, const page_t *page) |
static bool | page_rec_is_last (const rec_t *rec, const page_t *page) |
static bool | page_rec_distance_is_at_most (const rec_t *left_rec, const rec_t *right_rec, ulint val) |
static bool | page_rec_is_second_last (const rec_t *rec, const page_t *page) |
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) |
static ulint | page_get_n_recs (const page_t *page) |
Gets the number of user records on page (infimum and supremum records are not user records). 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 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 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... | |
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 rec_t * | page_rec_find_owner_rec (rec_t *rec) |
Looks for the record which owns the given record. 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 free list of an index page. More... | |
static ulint | page_get_free_space_of_empty (bool comp) |
Calculates free space if a page is emptied. More... | |
static ulint | page_get_max_insert_size (const page_t *page, ulint n_recs) |
Each user record on a page, and also the deleted user records in the heap takes its size plus the fraction of the dir cell size / PAGE_DIR_SLOT_MIN_N_OWNED bytes for it. 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 the record heap if a page is first reorganized. 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... | |
ulong | page_size_validate (ulong page_size) |
Check that a page_size is correct for InnoDB. More... | |
Index page routines.
Created 2/2/1994 Heikki Tuuri
|
inlinestatic |
Gets the start of a page.
ptr | in: pointer to page frame |
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.
n_recs | in: number of records |
Gets the number of dir slots in directory.
page | in: index page |
|
inlinestatic |
Gets pointer to nth directory slot.
page | in: index page |
n | in: position |
|
inlinestatic |
Sets the number of records in the heap.
page | in/out: index page |
page_zip | in/out: 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. |
n_heap | in: number of records |
|
inlinestatic |
Sets the number of dir slots in directory.
page | in/out: page |
page_zip | in/out: compressed page whose uncompressed part will be updated, or NULL |
n_slots | in: number of slots |
|
inlinestatic |
Gets the number of records owned by a directory slot.
slot | in: page directory slot |
|
inlinestatic |
Gets the record pointed to by a directory slot.
slot | in: directory slot |
|
inlinestatic |
This is used to set the owned records field of a directory slot.
slot | in/out: directory slot |
page_zip | in/out: compressed page, or NULL |
n | in: number of records owned by the slot |
|
inlinestatic |
This is used to set the record offset in a directory slot.
slot | in: directory slot |
rec | in: record on the page |
Returns the sum of the sizes of the records in the record list, excluding the infimum and supremum records.
page | in: index page |
|
inlinestatic |
Calculates free space if a page is emptied.
comp | in: nonzero=compact page layout |
Gets the offset of the first record on the page.
page | in: page which must have record(s) |
Each user record on a page, and also the deleted user records in the heap takes its size plus the fraction of the dir cell size / PAGE_DIR_SLOT_MIN_N_OWNED bytes for it.
If the sum of these exceeds the value of page_get_free_space_of_empty, the insert is impossible, otherwise it is allowed. This function returns the maximum combined size of records which can be inserted on top of the record heap.
page | in: index page |
n_recs | in: number of records |
|
inlinestatic |
Returns the maximum combined size of records which can be inserted on top of the record heap if a page is first reorganized.
page | in: index page |
n_recs | in: number of records |
Returns the max trx id field value.
page | 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 |
Gets the number of user records on page (infimum and supremum records are not user records).
page | in: index page |
Gets the page number.
page | in: page |
|
inlinestatic |
Gets the tablespace identifier.
page | in: page |
|
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.
page | in: page which must have record(s) |
|
inlinestatic |
Determine whether the page contains garbage.
page | in: page |
|
inlinestatic |
Resets the last insert info field in the page header.
Writes to mlog about this operation.
page | in/out: page |
page_zip | in/out: compressed page whose uncompressed part will be updated, or NULL |
mtr | in: mtr |
|
inlinestatic |
Sets the given header field.
page | in/out: page |
page_zip | in/out: compressed page whose uncompressed part will be updated, or NULL |
field | in: PAGE_N_DIR_SLOTS, ... |
val | in: value |
|
inlinestatic |
Sets the pointer stored in the given header field.
page | in: page |
page_zip | in/out: compressed page whose uncompressed part will be updated, or NULL |
field | in: PAGE_FREE, ... |
ptr | in: pointer or NULL |
|
inlinestatic |
Determine whether the page is in new-style compact format.
page | in: index page |
|
inlinestatic |
Determine whether the page is empty.
page | in: page |
|
inlinestatic |
Determine whether the page is a B-tree leaf.
page | in: page |
|
inlinestatic |
Determine whether a page is an index root page.
[in] | page | page frame |
|
inlinestatic |
Allocates a block of memory from the free list 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 |
next_rec | in: pointer to the new head of the free record list |
need | in: number of bytes allocated |
|
inlinestatic |
Puts a record to free list.
page | in/out: index page |
page_zip | in/out: compressed page, or NULL |
rec | in: pointer to the (origin of) record |
index | in: index of rec |
offsets | in: array returned by rec_get_offsets() |
|
inlinestatic |
Gets the offset within a page.
ptr | in: pointer to page frame |
|
inlinestatic |
Used to check the consistency of a record on a page.
rec | in: record |
|
inlinestatic |
Looks for the record which owns the given record.
rec | in: the physical record |
Returns the base extra size of a physical record.
This is the size of the fixed header, independent of the record size.
rec | in: physical record |
Returns the heap number of a record.
rec | in: the physical record |
Gets the pointer to the next record on the page.
rec | in: pointer to record |
Gets the pointer to the next record on the page.
rec | in: pointer to record |
Gets the pointer to the next record on the page.
rec | in: pointer to record |
comp | in: 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.
rec | in: pointer to record |
Returns the nth record of the record list.
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.
rec | in: pointer to record, must not be page infimum |
Gets the pointer to the previous record.
rec | in: pointer to record, must not be page infimum |
|
inlinestatic |
true if the record is on a page in compact format.
rec | in: record |
|
inlinestatic |
true if the record is the infimum record on a page.
rec | in: record |
|
inlinestatic |
true if the record is the infimum record on a page.
offset | in: record offset on page |
|
inlinestatic |
true if the record is the supremum record on a page.
rec | in: record |
|
inlinestatic |
true if the record is the supremum record on a page.
offset | in: record offset on page |
|
inlinestatic |
true if the record is a user record on the page.
rec | in: record |
|
inlinestatic |
true if the record is a user record on the page.
offset | in: record offset on page |
Sets the pointer to the next record on the page.
rec | in: pointer to record, must not be page supremum |
next | in: pointer to next record, must not be page infimum |
|
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 | Transaction id |
[in,out] | mtr | Mini-transaction |
|
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.
block | in/out: page |
page_zip | in/out: compressed page whose uncompressed part will be updated, or NULL |
trx_id | in: transaction id |
mtr | in/out: mini-transaction |