#include "univ.i"
#include "dict0dict.h"
#include "data0data.h"
#include "page0cur.h"
#include "mtr0mtr.h"
#include "btr0types.h"
#include "btr0btr.ic"
Go to the source code of this file.
Defines | |
#define | BTR_PAGE_MAX_REC_SIZE (UNIV_PAGE_SIZE / 2 - 200) |
#define | BTR_MAX_LEVELS 100 |
Maximum depth of a B-tree in InnoDB. | |
#define | BTR_INSERT 512 |
#define | BTR_ESTIMATE 1024 |
#define | BTR_IGNORE_SEC_UNIQUE 2048 |
#define | BTR_DELETE_MARK 4096 |
#define | BTR_DELETE 8192 |
#define | btr_block_get(space, zip_size, page_no, mode, mtr) btr_block_get_func(space,zip_size,page_no,mode,__FILE__,__LINE__,mtr) |
#define | btr_page_get(space, zip_size, page_no, mode, mtr) buf_block_get_frame(btr_block_get(space,zip_size,page_no,mode,mtr)) |
#define | btr_insert_on_non_leaf_level(i, l, t, m) btr_insert_on_non_leaf_level_func(i,l,t,__FILE__,__LINE__,m) |
#define | BTR_N_LEAF_PAGES 1 |
#define | BTR_TOTAL_SIZE 2 |
Enumerations | |
enum | btr_latch_mode { BTR_SEARCH_LEAF = RW_S_LATCH, BTR_MODIFY_LEAF = RW_X_LATCH, BTR_NO_LATCHES = RW_NO_LATCH, BTR_MODIFY_TREE = 33, BTR_CONT_MODIFY_TREE = 34, BTR_SEARCH_PREV = 35, BTR_MODIFY_PREV = 36 } |
Functions | |
UNIV_INTERN page_t * | btr_root_get (dict_index_t *index, mtr_t *mtr) |
UNIV_INLINE buf_block_t * | btr_block_get_func (ulint space, ulint zip_size, ulint page_no, ulint mode, const char *file, ulint line, mtr_t *mtr) __attribute__((nonnull)) |
UNIV_INLINE index_id_t | btr_page_get_index_id (const page_t *page) |
UNIV_INLINE ulint | btr_page_get_level_low (const page_t *page) |
UNIV_INLINE ulint | btr_page_get_level (const page_t *page, mtr_t *mtr) |
UNIV_INLINE ulint | btr_page_get_next (const page_t *page, mtr_t *mtr) |
UNIV_INLINE ulint | btr_page_get_prev (const page_t *page, mtr_t *mtr) |
UNIV_INTERN rec_t * | btr_get_prev_user_rec (rec_t *rec, mtr_t *mtr) |
UNIV_INTERN rec_t * | btr_get_next_user_rec (rec_t *rec, mtr_t *mtr) |
UNIV_INLINE void | btr_leaf_page_release (buf_block_t *block, ulint latch_mode, mtr_t *mtr) |
UNIV_INLINE ulint | btr_node_ptr_get_child_page_no (const rec_t *rec, const ulint *offsets) |
UNIV_INTERN ulint | btr_create (ulint type, ulint space, ulint zip_size, index_id_t index_id, dict_index_t *index, mtr_t *mtr) |
UNIV_INTERN void | btr_free_but_not_root (ulint space, ulint zip_size, ulint root_page_no) |
UNIV_INTERN void | btr_free_root (ulint space, ulint zip_size, ulint root_page_no, mtr_t *mtr) |
UNIV_INTERN rec_t * | btr_root_raise_and_insert (btr_cur_t *cursor, const dtuple_t *tuple, ulint n_ext, mtr_t *mtr) |
UNIV_INTERN ibool | btr_page_reorganize (buf_block_t *block, dict_index_t *index, mtr_t *mtr) |
UNIV_INTERN ibool | btr_page_get_split_rec_to_left (btr_cur_t *cursor, rec_t **split_rec) |
UNIV_INTERN ibool | btr_page_get_split_rec_to_right (btr_cur_t *cursor, rec_t **split_rec) |
UNIV_INTERN rec_t * | btr_page_split_and_insert (btr_cur_t *cursor, const dtuple_t *tuple, ulint n_ext, mtr_t *mtr) |
UNIV_INTERN void | btr_insert_on_non_leaf_level_func (dict_index_t *index, ulint level, dtuple_t *tuple, const char *file, ulint line, mtr_t *mtr) |
UNIV_INTERN void | btr_set_min_rec_mark (rec_t *rec, mtr_t *mtr) |
UNIV_INTERN void | btr_node_ptr_delete (dict_index_t *index, buf_block_t *block, mtr_t *mtr) |
UNIV_INTERN ibool | btr_compress (btr_cur_t *cursor, mtr_t *mtr) |
UNIV_INTERN void | btr_discard_page (btr_cur_t *cursor, mtr_t *mtr) |
UNIV_INTERN byte * | btr_parse_set_min_rec_mark (byte *ptr, byte *end_ptr, ulint comp, page_t *page, mtr_t *mtr) |
UNIV_INTERN byte * | btr_parse_page_reorganize (byte *ptr, byte *end_ptr, dict_index_t *index, buf_block_t *block, mtr_t *mtr) |
UNIV_INTERN ulint | btr_get_size (dict_index_t *index, ulint flag) |
UNIV_INTERN buf_block_t * | btr_page_alloc (dict_index_t *index, ulint hint_page_no, byte file_direction, ulint level, mtr_t *mtr) |
UNIV_INTERN void | btr_page_free (dict_index_t *index, buf_block_t *block, mtr_t *mtr) |
UNIV_INTERN void | btr_page_free_low (dict_index_t *index, buf_block_t *block, ulint level, mtr_t *mtr) |
UNIV_INTERN ibool | btr_index_rec_validate (const rec_t *rec, const dict_index_t *index, ibool dump_on_error) |
UNIV_INTERN ibool | btr_validate_index (dict_index_t *index, trx_t *trx) |
#define btr_block_get | ( | space, | |
zip_size, | |||
page_no, | |||
mode, | |||
mtr | |||
) | btr_block_get_func(space,zip_size,page_no,mode,__FILE__,__LINE__,mtr) |
Gets a buffer page and declares its latching order level.
space | tablespace identifier |
zip_size | compressed page size in bytes or 0 for uncompressed pages |
page_no | page number |
mode | latch mode |
mtr | mini-transaction handle |
Definition at line 127 of file btr0btr.h.
Referenced by btr_compress(), btr_discard_page(), btr_free_root(), btr_pcur_move_to_next_page(), and dict_truncate_index_tree().
#define BTR_DELETE 8192 |
Try to purge the record at the searched position using the insert/delete buffer when the record is not in the buffer pool.
Definition at line 94 of file btr0btr.h.
Referenced by btr_cur_search_to_nth_level(), and row_search_index_entry().
#define BTR_DELETE_MARK 4096 |
Try to delete mark the record at the searched position using the insert/delete buffer when the record is not in the buffer pool.
Definition at line 90 of file btr0btr.h.
Referenced by btr_cur_search_to_nth_level().
#define BTR_ESTIMATE 1024 |
This flag ORed to btr_latch_mode says that we do the search in query optimization
Definition at line 81 of file btr0btr.h.
Referenced by btr_cur_open_at_index_side_func(), btr_cur_search_to_nth_level(), and btr_estimate_n_rows_in_range().
#define BTR_IGNORE_SEC_UNIQUE 2048 |
This flag ORed to BTR_INSERT says that we can ignore possible UNIQUE definition on secondary indexes when we decide if we can use the insert buffer to speed up inserts
Definition at line 86 of file btr0btr.h.
Referenced by btr_cur_search_to_nth_level().
#define BTR_INSERT 512 |
If this is ORed to btr_latch_mode, it means that the search tuple will be inserted to the index, at the searched position. When the record is not in the buffer pool, try to use the insert buffer.
Definition at line 77 of file btr0btr.h.
Referenced by btr_cur_search_to_nth_level().
#define BTR_MAX_LEVELS 100 |
Maximum depth of a B-tree in InnoDB.
Note that this isn't a maximum as such; none of the tree operations avoid producing trees bigger than this. It is instead a "max depth that other code must work with", useful for e.g. fixed-size arrays that must store some information about each level in a tree. In other words: if a B-tree with bigger depth than this is encountered, it is not acceptable for it to lead to mysterious memory corruption, but it is acceptable for the program to die with a clear assert failure.
#define btr_page_get | ( | space, | |
zip_size, | |||
page_no, | |||
mode, | |||
mtr | |||
) | buf_block_get_frame(btr_block_get(space,zip_size,page_no,mode,mtr)) |
Gets a buffer page and declares its latching order level.
space | tablespace identifier |
zip_size | compressed page size in bytes or 0 for uncompressed pages |
page_no | page number |
mode | latch mode |
mtr | mini-transaction handle |
Definition at line 136 of file btr0btr.h.
Referenced by btr_cur_search_to_nth_level(), and btr_free_but_not_root().
#define BTR_PAGE_MAX_REC_SIZE (UNIV_PAGE_SIZE / 2 - 200) |
Maximum record size which can be stored on a page, without using the special big record storage structure
Definition at line 41 of file btr0btr.h.
Referenced by btr_create().
enum btr_latch_mode |
Latching modes for btr_cur_search_to_nth_level().
UNIV_INLINE buf_block_t* btr_block_get_func | ( | ulint | space, |
ulint | zip_size, | ||
ulint | page_no, | ||
ulint | mode, | ||
const char * | file, | ||
ulint | line, | ||
mtr_t * | mtr | ||
) |
Gets a buffer page and declares its latching order level.
space | in: space id |
zip_size | in: compressed page size in bytes or 0 for uncompressed pages |
page_no | in: page number |
mode | in: latch mode |
file | in: file name |
line | in: line where called |
mtr | in/out: mtr |
Tries to merge the page first to the left immediate brother if such a brother exists, and the node pointers to the current page and to the brother reside on the same page. If the left brother does not satisfy these conditions, looks at the right brother. If the page is the only one on that level lifts the records of the page to the father page, thus reducing the tree height. It is assumed that mtr holds an x-latch on the tree and on the page. If cursor is on the leaf level, mtr must also hold x-latches to the brothers, if they exist.
Tries to merge the page first to the left immediate brother if such a brother exists, and the node pointers to the current page and to the brother reside on the same page. If the left brother does not satisfy these conditions, looks at the right brother. If the page is the only one on that level lifts the records of the page to the father page, thus reducing the tree height. It is assumed that mtr holds an x-latch on the tree and on the page. If cursor is on the leaf level, mtr must also hold x-latches to the brothers, if they exist.
cursor | in: cursor on the page to merge or lift; the page must not be empty: in record delete use btr_discard_page if the page would become empty |
mtr | in: mtr |
Definition at line 2538 of file btr0btr.cc.
References btr_block_get, btr_cur_get_block(), btr_cur_get_index(), btr_cur_get_page(), btr_cur_get_page_zip(), btr_cur_get_rec(), btr_page_get_next(), btr_page_get_prev(), buf_block_get_page_no(), buf_block_get_page_zip, dict_index_get_lock(), dict_index_get_space(), dict_index_is_clust(), dict_table_is_comp(), dict_table_zip_size(), FIL_NULL, FIL_PAGE_PREV, ibuf_update_free_bits_if_full(), btr_cur_struct::index, lock_update_merge_left(), lock_update_merge_right(), mem_heap_create, mem_heap_free, page_copy_rec_list_end(), page_copy_rec_list_start(), page_get_data_size(), page_get_max_insert_size(), page_get_max_insert_size_after_reorganize(), page_get_n_recs(), page_is_comp(), page_is_leaf(), page_validate(), dict_index_struct::table, ut_a, and ut_ad.
UNIV_INTERN ulint btr_create | ( | ulint | type, |
ulint | space, | ||
ulint | zip_size, | ||
index_id_t | index_id, | ||
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Creates the root node for a new index tree.
Creates the root node for a new index tree.
type | in: type of the index |
space | in: space where created |
zip_size | in: compressed page size in bytes or 0 for uncompressed pages |
index_id | in: index id |
index | in: index |
mtr | in: mini-transaction handle |
Definition at line 732 of file btr0btr.cc.
References BTR_PAGE_MAX_REC_SIZE, buf_block_get_page_no(), buf_block_get_page_zip, buf_page_get, buf_block_struct::check_index_page_at_flush, DICT_CLUSTERED, DICT_IBUF, dict_table_is_comp(), FIL_NULL, flst_init(), page_create(), page_create_zip(), page_get_max_insert_size(), dict_index_struct::table, and ut_ad.
Discards a page from a B-tree. This is used to remove the last record from a B-tree page: the whole page must be removed at the same time. This cannot be used for the root page, which is allowed to be empty. in: mtr
Discards a page from a B-tree. This is used to remove the last record from a B-tree page: the whole page must be removed at the same time. This cannot be used for the root page, which is allowed to be empty.
cursor | in: cursor on the page to discard: not on the root page |
mtr | in: mtr |
Definition at line 2895 of file btr0btr.cc.
References btr_block_get, btr_cur_get_block(), btr_cur_get_index(), btr_page_get_next(), btr_page_get_prev(), buf_block_get_page_no(), buf_block_get_page_zip, dict_index_get_lock(), dict_index_get_page(), dict_index_get_space(), dict_table_zip_size(), FIL_NULL, lock_get_min_heap_no(), lock_update_discard(), page_is_comp(), page_is_leaf(), page_rec_get_next(), page_rec_is_user_rec(), dict_index_struct::table, ut_a, and ut_ad.
UNIV_INTERN void btr_free_but_not_root | ( | ulint | space, |
ulint | zip_size, | ||
ulint | root_page_no | ||
) |
Frees a B-tree except the root page, which MUST be freed after this by calling btr_free_root. in: root page number
Frees a B-tree except the root page, which MUST be freed after this by calling btr_free_root.
space | in: space where created |
zip_size | in: compressed page size in bytes or 0 for uncompressed pages |
root_page_no | in: root page number |
Definition at line 857 of file btr0btr.cc.
References btr_page_get, FIL_PAGE_DATA, mtr_commit(), mtr_start(), and ut_a.
UNIV_INTERN void btr_free_root | ( | ulint | space, |
ulint | zip_size, | ||
ulint | root_page_no, | ||
mtr_t * | mtr | ||
) |
Frees the B-tree root page. Other tree MUST already have been freed. in: a mini-transaction which has already been started
Frees the B-tree root page. Other tree MUST already have been freed.
space | in: space where created |
zip_size | in: compressed page size in bytes or 0 for uncompressed pages |
root_page_no | in: root page number |
mtr | in: a mini-transaction which has already been started |
Definition at line 913 of file btr0btr.cc.
References btr_block_get, and ut_a.
UNIV_INTERN rec_t* btr_get_next_user_rec | ( | rec_t * | rec, |
mtr_t * | mtr | ||
) |
Gets pointer to the next user record in the tree. It is assumed that the caller has appropriate latches on the page and its neighbor.
Gets pointer to the next user record in the tree. It is assumed that the caller has appropriate latches on the page and its neighbor.
rec | in: record on leaf level |
mtr | in: mtr holding a latch on the page, and if needed, also to the next page |
Definition at line 233 of file btr0btr.cc.
References btr_page_get_next(), btr_page_get_prev(), buf_page_get_with_no_latch, FIL_NULL, page_align(), page_get_page_no(), page_get_space_id(), page_is_comp(), page_rec_get_next(), page_rec_is_supremum(), ut_a, and ut_ad.
UNIV_INTERN rec_t* btr_get_prev_user_rec | ( | rec_t * | rec, |
mtr_t * | mtr | ||
) |
Gets pointer to the previous user record in the tree. It is assumed that the caller has appropriate latches on the page and its neighbor.
Gets pointer to the previous user record in the tree. It is assumed that the caller has appropriate latches on the page and its neighbor.
rec | in: record on leaf level |
mtr | in: mtr holding a latch on the page, and if needed, also to the previous page |
Definition at line 175 of file btr0btr.cc.
References btr_page_get_next(), btr_page_get_prev(), buf_page_get_with_no_latch, FIL_NULL, page_align(), page_get_page_no(), page_get_space_id(), page_is_comp(), page_rec_get_prev(), page_rec_is_infimum(), ut_a, and ut_ad.
UNIV_INTERN ulint btr_get_size | ( | dict_index_t * | index, |
ulint | flag | ||
) |
Gets the number of pages in a B-tree.
Gets the number of pages in a B-tree.
index | in: index |
flag | in: BTR_N_LEAF_PAGES or BTR_TOTAL_SIZE |
Definition at line 408 of file btr0btr.cc.
References dict_index_get_lock(), mtr_commit(), mtr_s_lock, mtr_start(), and ut_error.
UNIV_INTERN ibool btr_index_rec_validate | ( | const rec_t * | rec, |
const dict_index_t * | index, | ||
ibool | dump_on_error | ||
) |
Checks the size and number of fields in a record based on the definition of the index.
Checks the size and number of fields in a record based on the definition of the index.
rec | in: index record |
index | in: index |
dump_on_error | in: TRUE if the function should print hex dump of record and page on error |
Definition at line 3201 of file btr0btr.cc.
References dict_col_get_fixed_size(), dict_index_get_n_fields(), dict_index_get_nth_col(), dict_table_is_comp(), DICT_UNIVERSAL, mem_heap_free, page_align(), page_is_comp(), rec_get_n_fields_old(), rec_get_nth_field_offs(), rec_print_new(), rec_print_old(), dict_index_struct::table, and dict_index_struct::type.
UNIV_INTERN void btr_insert_on_non_leaf_level_func | ( | dict_index_t * | index, |
ulint | level, | ||
dtuple_t * | tuple, | ||
const char * | file, | ||
ulint | line, | ||
mtr_t * | mtr | ||
) |
Inserts a data tuple to a tree on a non-leaf level. It is assumed that mtr holds an x-latch on the tree. in: mtr
Inserts a data tuple to a tree on a non-leaf level. It is assumed that mtr holds an x-latch on the tree.
index | in: index |
level | in: level, must be > 0 |
tuple | in: the record to be inserted |
file | in: file name |
line | in: line where called |
mtr | in: mtr |
Definition at line 1673 of file btr0btr.cc.
References BTR_CONT_MODIFY_TREE, ut_a, and ut_ad.
UNIV_INLINE void btr_leaf_page_release | ( | buf_block_t * | block, |
ulint | latch_mode, | ||
mtr_t * | mtr | ||
) |
Releases the latch on a leaf page and bufferunfixes it. in: mtr
block | in: buffer block |
latch_mode | in: BTR_SEARCH_LEAF or BTR_MODIFY_LEAF |
Referenced by btr_pcur_move_backward_from_page(), btr_pcur_move_to_next_page(), btr_pcur_release_leaf(), and btr_search_guess_on_hash().
UNIV_INTERN void btr_node_ptr_delete | ( | dict_index_t * | index, |
buf_block_t * | block, | ||
mtr_t * | mtr | ||
) |
Deletes on the upper level the node pointer to a page. in: mtr
Deletes on the upper level the node pointer to a page.
index | in: index tree |
block | in: page whose node pointer is deleted |
mtr | in: mtr |
Definition at line 2380 of file btr0btr.cc.
UNIV_INLINE ulint btr_node_ptr_get_child_page_no | ( | const rec_t * | rec, |
const ulint * | offsets | ||
) |
Gets the child node file address in a node pointer. NOTE: the offsets array must contain all offsets for the record since we read the last field according to offsets and assume that it contains the child page number. In other words offsets must have been retrieved with rec_get_offsets(n_fields=ULINT_UNDEFINED).
rec | in: node pointer record |
Referenced by btr_cur_open_at_index_side_func(), btr_cur_open_at_rnd_pos_func(), and btr_cur_search_to_nth_level().
UNIV_INTERN buf_block_t* btr_page_alloc | ( | dict_index_t * | index, |
ulint | hint_page_no, | ||
byte | file_direction, | ||
ulint | level, | ||
mtr_t * | mtr | ||
) |
Allocates a new file page to be used in an index tree. NOTE: we assume that the caller has made the reservation for free extents!
Allocates a new file page to be used in an index tree. NOTE: we assume that the caller has made the reservation for free extents!
index | in: index |
hint_page_no | in: hint of a good page |
file_direction | in: direction where a possible page split is made |
level | in: level where the page is placed in the tree |
mtr | in: mtr |
Definition at line 356 of file btr0btr.cc.
References buf_page_get, dict_index_get_space(), dict_index_is_ibuf(), dict_table_zip_size(), FIL_NULL, and dict_index_struct::table.
UNIV_INTERN void btr_page_free | ( | dict_index_t * | index, |
buf_block_t * | block, | ||
mtr_t * | mtr | ||
) |
Frees a file page used in an index tree. NOTE: cannot free field external storage pages because the page must contain info on its level. in: mtr
Frees a file page used in an index tree. NOTE: cannot free field external storage pages because the page must contain info on its level.
index | in: index tree |
block | in: block to be freed, x-latched |
mtr | in: mtr |
Definition at line 518 of file btr0btr.cc.
References btr_page_get_level().
UNIV_INTERN void btr_page_free_low | ( | dict_index_t * | index, |
buf_block_t * | block, | ||
ulint | level, | ||
mtr_t * | mtr | ||
) |
Frees a file page used in an index tree. Can be used also to BLOB external storage pages, because the page level 0 can be given as an argument. in: mtr
Frees a file page used in an index tree. Can be used also to (BLOB) external storage pages, because the page level 0 can be given as an argument.
index | in: index tree |
block | in: block to be freed, x-latched |
level | in: page level |
mtr | in: mtr |
Definition at line 477 of file btr0btr.cc.
References buf_block_get_page_no(), buf_block_get_space(), buf_block_modify_clock_inc(), dict_index_is_ibuf(), and ut_ad.
UNIV_INLINE index_id_t btr_page_get_index_id | ( | const page_t * | page | ) |
Gets the index id field of a page.
Referenced by btr_cur_open_at_index_side_func(), btr_cur_open_at_rnd_pos_func(), btr_cur_search_to_nth_level(), btr_search_drop_page_hash_index(), btr_search_guess_on_hash(), and buf_page_print().
Gets the node level field in an index page.
page | in: index page |
Referenced by btr_cur_open_at_index_side_func(), btr_cur_open_at_rnd_pos_func(), btr_cur_pessimistic_delete(), btr_cur_search_to_nth_level(), btr_page_free(), btr_page_split_and_insert(), btr_root_raise_and_insert(), and btr_validate_index().
UNIV_INLINE ulint btr_page_get_level_low | ( | const page_t * | page | ) |
Gets the node level field in an index page.
Gets the next index page number.
page | in: index page |
Referenced by btr_compress(), btr_discard_page(), btr_estimate_number_of_different_key_vals(), btr_get_next_user_rec(), btr_get_prev_user_rec(), btr_pcur_move_to_next_page(), and btr_pcur_store_position().
Gets the previous index page number.
page | in: index page |
Referenced by btr_compress(), btr_cur_pessimistic_delete(), btr_discard_page(), btr_estimate_number_of_different_key_vals(), btr_get_next_user_rec(), btr_get_prev_user_rec(), btr_pcur_move_backward_from_page(), btr_pcur_move_to_next_page(), and btr_pcur_store_position().
UNIV_INTERN ibool btr_page_get_split_rec_to_left | ( | btr_cur_t * | cursor, |
rec_t ** | split_rec | ||
) |
Decides if the page should be split at the convergence point of inserts converging to left.
Decides if the page should be split at the convergence point of inserts converging to the left.
cursor | in: cursor at which to insert |
split_rec | out: if split recommended, the first record on upper half page, or NULL if tuple to be inserted should be first |
Definition at line 1354 of file btr0btr.cc.
References btr_cur_get_page(), btr_cur_get_rec(), page_header_get_ptr, and page_rec_get_next().
UNIV_INTERN ibool btr_page_get_split_rec_to_right | ( | btr_cur_t * | cursor, |
rec_t ** | split_rec | ||
) |
Decides if the page should be split at the convergence point of inserts converging to right.
Decides if the page should be split at the convergence point of inserts converging to the right.
cursor | in: cursor at which to insert |
split_rec | out: if split recommended, the first record on upper half page, or NULL if tuple to be inserted should be first |
Definition at line 1399 of file btr0btr.cc.
References btr_cur_get_page(), btr_cur_get_rec(), page_header_get_ptr, page_rec_get_next(), and page_rec_is_supremum().
UNIV_INTERN ibool btr_page_reorganize | ( | buf_block_t * | block, |
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Reorganizes an index page. IMPORTANT: if btr_page_reorganize() is invoked on a compressed leaf page of a non-clustered index, the caller must update the insert buffer free bits in the same mini-transaction in such a way that the modification will be redo-logged.
Reorganizes an index page. IMPORTANT: if btr_page_reorganize() is invoked on a compressed leaf page of a non-clustered index, the caller must update the insert buffer free bits in the same mini-transaction in such a way that the modification will be redo-logged.
block | in: page to be reorganized |
index | in: record descriptor |
mtr | in: mtr |
Definition at line 1105 of file btr0btr.cc.
UNIV_INTERN rec_t* btr_page_split_and_insert | ( | btr_cur_t * | cursor, |
const dtuple_t * | tuple, | ||
ulint | n_ext, | ||
mtr_t * | mtr | ||
) |
Splits an index page to halves and inserts the tuple. It is assumed that mtr holds an x-latch to the index tree. NOTE: the tree x-latch is released within this function! NOTE that the operation of this function must always succeed, we cannot reverse it: therefore enough free disk space (2 pages) must be guaranteed to be available before this function is called.
Splits an index page to halves and inserts the tuple. It is assumed that mtr holds an x-latch to the index tree. NOTE: the tree x-latch is released within this function! NOTE that the operation of this function must always succeed, we cannot reverse it: therefore enough free disk space (2 pages) must be guaranteed to be available before this function is called.
cursor | in: cursor at which to insert; when the function returns, the cursor is positioned on the predecessor of the inserted record |
tuple | in: tuple to insert |
n_ext | in: number of externally stored columns |
mtr | in: mtr |
Definition at line 1878 of file btr0btr.cc.
References btr_cur_get_block(), btr_cur_get_rec(), btr_page_get_level(), buf_block_get_page_no(), buf_block_get_page_zip, buf_block_get_zip_size(), cmp_dtuple_rec(), dict_index_get_lock(), dict_index_get_n_unique_in_tree(), dict_index_is_clust(), btr_cur_struct::index, lock_move_rec_list_end(), lock_move_rec_list_start(), lock_update_split_left(), lock_update_split_right(), mem_free, mem_heap_create, mem_heap_empty(), mem_heap_free, mtr_memo_release(), page_cur_search(), page_cur_tuple_insert(), page_delete_rec_list_end(), page_delete_rec_list_start(), page_get_middle_rec(), page_get_n_recs(), page_is_leaf(), page_move_rec_list_end(), page_move_rec_list_start(), page_rec_get_next(), page_validate(), page_zip_copy_recs(), rec_convert_dtuple_to_rec(), rec_get_converted_size(), ut_a, and ut_ad.
UNIV_INTERN byte* btr_parse_page_reorganize | ( | byte * | ptr, |
byte * | , | ||
dict_index_t * | index, | ||
buf_block_t * | block, | ||
mtr_t * | mtr | ||
) |
Parses a redo log record of reorganizing a page.
Parses a redo log record of reorganizing a page.
ptr | in: buffer |
index | in: record descriptor |
block | in: page to be reorganized, or NULL |
mtr | in: mtr or NULL |
Definition at line 1120 of file btr0btr.cc.
References ut_ad.
UNIV_INTERN byte* btr_parse_set_min_rec_mark | ( | byte * | ptr, |
byte * | end_ptr, | ||
ulint | comp, | ||
page_t * | page, | ||
mtr_t * | mtr | ||
) |
Parses the redo log record for setting an index record as the predefined minimum record.
Parses the redo log record for setting an index record as the predefined minimum record.
ptr | in: buffer |
end_ptr | in: buffer end |
comp | in: nonzero=compact page format |
page | in: page or NULL |
mtr | in: mtr or NULL |
Definition at line 2323 of file btr0btr.cc.
References mach_read_from_2(), page_is_comp(), and ut_a.
UNIV_INTERN page_t* btr_root_get | ( | dict_index_t * | index, |
mtr_t * | mtr | ||
) |
Gets the root node of a tree and x-latches it.
Gets the root node of a tree and x-latches it.
index | in: index tree |
mtr | in: mtr |
Definition at line 161 of file btr0btr.cc.
UNIV_INTERN rec_t* btr_root_raise_and_insert | ( | btr_cur_t * | cursor, |
const dtuple_t * | tuple, | ||
ulint | n_ext, | ||
mtr_t * | mtr | ||
) |
Makes tree one level higher by splitting the root, and inserts the tuple. It is assumed that mtr contains an x-latch on the tree. NOTE that the operation of this function must always succeed, we cannot reverse it: therefore enough free disk space must be guaranteed to be available before this function is called.
Makes tree one level higher by splitting the root, and inserts the tuple. It is assumed that mtr contains an x-latch on the tree. NOTE that the operation of this function must always succeed, we cannot reverse it: therefore enough free disk space must be guaranteed to be available before this function is called.
cursor | in: cursor at which to insert: must be on the root page; when the function returns, the cursor is positioned on the predecessor of the inserted record |
tuple | in: tuple to insert |
n_ext | in: number of externally stored columns |
mtr | in: mtr |
Definition at line 1185 of file btr0btr.cc.
References btr_cur_get_block(), btr_cur_get_index(), btr_cur_get_page(), btr_page_get_level(), buf_block_get_page_no(), buf_block_get_page_zip, dict_index_get_lock(), dict_index_get_page(), dict_index_get_space(), dict_index_is_clust(), dict_index_is_ibuf(), dtuple_get_info_bits(), dtuple_set_info_bits(), FIL_NULL, FIL_PAGE_DATA, lock_move_rec_list_end(), lock_update_root_raise(), mem_heap_create, mem_heap_free, page_copy_rec_list_end(), page_cur_search(), page_cur_set_before_first(), page_cur_tuple_insert(), page_get_page_no(), page_rec_get_next(), page_zip_copy_recs(), page_zip_get_size(), ut_a, and ut_ad.
UNIV_INTERN void btr_set_min_rec_mark | ( | rec_t * | rec, |
mtr_t * | mtr | ||
) |
Sets a record as the predefined minimum record. in: mtr
Sets a record as the predefined minimum record.
rec | in: record |
mtr | in: mtr |
Definition at line 2353 of file btr0btr.cc.
References MLOG_COMP_REC_MIN_MARK, MLOG_REC_MIN_MARK, page_rec_is_comp(), rec_get_info_bits(), rec_set_info_bits_new(), and rec_set_info_bits_old().
UNIV_INTERN ibool btr_validate_index | ( | dict_index_t * | index, |
trx_t * | trx | ||
) |
Checks the consistency of an index tree.
Checks the consistency of an index tree.
index | in: index |
trx | in: transaction or NULL |
Definition at line 3729 of file btr0btr.cc.
References btr_page_get_level(), dict_index_get_lock(), mtr_commit(), mtr_start(), mtr_x_lock, and trx_is_interrupted().