InnoDB Plugin
1.0
|
#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"
#include "page0page.ic"
Go to the source code of this file.
Macros | |
#define | PAGE_HEADER |
#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 |
#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 |
#define | PAGE_DIRECTION 12 /* last insert direction: PAGE_LEFT, ... */ |
#define | PAGE_N_DIRECTION |
#define | PAGE_N_RECS 16 /* number of user records on the page */ |
#define | PAGE_MAX_TRX_ID |
#define | PAGE_HEADER_PRIV_END |
#define | PAGE_LEVEL |
#define | PAGE_INDEX_ID |
#define | PAGE_BTR_SEG_LEAF |
#define | PAGE_BTR_IBUF_FREE_LIST PAGE_BTR_SEG_LEAF |
#define | PAGE_BTR_IBUF_FREE_LIST_NODE PAGE_BTR_SEG_LEAF |
#define | PAGE_BTR_SEG_TOP (36 + FSEG_HEADER_SIZE) |
#define | PAGE_DATA (PAGE_HEADER + 36 + 2 * FSEG_HEADER_SIZE) |
#define | PAGE_OLD_INFIMUM (PAGE_DATA + 1 + REC_N_OLD_EXTRA_BYTES) |
#define | PAGE_OLD_SUPREMUM (PAGE_DATA + 2 + 2 * REC_N_OLD_EXTRA_BYTES + 8) |
#define | PAGE_OLD_SUPREMUM_END (PAGE_OLD_SUPREMUM + 9) |
#define | PAGE_NEW_INFIMUM (PAGE_DATA + REC_N_NEW_EXTRA_BYTES) |
#define | PAGE_NEW_SUPREMUM (PAGE_DATA + 2 * REC_N_NEW_EXTRA_BYTES + 8) |
#define | PAGE_NEW_SUPREMUM_END (PAGE_NEW_SUPREMUM + 8) |
#define | PAGE_HEAP_NO_INFIMUM 0 /* page infimum */ |
#define | PAGE_HEAP_NO_SUPREMUM 1 /* page supremum */ |
#define | PAGE_HEAP_NO_USER_LOW |
#define | PAGE_LEFT 1 |
#define | PAGE_RIGHT 2 |
#define | PAGE_SAME_REC 3 |
#define | PAGE_SAME_PAGE 4 |
#define | PAGE_NO_DIRECTION 5 |
#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) |
#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_header_t |
typedef byte | page_dir_slot_t |
typedef page_dir_slot_t | page_dir_t |
Functions | |
UNIV_INLINE page_t * | page_align (const void *ptr)) |
UNIV_INLINE ulint | page_offset (const void *ptr)) |
UNIV_INLINE trx_id_t | page_get_max_trx_id (const page_t *page) |
UNIV_INTERN void | page_set_max_trx_id (buf_block_t *block, page_zip_des_t *page_zip, trx_id_t trx_id, mtr_t *mtr) |
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) |
UNIV_INLINE ulint | page_header_get_field (const page_t *page, ulint field) |
UNIV_INLINE void | page_header_set_field (page_t *page, page_zip_des_t *page_zip, ulint field, ulint val) |
UNIV_INLINE ulint | page_header_get_offs (const page_t *page, ulint field)) |
UNIV_INLINE void | page_header_set_ptr (page_t *page, page_zip_des_t *page_zip, ulint field, const byte *ptr) |
UNIV_INLINE void | page_header_reset_last_insert (page_t *page, page_zip_des_t *page_zip, mtr_t *mtr) |
UNIV_INLINE ulint | page_get_infimum_offset (const page_t *page) |
UNIV_INLINE ulint | page_get_supremum_offset (const page_t *page) |
UNIV_INTERN const rec_t * | page_rec_get_nth_const (const page_t *page, ulint nth)) |
UNIV_INLINE rec_t * | page_rec_get_nth (page_t *page, ulint nth)) |
UNIV_INLINE rec_t * | page_get_middle_rec (page_t *page)) |
UNIV_INLINE int | page_cmp_dtuple_rec_with_match (const dtuple_t *dtuple, const rec_t *rec, const ulint *offsets, ulint *matched_fields, ulint *matched_bytes) |
UNIV_INLINE ulint | page_get_page_no (const page_t *page) |
UNIV_INLINE ulint | page_get_space_id (const page_t *page) |
UNIV_INLINE ulint | page_get_n_recs (const page_t *page) |
UNIV_INTERN ulint | page_rec_get_n_recs_before (const rec_t *rec) |
UNIV_INLINE ulint | page_dir_get_n_heap (const page_t *page) |
UNIV_INLINE void | page_dir_set_n_heap (page_t *page, page_zip_des_t *page_zip, ulint n_heap) |
UNIV_INLINE ulint | page_dir_get_n_slots (const page_t *page) |
UNIV_INLINE void | page_dir_set_n_slots (page_t *page, page_zip_des_t *page_zip, ulint n_slots) |
UNIV_INLINE page_dir_slot_t * | page_dir_get_nth_slot (const page_t *page, ulint n) |
UNIV_INLINE ibool | page_rec_check (const rec_t *rec) |
UNIV_INLINE const rec_t * | page_dir_slot_get_rec (const page_dir_slot_t *slot) |
UNIV_INLINE void | page_dir_slot_set_rec (page_dir_slot_t *slot, rec_t *rec) |
UNIV_INLINE ulint | page_dir_slot_get_n_owned (const page_dir_slot_t *slot) |
UNIV_INLINE void | page_dir_slot_set_n_owned (page_dir_slot_t *slot, page_zip_des_t *page_zip, ulint n) |
UNIV_INLINE ulint | page_dir_calc_reserved_space (ulint n_recs) |
UNIV_INTERN ulint | page_dir_find_owner_slot (const rec_t *rec) |
UNIV_INLINE ulint | page_is_comp (const page_t *page) |
UNIV_INLINE ulint | page_rec_is_comp (const rec_t *rec) |
UNIV_INLINE ulint | page_rec_get_heap_no (const rec_t *rec) |
UNIV_INLINE bool | page_is_leaf (const page_t *page)) |
UNIV_INLINE bool | page_is_empty (const page_t *page)) |
UNIV_INLINE bool | page_has_garbage (const page_t *page)) |
UNIV_INLINE const rec_t * | page_rec_get_next_low (const rec_t *rec, ulint comp) |
UNIV_INLINE rec_t * | page_rec_get_next (rec_t *rec) |
UNIV_INLINE const rec_t * | page_rec_get_next_const (const rec_t *rec) |
UNIV_INLINE const rec_t * | page_rec_get_next_non_del_marked (const rec_t *rec) |
UNIV_INLINE void | page_rec_set_next (rec_t *rec, const rec_t *next) |
UNIV_INLINE const rec_t * | page_rec_get_prev_const (const rec_t *rec) |
UNIV_INLINE rec_t * | page_rec_get_prev (rec_t *rec) |
UNIV_INLINE ibool | page_rec_is_user_rec_low (ulint offset)) |
UNIV_INLINE ibool | page_rec_is_supremum_low (ulint offset)) |
UNIV_INLINE ibool | page_rec_is_infimum_low (ulint offset)) |
UNIV_INLINE ibool | page_rec_is_user_rec (const rec_t *rec)) |
UNIV_INLINE ibool | page_rec_is_supremum (const rec_t *rec)) |
UNIV_INLINE ibool | page_rec_is_infimum (const rec_t *rec)) |
UNIV_INLINE rec_t * | page_rec_find_owner_rec (rec_t *rec) |
UNIV_INLINE void | page_rec_write_field (rec_t *rec, ulint i, ulint val, mtr_t *mtr)) |
UNIV_INLINE ulint | page_get_max_insert_size (const page_t *page, ulint n_recs) |
UNIV_INLINE ulint | page_get_max_insert_size_after_reorganize (const page_t *page, ulint n_recs) |
UNIV_INLINE ulint | page_get_free_space_of_empty (ulint comp)) |
UNIV_INLINE ulint | page_rec_get_base_extra_size (const rec_t *rec) |
UNIV_INLINE ulint | page_get_data_size (const page_t *page) |
UNIV_INLINE void | page_mem_alloc_free (page_t *page, page_zip_des_t *page_zip, rec_t *next_rec, ulint need) |
UNIV_INTERN byte * | page_mem_alloc_heap (page_t *page, page_zip_des_t *page_zip, ulint need, ulint *heap_no) |
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) |
UNIV_INTERN page_t * | page_create (buf_block_t *block, mtr_t *mtr, ulint comp) |
UNIV_INTERN page_t * | page_create_zip (buf_block_t *block, dict_index_t *index, ulint level, trx_id_t max_trx_id, mtr_t *mtr)) |
UNIV_INTERN void | page_create_empty (buf_block_t *block, dict_index_t *index, mtr_t *mtr))) |
UNIV_INTERN 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) |
UNIV_INTERN 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)) |
UNIV_INTERN 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)) |
UNIV_INTERN 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)) |
UNIV_INTERN void | page_delete_rec_list_start (rec_t *rec, buf_block_t *block, dict_index_t *index, mtr_t *mtr)) |
UNIV_INTERN 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))) |
UNIV_INTERN 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))) |
UNIV_INTERN void | page_dir_split_slot (page_t *page, page_zip_des_t *page_zip, ulint slot_no))) |
UNIV_INTERN void | page_dir_balance_slot (page_t *page, page_zip_des_t *page_zip, ulint slot_no))) |
UNIV_INTERN byte * | page_parse_delete_rec_list (byte type, byte *ptr, byte *end_ptr, buf_block_t *block, dict_index_t *index, mtr_t *mtr) |
UNIV_INTERN byte * | page_parse_create (byte *ptr, byte *end_ptr, ulint comp, buf_block_t *block, mtr_t *mtr) |
UNIV_INTERN void | page_rec_print (const rec_t *rec, const ulint *offsets) |
UNIV_INTERN ibool | page_rec_validate (const rec_t *rec, const ulint *offsets) |
UNIV_INTERN void | page_check_dir (const page_t *page) |
UNIV_INTERN ibool | page_simple_validate_old (const page_t *page) |
UNIV_INTERN ibool | page_simple_validate_new (const page_t *page) |
UNIV_INTERN ibool | page_validate (const page_t *page, dict_index_t *index) |
const rec_t * | page_find_rec_with_heap_no (const page_t *page, ulint heap_no) |
const rec_t * | page_find_rec_max_not_deleted (const page_t *page) |
Index page routines
Created 2/2/1994 Heikki Tuuri
#define PAGE_BTR_SEG_LEAF |
#define PAGE_HEADER |
#define page_header_get_ptr | ( | page, | |
field | |||
) |
Returns the pointer stored in the given header field, or NULL.
#define PAGE_HEADER_PRIV_END |
#define PAGE_HEAP_NO_USER_LOW |
#define PAGE_INDEX_ID |
#define PAGE_LAST_INSERT |
#define PAGE_LEVEL |
#define PAGE_MAX_TRX_ID |
#define PAGE_N_DIRECTION |
#define PAGE_N_HEAP |
UNIV_INLINE page_t* page_align | ( | const void * | ptr | ) |
Gets the start of a page.
ptr | in: pointer to page frame |
UNIV_INTERN 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
UNIV_INLINE int page_cmp_dtuple_rec_with_match | ( | const dtuple_t * | dtuple, |
const rec_t * | rec, | ||
const ulint * | offsets, | ||
ulint * | matched_fields, | ||
ulint * | matched_bytes | ||
) |
Compares a data tuple to a physical record. Differs from the function cmp_dtuple_rec_with_match in the way that the record must reside on an index page, and also page infimum and supremum records can be given in the parameter rec. These are considered as the negative infinity and the positive infinity in the alphabetical order.
Compares a data tuple to a physical record. Differs from the function cmp_dtuple_rec_with_match in the way that the record must reside on an index page, and also page infimum and supremum records can be given in the parameter rec. These are considered as the negative infinity and the positive infinity in the alphabetical order.
dtuple | in: data tuple |
rec | in: physical record on a page; may also be page infimum or supremum, in which case matched-parameter values below are not affected |
offsets | in: array returned by rec_get_offsets() |
matched_fields | in/out: number of already completely matched fields; when function returns contains the value for current comparison |
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 |
UNIV_INTERN 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().
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 |
UNIV_INTERN 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
new_block | in: index page to copy to |
block | in: index page of rec |
rec | in: record on page |
index | in: record descriptor |
UNIV_INTERN 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().
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 |
UNIV_INTERN page_t* page_create | ( | buf_block_t * | block, |
mtr_t * | mtr, | ||
ulint | comp | ||
) |
Create an uncompressed B-tree index page.
block | in: a buffer block where the page is created |
mtr | in: mini-transaction handle |
UNIV_INTERN void page_create_empty | ( | buf_block_t * | block, |
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Empty a previously created B-tree index page.
block | in/out: B-tree block |
index | in: the index of the page |
mtr | in/out: mini-transaction |
UNIV_INTERN page_t* page_create_zip | ( | buf_block_t * | block, |
dict_index_t * | index, | ||
ulint | level, | ||
trx_id_t | max_trx_id, | ||
mtr_t * | mtr | ||
) |
Create a compressed B-tree index page.
block | in/out: a buffer frame where the page is created |
index | in: the index of the page |
level | in: the B-tree level of the page |
max_trx_id | in: PAGE_MAX_TRX_ID |
mtr | in/out: mini-transaction |
UNIV_INTERN 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.
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 |
UNIV_INTERN 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.
rec | in: record on page |
block | in: buffer block of the page |
index | in: record descriptor |
mtr | in: mtr |
UNIV_INTERN 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.
page | in/out: index page |
page_zip | in/out: compressed page, or NULL |
slot_no | in: 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
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 |
UNIV_INTERN 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.
Gets the number of records in the heap.
page | in: index page |
UNIV_INLINE ulint page_dir_get_n_slots | ( | const page_t * | page | ) |
Gets the number of dir slots in directory.
Gets the number of dir slots in directory.
page | in: index page |
UNIV_INLINE page_dir_slot_t* page_dir_get_nth_slot | ( | const page_t * | page, |
ulint | n | ||
) |
Gets pointer to nth directory slot.
Gets pointer to nth directory slot.
page | in: index page |
n | in: 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: number of records
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 |
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: number of slots
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 |
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.
Gets the number of records owned by a directory slot.
slot | in: page 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.
Gets the record pointed to by a directory slot.
slot | in: 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: number of records owned by the slot
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 |
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: record on the page
This is used to set the record offset in a directory slot.
slot | in: directory slot |
rec | in: record on the page |
UNIV_INTERN 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.
page | in: index page |
page_zip | in/out: compressed page whose uncompressed part will be written, or NULL |
slot_no | in: the directory slot |
const rec_t* page_find_rec_max_not_deleted | ( | const page_t * | page | ) |
Get the last non-delete-marked record on a page.
[in] | page | index tree leaf page |
infimum | record if all records are delete-marked |
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.
page | in: index page |
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.
Returns the sum of the sizes of the records in the record list, excluding the infimum and supremum records.
page | in: index page |
UNIV_INLINE ulint page_get_free_space_of_empty | ( | ulint | comp | ) |
Calculates free space if a page is emptied.
comp | in: nonzero=compact page layout |
UNIV_INLINE ulint page_get_infimum_offset | ( | const page_t * | page | ) |
Gets the offset of the first record on the page.
Gets the offset of the first record on the page.
page | in: page which must have record(s) |
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.
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 |
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.
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. in: page
Returns the max trx id field value.
page | in: page |
UNIV_INLINE rec_t* page_get_middle_rec | ( | page_t * | 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 number of user records on page (infimum and supremum records are not user records).
page | in: index page |
UNIV_INLINE ulint page_get_page_no | ( | const page_t * | page | ) |
Gets the page number.
Gets the page number.
page | in: page |
UNIV_INLINE ulint page_get_space_id | ( | const page_t * | page | ) |
Gets the tablespace identifier.
Gets the tablespace identifier.
page | in: page |
UNIV_INLINE ulint page_get_supremum_offset | ( | const page_t * | page | ) |
Gets the offset of the last record on the page.
Gets the offset of the last record on the page.
page | in: page which must have record(s) |
UNIV_INLINE bool page_has_garbage | ( | const page_t * | 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_N_DIR_SLOTS, ...
Reads the given header field.
page | in: page |
field | in: PAGE_LEVEL, ... |
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: mtr
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 |
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: value
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 |
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: pointer or NULL
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 |
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 in new-style compact format.
page | in: index page |
UNIV_INLINE bool page_is_empty | ( | const page_t * | page | ) |
Determine whether the page is empty.
page | in: page |
UNIV_INLINE bool page_is_leaf | ( | const page_t * | page | ) |
Determine whether the page is a B-tree leaf.
page | in: page |
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: number of bytes allocated
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 |
UNIV_INTERN 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 |
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: array returned by rec_get_offsets()
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() |
UNIV_INTERN 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().
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 |
UNIV_INTERN 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().
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 |
UNIV_INLINE ulint page_offset | ( | const void * | ptr | ) |
Gets the offset within a page.
ptr | in: pointer to page frame |
UNIV_INTERN byte* page_parse_create | ( | byte * | ptr, |
byte * | end_ptr, | ||
ulint | comp, | ||
buf_block_t * | block, | ||
mtr_t * | mtr | ||
) |
Parses a redo log record of creating a page.
ptr | in: buffer |
end_ptr | in: buffer end |
comp | in: nonzero=compact page format |
block | in: block or NULL |
UNIV_INTERN byte* page_parse_delete_rec_list | ( | byte | 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 |
UNIV_INLINE ibool page_rec_check | ( | const rec_t * | rec | ) |
Used to check the consistency of a record on a page.
Used to check the consistency of a record on a page.
rec | in: record |
UNIV_INLINE rec_t* page_rec_find_owner_rec | ( | rec_t * | rec | ) |
Looks for the record which owns the given record.
Looks for the record which owns the given record.
rec | in: the physical 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.
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 |
UNIV_INLINE ulint page_rec_get_heap_no | ( | const rec_t * | rec | ) |
Returns the heap number of a record.
Returns the heap number of a record.
rec | in: the physical record |
UNIV_INTERN 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().
UNIV_INLINE rec_t* page_rec_get_next | ( | rec_t * | rec | ) |
Gets the pointer to the next record on the page.
Gets the pointer to the next record on the page.
rec | in: pointer to record |
UNIV_INLINE const rec_t* page_rec_get_next_const | ( | const rec_t * | rec | ) |
Gets the pointer to the next record on the page.
Gets the pointer to the next record on the page.
rec | in: pointer to record |
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.
Gets the pointer to the next record on the page.
rec | in: pointer to record |
comp | in: nonzero=compact page layout |
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. If all subsequent records are delete-marked, then this function will return the supremum record.
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 |
UNIV_INLINE rec_t* page_rec_get_nth | ( | page_t * | page, |
ulint | nth | ||
) |
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 |
UNIV_INTERN const rec_t* page_rec_get_nth_const | ( | const page_t * | page, |
ulint | nth | ||
) |
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 |
UNIV_INLINE rec_t* page_rec_get_prev | ( | rec_t * | rec | ) |
Gets the pointer to the previous record.
Gets the pointer to the previous record.
rec | in: pointer to record, must not be page infimum |
UNIV_INLINE const rec_t* page_rec_get_prev_const | ( | const rec_t * | rec | ) |
Gets the pointer to the previous record.
Gets the pointer to the previous record.
rec | in: pointer to record, must not be page infimum |
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 on a page in compact format.
rec | in: record |
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.
offset | in: record offset on 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.
offset | in: 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.
offset | in: record offset on page |
UNIV_INTERN 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: record descriptor
rec | in: physical record |
UNIV_INLINE void page_rec_set_next | ( | rec_t * | rec, |
const rec_t * | next | ||
) |
Sets the pointer to the next record on the page. in: pointer to next record, must not be page infimum
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 |
UNIV_INTERN 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.
rec | in: physical record |
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.
rec | in/out: record to update |
i | in: index of the field to update |
val | in: value to write |
mtr | in/out: mini-transaction |
UNIV_INTERN 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: mini-transaction, or NULL
block | in/out: page |
page_zip | in/out: compressed page, or NULL |
trx_id | in: transaction id |
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 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.
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: mini-transaction
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 |
UNIV_INTERN ibool page_validate | ( | const page_t * | page, |
dict_index_t * | index | ||
) |
This function checks the consistency of an index page.
page | in: index page |