MySQL 5.6.14 Source Code Document
|
#include "btr0btr.h"
#include "fsp0fsp.h"
#include "page0page.h"
#include "page0zip.h"
#include "btr0cur.h"
#include "btr0sea.h"
#include "btr0pcur.h"
#include "rem0cmp.h"
#include "lock0lock.h"
#include "ibuf0ibuf.h"
#include "trx0trx.h"
#include "srv0mon.h"
Go to the source code of this file.
Macros | |
#define | btr_page_get_father_node_ptr(of, heap, cur, mtr) btr_page_get_father_node_ptr_func(of,heap,cur,__FILE__,__LINE__,mtr) |
#define | btr_level_list_remove(space, zip_size, page, index, mtr) btr_level_list_remove_func(space,zip_size,page,mtr) |
Variables | |
static ulint | hint_page_no |
static ulint byte | file_direction |
static ulint byte ulint | level |
static ulint byte ulint mtr_t * | mtr |
static ulint byte ulint mtr_t mtr_t *init_mtr fseg_header_t * | seg_header |
page_t * | root = btr_root_get(index, mtr) |
static ulint | z_level |
static ulint buf_block_t * | block |
static ulint buf_block_t dict_index_t * | index |
UNIV_INTERN ibool btr_can_merge_with_page | ( | btr_cur_t * | cursor, |
ulint | page_no, | ||
buf_block_t ** | merge_block, | ||
mtr_t * | mtr | ||
) |
Checks if the page in the cursor can be merged with given page. If necessary, re-organize the merge_page.
cursor | in: cursor on the page to merge |
page_no | in: a sibling page |
merge_block | out: the merge block |
UNIV_INTERN void btr_corruption_report | ( | const buf_block_t * | block, |
const dict_index_t * | index | ||
) |
Report that an index page is corrupted.
block | in: corrupted block |
index | in: index tree |
Definition at line 66 of file btr0btr.cc.
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.
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 1527 of file btr0btr.cc.
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.
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 1658 of file btr0btr.cc.
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.
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/out: mini-transaction |
Definition at line 1716 of file btr0btr.cc.
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.
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 980 of file btr0btr.cc.
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.
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 922 of file btr0btr.cc.
UNIV_INTERN ulint btr_get_size | ( | dict_index_t * | index, |
ulint | flag, | ||
mtr_t * | mtr | ||
) |
Gets the number of pages in a B-tree.
index | in: index |
flag | in: BTR_N_LEAF_PAGES or BTR_TOTAL_SIZE |
mtr | in/out: mini-transaction where index is s-latched |
Definition at line 1189 of file btr0btr.cc.
UNIV_INTERN ulint btr_height_get | ( | dict_index_t * | index, |
mtr_t * | mtr | ||
) |
Gets the height of the B-tree (the level of the root, when the leaf level is assumed to be 0). The caller must hold an S or X latch on the index.
index | in: index tree |
mtr | in/out: mini-transaction |
Definition at line 772 of file btr0btr.cc.
UNIV_INLINE void btr_node_ptr_set_child_page_no | ( | rec_t * | rec, |
page_zip_des_t * | page_zip, | ||
const ulint * | offsets, | ||
ulint | page_no, | ||
mtr_t * | mtr | ||
) |
Sets the child node file address in a node pointer.
rec | in: node pointer record |
page_zip | in/out: compressed page whose uncompressed part will be updated, or NULL |
offsets | in: array returned by rec_get_offsets() |
page_no | in: child node address |
mtr | in: mtr |
Definition at line 1329 of file btr0btr.cc.
UNIV_INTERN buf_block_t* btr_page_alloc | ( | dict_index_t * | index, |
ulint | hint_page_no, | ||
byte | file_direction, | ||
ulint | level, | ||
mtr_t * | mtr, | ||
mtr_t * | init_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!
NULL | if no page could be allocated |
block,rw_lock_x_lock_count(&block->lock) | == 1 if allocation succeeded (init_mtr == mtr, or the page was not previously freed in mtr) |
block | (not allocated or initialized) otherwise |
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/out: mini-transaction for the allocation |
init_mtr | in/out: mini-transaction for x-latching and initializing the page |
Definition at line 1153 of file btr0btr.cc.
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.
index | in: index tree |
block | in: block to be freed, x-latched |
mtr | in: mtr |
Definition at line 1312 of file btr0btr.cc.
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.
index | in: index tree |
block | in: block to be freed, x-latched |
level | in: page level |
mtr | in: mtr |
Definition at line 1261 of file btr0btr.cc.
UNIV_INTERN bool btr_page_reorganize_low | ( | bool | recovery, |
ulint | z_level, | ||
page_cur_t * | cursor, | ||
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Reorganizes an index page.
IMPORTANT: On success, the caller will have to update IBUF_BITMAP_FREE if this 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(). On uncompressed pages, IBUF_BITMAP_FREE is unaffected by reorganization.
true | if the operation was successful |
false | if it is a compressed page, and recompression failed |
recovery | in: true if called in recovery: locks should not be updated, i.e., there cannot exist locks on the page, and a hash index should not be dropped: it cannot exist |
z_level | in: compression level to be used if dealing with compressed page |
cursor | in/out: page cursor |
index | in: the index tree of the page |
mtr | in/out: mini-transaction |
Definition at line 1756 of file btr0btr.cc.
UNIV_INTERN dberr_t btr_root_adjust_on_import | ( | const dict_index_t * | index | ) |
Checks and adjusts the root node of a tree during IMPORT TABLESPACE.
index | in: index tree |
Definition at line 837 of file btr0btr.cc.
UNIV_INTERN page_t* btr_root_get | ( | const dict_index_t * | index, |
mtr_t * | mtr | ||
) |
Gets the root node of a tree and x-latches it.
index | in: index tree |
mtr | in: mtr |
Definition at line 756 of file btr0btr.cc.
ulint buf_block_t* block |
in/out: B-tree page
Definition at line 1980 of file btr0btr.cc.
ulint byte file_direction |
in: direction where a possible page split is made
Definition at line 1110 of file btr0btr.cc.
ulint hint_page_no |
< in: index in: hint of a good page
Definition at line 1110 of file btr0btr.cc.
char * index |
in: the index tree of the page
Definition at line 1980 of file btr0btr.cc.
ulint byte ulint level |
in: level where the page is placed in the tree
Definition at line 1110 of file btr0btr.cc.
ulint byte ulint mtr_t* mtr |
in/out: mini-transaction for the allocation
Definition at line 1110 of file btr0btr.cc.
< in/out: mtr or another mini-transaction in which the page should be initialized. If init_mtr!=mtr, but the page is already X-latched in mtr, do not initialize the page.
Definition at line 1110 of file btr0btr.cc.
ulint z_level |
< in: true if called in recovery: locks should not be updated, i.e., there cannot exist locks on the page, and a hash index should not be dropped: it cannot exist in: compression level to be used if dealing with compressed page
Definition at line 1980 of file btr0btr.cc.