MySQL 5.6.14 Source Code Document
|
#include "page0page.h"
#include "page0cur.h"
#include "page0zip.h"
#include "buf0buf.h"
#include "btr0btr.h"
#include "srv0srv.h"
#include "lock0lock.h"
#include "fut0lst.h"
#include "btr0sea.h"
Go to the source code of this file.
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.
page | in: index page |
Definition at line 1927 of file page0page.cc.
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 a 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 |
Definition at line 655 of file page0page.cc.
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().
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 |
Definition at line 573 of file page0page.cc.
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 |
Definition at line 771 of file page0page.cc.
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 |
comp | in: nonzero=compact page format |
Definition at line 481 of file page0page.cc.
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 |
Definition at line 532 of file page0page.cc.
UNIV_INLINE void page_create_write_log | ( | buf_frame_t * | frame, |
mtr_t * | mtr, | ||
ibool | comp | ||
) |
Writes a log record of page creation.
frame | in: a buffer frame where the page is created |
mtr | in: mini-transaction handle |
comp | in: TRUE=compact page format |
Definition at line 284 of file page0page.cc.
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 |
Definition at line 497 of file page0page.cc.
UNIV_INTERN bool page_delete_rec | ( | const dict_index_t * | index, |
page_cur_t * | pcur, | ||
page_zip_des_t * | page_zip, | ||
const ulint * | offsets | ||
) |
Removes the record from a leaf page. This function does not log any changes. It is used by the IMPORT tablespace functions. The cursor is moved to the next record after the deleted one.
index | in: The index that the record belongs to |
pcur | in/out: page cursor on record to delete |
page_zip | in: compressed page descriptor |
offsets | in: offsets for record |
Definition at line 2733 of file page0page.cc.
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 |
Definition at line 977 of file page0page.cc.
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 |
Definition at line 1183 of file page0page.cc.
UNIV_INLINE void page_delete_rec_list_write_log | ( | rec_t * | rec, |
dict_index_t * | index, | ||
byte | type, | ||
mtr_t * | mtr | ||
) |
Writes a log record of a record list end or start deletion.
rec | in: record on page |
index | in: record descriptor |
type | in: operation type: MLOG_LIST_END_DELETE, ... |
mtr | in: mtr |
Definition at line 891 of file page0page.cc.
UNIV_INLINE void page_dir_add_slot | ( | page_t * | page, |
page_zip_des_t * | page_zip, | ||
ulint | start | ||
) |
Used to add n slots to the directory. Does not set the record pointers in the added slots or update n_owned values: this is the responsibility of the caller.
page | in/out: the index page |
page_zip | in/out: comprssed page, or NULL |
start | in: the slot above which the new slots are added |
Definition at line 1404 of file page0page.cc.
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 |
Definition at line 1494 of file page0page.cc.
UNIV_INLINE void page_dir_delete_slot | ( | page_t * | page, |
page_zip_des_t * | page_zip, | ||
ulint | slot_no | ||
) |
Used to delete n slots from the directory. This function updates also n_owned fields in the records, so that the first slot after the deleted ones inherits the records of the deleted slots.
page | in/out: the index page |
page_zip | in/out: compressed page, or NULL |
slot_no | in: slot to be deleted |
Definition at line 1355 of file page0page.cc.
UNIV_INTERN ulint page_dir_find_owner_slot | ( | const rec_t * | rec | ) |
Looks for the directory slot which owns the given record.
rec | in: the physical record |
Definition at line 92 of file page0page.cc.
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/out: index page |
page_zip | in/out: compressed page whose uncompressed part will be written, or NULL |
slot_no | in: the directory slot |
Definition at line 1431 of file page0page.cc.
UNIV_INTERN 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 |
heap_no | in: heap number |
Definition at line 2683 of file page0page.cc.
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 |
heap_no | out: this contains the heap number of the allocated record if allocation succeeds |
Definition at line 246 of file page0page.cc.
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 |
Definition at line 1270 of file page0page.cc.
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 |
Definition at line 1330 of file page0page.cc.
UNIV_INTERN byte* page_parse_create | ( | byte * | ptr, |
byte *end_ptr | __attribute__(unused), | ||
ulint | comp, | ||
buf_block_t * | block, | ||
mtr_t * | mtr | ||
) |
Parses a redo log record of creating a page.
ptr | in: buffer |
__attribute__ | in: buffer end |
comp | in: nonzero=compact page format |
block | in: block or NULL |
mtr | in: mtr or NULL |
Definition at line 304 of file page0page.cc.
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 |
mtr | in: mtr or NULL |
Definition at line 921 of file page0page.cc.
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.
rec | in: the physical record |
Definition at line 1618 of file page0page.cc.
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 |
Definition at line 1565 of file page0page.cc.
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.
rec | in: physical record |
offsets | in: record descriptor |
Definition at line 1683 of file page0page.cc.
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 |
offsets | in: array returned by rec_get_offsets() |
Definition at line 1879 of file page0page.cc.
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.
block | in/out: page |
page_zip | in/out: compressed page, or NULL |
trx_id | in: transaction id |
mtr | in/out: mini-transaction, or NULL |
Definition at line 210 of file page0page.cc.
UNIV_INTERN ibool page_simple_validate_new | ( | const page_t * | page | ) |
This function checks the consistency of an index page when we do not know the index. This is also resilient so that this should never crash even if the page is total garbage.
page | in: index page in ROW_FORMAT!=REDUNDANT |
Definition at line 2175 of file page0page.cc.
UNIV_INTERN ibool page_simple_validate_old | ( | const page_t * | page | ) |
This function checks the consistency of an index page when we do not know the index. This is also resilient so that this should never crash even if the page is total garbage.
page | in: index page in ROW_FORMAT=REDUNDANT |
Definition at line 1965 of file page0page.cc.
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 |
index | in: data dictionary index containing the page record type definition |
Definition at line 2384 of file page0page.cc.