InnoDB Plugin
1.0
|
#include "mach0data.h"
#include "log0recv.h"
#include "rem0cmp.h"
#include "mtr0log.h"
#include "page0zip.h"
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_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_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 ulint | page_get_infimum_offset (const page_t *page) |
UNIV_INLINE ulint | page_get_supremum_offset (const page_t *page) |
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_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_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 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 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_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 rec_t * | page_rec_find_owner_rec (rec_t *rec) |
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_INLINE ulint | page_get_free_space_of_empty (ulint comp) |
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 void | page_mem_free (page_t *page, page_zip_des_t *page_zip, rec_t *rec, const dict_index_t *index, const ulint *offsets) |
Index page routines
Created 2/2/1994 Heikki Tuuri
UNIV_INLINE page_t* page_align | ( | const void * | ptr | ) |
Gets the start of a page.
ptr | in: pointer to page frame |
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.
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_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.
n_recs | in: number of records |
UNIV_INLINE ulint page_dir_get_n_heap | ( | const page_t * | page | ) |
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.
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.
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.
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.
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.
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.
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.
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.
slot | in: directory slot |
rec | in: record on the 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.
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.
page | in: page which must have record(s) |
UNIV_INLINE 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. 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 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 |
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 (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.
page | in: page |
UNIV_INLINE ulint page_get_space_id | ( | const page_t * | page | ) |
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.
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.
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.
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.
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.
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.
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 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_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.
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_INLINE ulint page_offset | ( | const void * | ptr | ) |
Gets the offset within a page.
ptr | in: pointer to page frame |
UNIV_INLINE ibool page_rec_check | ( | const rec_t * | rec | ) |
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.
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.
rec | in: physical record |
UNIV_INLINE ulint page_rec_get_heap_no | ( | const rec_t * | rec | ) |
Returns the heap number of a record.
rec | in: the physical record |
UNIV_INLINE rec_t* page_rec_get_next | ( | rec_t * | rec | ) |
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.
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.
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.
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_INLINE rec_t* page_rec_get_prev | ( | rec_t * | rec | ) |
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.
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.
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_INLINE void page_rec_set_next | ( | rec_t * | rec, |
const rec_t * | next | ||
) |
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_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_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.
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 |