MySQL 5.6.14 Source Code Document
|
#include "btr0cur.h"
#include "row0upd.h"
#include "mtr0log.h"
#include "page0page.h"
#include "page0zip.h"
#include "rem0rec.h"
#include "rem0cmp.h"
#include "buf0lru.h"
#include "btr0btr.h"
#include "btr0sea.h"
#include "row0log.h"
#include "row0purge.h"
#include "trx0rec.h"
#include "trx0roll.h"
#include "que0que.h"
#include "row0row.h"
#include "srv0srv.h"
#include "ibuf0ibuf.h"
#include "lock0lock.h"
#include "zlib.h"
Go to the source code of this file.
Macros | |
#define | BTR_CUR_PAGE_REORGANIZE_LIMIT (UNIV_PAGE_SIZE / 32) |
#define | N_PAGES_READ_LIMIT 10 |
#define | btr_rec_get_field_ref(rec, offsets, n) ((rec) + btr_rec_get_field_ref_offs(offsets, n)) |
#define | BTR_BLOB_HDR_PART_LEN 0 |
#define | BTR_BLOB_HDR_NEXT_PAGE_NO 4 |
#define | BTR_BLOB_HDR_SIZE 8 |
#define | BTR_TABLE_STATS_FROM_SAMPLE(value, index, sample, ext_size, not_empty) |
Enumerations | |
enum | btr_op_t { BTR_NO_OP = 0, BTR_INSERT_OP, BTR_INSERT_IGNORE_UNIQUE_OP, BTR_DELETE_OP, BTR_DELMARK_OP } |
Functions | |
UNIV_INLINE void | btr_rec_set_deleted_flag (rec_t *rec, page_zip_des_t *page_zip, ulint flag) |
UNIV_INTERN void | btr_cur_search_to_nth_level (dict_index_t *index, ulint level, const dtuple_t *tuple, ulint mode, ulint latch_mode, btr_cur_t *cursor, ulint has_search_latch, const char *file, ulint line, mtr_t *mtr) |
UNIV_INTERN void | btr_cur_open_at_index_side_func (bool from_left, dict_index_t *index, ulint latch_mode, btr_cur_t *cursor, ulint level, const char *file, ulint line, mtr_t *mtr) |
UNIV_INTERN void | btr_cur_open_at_rnd_pos_func (dict_index_t *index, ulint latch_mode, btr_cur_t *cursor, const char *file, ulint line, mtr_t *mtr) |
Variables | |
UNIV_INTERN ulint | btr_cur_n_non_sea = 0 |
UNIV_INTERN ulint | btr_cur_n_sea = 0 |
UNIV_INTERN ulint | btr_cur_n_non_sea_old = 0 |
UNIV_INTERN ulint | btr_cur_n_sea_old = 0 |
const byte | field_ref_zero [BTR_EXTERN_FIELD_REF_SIZE] |
static const dtuple_t * | tuple |
static const dtuple_t ulint ** | offsets |
static const dtuple_t ulint mem_heap_t ** | heap |
static const dtuple_t ulint mem_heap_t ulint | n_ext |
The index tree cursor
All changes that row operations make to a B-tree or the records there must go through this module! Undo log records are written here of every modify or insert of a clustered index record.
NOTE!!!
To make sure we do not run out of disk space during a pessimistic insert or update, we have to reserve 2 x the height of the index tree many pages in the tablespace before we start the operation, because if leaf splitting has been started, it is difficult to undo, except by crashing the database and doing a roll-forward.
Created 10/16/1994 Heikki Tuuri
Definition in file btr0cur.cc.
#define BTR_BLOB_HDR_NEXT_PAGE_NO 4 |
next BLOB part page no, FIL_NULL if none
Definition at line 116 of file btr0cur.cc.
#define BTR_BLOB_HDR_PART_LEN 0 |
The structure of a BLOB part header BLOB part len on this page
Definition at line 114 of file btr0cur.cc.
#define BTR_BLOB_HDR_SIZE 8 |
Size of a BLOB part header, in bytes
Definition at line 119 of file btr0cur.cc.
#define BTR_CUR_PAGE_REORGANIZE_LIMIT (UNIV_PAGE_SIZE / 32) |
In the optimistic insert, if the insert does not fit, but this much space
can be released by page reorganize, then it is reorganized
Definition at line 109 of file btr0cur.cc.
#define BTR_TABLE_STATS_FROM_SAMPLE | ( | value, | |
index, | |||
sample, | |||
ext_size, | |||
not_empty | |||
) |
Estimated table level stats from sampled value.
value | sampled stats |
index | index being sampled |
sample | number of sampled rows |
ext_size | external stored data size |
not_empty | table not empty |
Definition at line 129 of file btr0cur.cc.
enum btr_op_t |
Buffered B-tree operation types, introduced as part of delete buffering.
Definition at line 74 of file btr0cur.cc.
UNIV_INTERN void btr_cur_open_at_index_side_func | ( | bool | from_left, |
dict_index_t * | index, | ||
ulint | latch_mode, | ||
btr_cur_t * | cursor, | ||
ulint | level, | ||
const char * | file, | ||
ulint | line, | ||
mtr_t * | mtr | ||
) |
Opens a cursor at either end of an index.
from_left | in: true if open to the low end, false if to the high end |
index | in: index |
latch_mode | in: latch mode |
cursor | in/out: cursor |
level | in: level to search for (0=leaf). |
file | in: file name |
line | in: line where called |
mtr | in/out: mini-transaction |
Definition at line 839 of file btr0cur.cc.
UNIV_INTERN void btr_cur_open_at_rnd_pos_func | ( | dict_index_t * | index, |
ulint | latch_mode, | ||
btr_cur_t * | cursor, | ||
const char * | file, | ||
ulint | line, | ||
mtr_t * | mtr | ||
) |
Positions a cursor at a randomly chosen position within a B-tree.
index | in: index |
latch_mode | in: BTR_SEARCH_LEAF, ... |
cursor | in/out: B-tree cursor |
file | in: file name |
line | in: line where called |
mtr | in: mtr |
Definition at line 999 of file btr0cur.cc.
UNIV_INTERN void btr_cur_search_to_nth_level | ( | dict_index_t * | index, |
ulint | level, | ||
const dtuple_t * | tuple, | ||
ulint | mode, | ||
ulint | latch_mode, | ||
btr_cur_t * | cursor, | ||
ulint | has_search_latch, | ||
const char * | file, | ||
ulint | line, | ||
mtr_t * | mtr | ||
) |
Searches an index tree and positions a tree cursor on a given level. NOTE: n_fields_cmp in tuple must be set so that it cannot be compared to node pointer page number fields on the upper levels of the tree! Note that if mode is PAGE_CUR_LE, which is used in inserts, then cursor->up_match and cursor->low_match both will have sensible values. If mode is PAGE_CUR_GE, then up_match will a have a sensible value.
If mode is PAGE_CUR_LE , cursor is left at the place where an insert of the search tuple should be performed in the B-tree. InnoDB does an insert immediately after the cursor. Thus, the cursor may end up on a user record, or on a page infimum record.
index | in: index |
level | in: the tree level of search |
tuple | in: data tuple; NOTE: n_fields_cmp in tuple must be set so that it cannot get compared to the node ptr page number field! |
mode | in: PAGE_CUR_L, ...; Inserts should always be made using PAGE_CUR_LE to search the position! |
latch_mode | in: BTR_SEARCH_LEAF, ..., ORed with at most one of BTR_INSERT, BTR_DELETE_MARK, BTR_DELETE, or BTR_ESTIMATE; cursor->left_block is used to store a pointer to the left neighbor page, in the cases BTR_SEARCH_PREV and BTR_MODIFY_PREV; NOTE that if has_search_latch is != 0, we maybe do not have a latch set on the cursor page, we assume the caller uses his search latch to protect the record! |
cursor | in/out: tree cursor; the cursor page is s- or x-latched, but see also above! |
has_search_latch | in: info on the latch mode the caller currently has on btr_search_latch: RW_S_LATCH, or 0 |
file | in: file name |
line | in: line where called |
mtr | in: mtr |
Definition at line 359 of file btr0cur.cc.
UNIV_INLINE void btr_rec_set_deleted_flag | ( | rec_t * | rec, |
page_zip_des_t * | page_zip, | ||
ulint | flag | ||
) |
The following function is used to set the deleted bit of a record.
rec | in/out: physical record |
page_zip | in/out: compressed page (or NULL) |
flag | in: nonzero if delete marked |
Definition at line 220 of file btr0cur.cc.
UNIV_INTERN ulint btr_cur_n_non_sea = 0 |
Number of searches down the B-tree in btr_cur_search_to_nth_level().
Definition at line 89 of file btr0cur.cc.
UNIV_INTERN ulint btr_cur_n_non_sea_old = 0 |
Old value of btr_cur_n_non_sea. Copied by
srv_refresh_innodb_monitor_stats(). Referenced by srv_printf_innodb_monitor().
Definition at line 96 of file btr0cur.cc.
UNIV_INTERN ulint btr_cur_n_sea = 0 |
Number of successful adaptive hash index lookups in
btr_cur_search_to_nth_level().
Definition at line 92 of file btr0cur.cc.
UNIV_INTERN ulint btr_cur_n_sea_old = 0 |
Old value of btr_cur_n_sea. Copied by
srv_refresh_innodb_monitor_stats(). Referenced by srv_printf_innodb_monitor().
Definition at line 100 of file btr0cur.cc.
const byte field_ref_zero[BTR_EXTERN_FIELD_REF_SIZE] |
A BLOB field reference full of zero, for use in assertions and tests.
Initially, BLOB field references are set to zero, in dtuple_convert_big_rec().
Definition at line 139 of file btr0cur.cc.
const dtuple_t ulint mem_heap_t** heap |
in/out: pointer to memory heap, or NULL
Definition at line 1103 of file btr0cur.cc.
const dtuple_t ulint mem_heap_t ulint n_ext |
in: number of externally stored columns
Definition at line 1103 of file btr0cur.cc.
const dtuple_t ulint** offsets |
out: offsets on *rec
Definition at line 1103 of file btr0cur.cc.
const dtuple_t* tuple |
< in: cursor on page after which to insert; cursor stays valid in: tuple to insert; the size info need not have been stored to tuple
Definition at line 1103 of file btr0cur.cc.