94#define btr_cur_get_page_cur(cursor) (&(cursor)->page_cur)
95#define btr_cur_get_block(cursor) ((cursor)->page_cur.block)
96#define btr_cur_get_rec(cursor) ((cursor)->page_cur.rec)
160 ulint has_search_latch,
187 mtr_t *mtr,
bool mark_dirty =
true);
305 bool cr,
mtr_t *mtr) {
424 const ulint *offsets,
527#ifndef UNIV_HOTBACKUP
610#define BTR_CUR_PAGE_COMPRESS_LIMIT(index) \
611 ((UNIV_PAGE_SIZE * (ulint)((index)->merge_threshold)) / 100)
uint32_t page_no_t
Page number.
Definition: api0api.h:46
static rec_t * btr_cur_get_rec(const btr_cur_t *cursor)
Returns the record pointer of a tree cursor.
void btr_cur_open_at_index_side(bool from_left, dict_index_t *index, ulint latch_mode, btr_cur_t *cursor, ulint level, ut::Location location, mtr_t *mtr)
Opens a cursor at either end of an index.
Definition: btr0cur.cc:1851
const byte * btr_cur_parse_del_mark_set_sec_rec(const byte *ptr, const byte *end_ptr, page_t *page, page_zip_des_t *page_zip)
Parses the redo log record for delete marking or unmarking of a secondary index record.
Definition: btr0cur.cc:4389
const byte * btr_cur_parse_del_mark_set_clust_rec(const byte *ptr, const byte *end_ptr, page_t *page, page_zip_des_t *page_zip, dict_index_t *index)
Parses the redo log record for delete marking or unmarking of a clustered index record.
Definition: btr0cur.cc:4207
bool btr_estimate_number_of_different_key_vals(dict_index_t *index)
Estimates the number of different key values in a given index, for each n-column prefix of the index ...
Definition: btr0cur.cc:5395
static page_cur_t * btr_cur_get_page_cur(const btr_cur_t *cursor)
Returns the page cursor component of a tree cursor.
bool btr_cur_compress_if_useful(btr_cur_t *cursor, bool adjust, mtr_t *mtr)
Tries to compress a page of the tree if it seems useful.
Definition: btr0cur.cc:4494
@ BTR_NO_LOCKING_FLAG
do no record lock checking
Definition: btr0cur.h:51
@ BTR_KEEP_SYS_FLAG
sys fields will be found in the update vector or inserted entry
Definition: btr0cur.h:54
@ BTR_KEEP_IBUF_BITMAP
the caller of btr_cur_optimistic_update() or btr_cur_update_in_place() will take care of updating IBU...
Definition: btr0cur.h:64
@ BTR_KEEP_POS_FLAG
btr_cur_pessimistic_update() must keep cursor position when moving columns to big_rec
Definition: btr0cur.h:57
@ BTR_NO_UNDO_LOG_FLAG
do no undo logging
Definition: btr0cur.h:49
@ BTR_CREATE_FLAG
the caller is creating the index or wants to bypass the index->info.online creation log
Definition: btr0cur.h:60
static page_zip_des_t * btr_cur_get_page_zip(btr_cur_t *cursor)
Returns the compressed page on which the tree cursor is positioned.
uint btr_cur_limit_optimistic_insert_debug
Definition: btr0cur.cc:143
bool btr_cur_optimistic_latch_leaves(buf_block_t *block, uint64_t modify_clock, ulint *latch_mode, btr_cur_t *cursor, const char *file, ulint line, mtr_t *mtr)
Optimistically latches the leaf page or pages requested.
Definition: btr0cur.cc:343
bool btr_cur_update_alloc_zip(page_zip_des_t *page_zip, page_cur_t *cursor, dict_index_t *index, ulint *offsets, ulint len, bool cr, mtr_t *mtr)
Definition: btr0cur.h:302
bool btr_cur_open_at_rnd_pos(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.
Definition: btr0cur.cc:2254
const byte * btr_cur_parse_update_in_place(const byte *ptr, const byte *end_ptr, page_t *page, page_zip_des_t *page_zip, dict_index_t *index)
Parses a redo log record of updating a record in-place.
Definition: btr0cur.cc:3183
constexpr uint32_t BTR_CUR_RETRY_DELETE_N_TIMES
If pessimistic delete fails because of lack of file space, there is still a good change of success a ...
Definition: btr0cur.h:753
dberr_t btr_cur_optimistic_update(ulint flags, btr_cur_t *cursor, ulint **offsets, mem_heap_t **heap, const upd_t *update, ulint cmpl_info, que_thr_t *thr, trx_id_t trx_id, mtr_t *mtr)
Tries to update a record on a page in an index tree.
Definition: btr0cur.cc:3493
static page_t * btr_cur_get_page(btr_cur_t *cursor)
Returns the page of a tree cursor.
void btr_cur_search_to_nth_level_with_no_latch(dict_index_t *index, ulint level, const dtuple_t *tuple, page_cur_mode_t mode, btr_cur_t *cursor, const char *file, ulint line, mtr_t *mtr, bool mark_dirty=true)
Searches an index tree and positions a tree cursor on a given level.
Definition: btr0cur.cc:1716
void btr_cur_search_to_nth_level(dict_index_t *index, ulint level, const dtuple_t *tuple, page_cur_mode_t 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.
Definition: btr0cur.cc:620
btr_latch_leaves_t btr_cur_latch_leaves(buf_block_t *block, const page_id_t &page_id, const page_size_t &page_size, ulint latch_mode, btr_cur_t *cursor, mtr_t *mtr)
Latches the leaf page or pages requested.
Definition: btr0cur.cc:184
static void btr_rec_set_deleted_flag(rec_t *rec, page_zip_des_t *page_zip, bool flag)
The following function is used to set the deleted bit of a record.
byte * btr_rec_copy_externally_stored_field_func(trx_t *trx, dict_index_t *index, const rec_t *rec, const ulint *offsets, const page_size_t &page_size, ulint no, ulint *len, size_t *lob_version, bool is_sdi, mem_heap_t *heap)
Copies an externally stored field of a record to mem heap.
constexpr uint32_t BTR_PATH_ARRAY_N_SLOTS
size of path array (in slots)
Definition: btr0cur.h:641
dberr_t btr_cur_optimistic_insert(ulint flags, btr_cur_t *cursor, ulint **offsets, mem_heap_t **heap, dtuple_t *entry, rec_t **rec, big_rec_t **big_rec, que_thr_t *thr, mtr_t *mtr)
Tries to perform an insert to a page in an index tree, next to cursor.
Definition: btr0cur.cc:2661
dberr_t btr_cur_del_mark_set_clust_rec(ulint flags, buf_block_t *block, rec_t *rec, dict_index_t *index, const ulint *offsets, que_thr_t *thr, const dtuple_t *entry, mtr_t *mtr)
Marks a clustered index record deleted.
Definition: btr0cur.cc:4281
ulint btr_cur_n_non_sea
Number of searches down the B-tree in btr_cur_search_to_nth_level().
Definition: btr0cur.cc:128
void btr_cur_set_deleted_flag_for_ibuf(rec_t *rec, page_zip_des_t *page_zip, bool val, mtr_t *mtr)
Sets a secondary index record's delete mark to the given value.
Definition: btr0cur.cc:4466
ulint btr_cur_n_sea_old
Old value of btr_cur_n_sea.
Definition: btr0cur.cc:139
dberr_t btr_cur_update_in_place(ulint flags, btr_cur_t *cursor, ulint *offsets, const upd_t *update, ulint cmpl_info, que_thr_t *thr, trx_id_t trx_id, mtr_t *mtr)
Updates a record when the update causes no size changes in its fields.
Definition: btr0cur.cc:3328
bool btr_cur_optimistic_delete_func(btr_cur_t *cursor, ulint flags, mtr_t *mtr)
Definition: btr0cur.cc:4532
dberr_t btr_cur_del_mark_set_sec_rec(ulint flags, btr_cur_t *cursor, bool val, que_thr_t *thr, mtr_t *mtr)
Sets a secondary index record delete mark to true or false.
Definition: btr0cur.cc:4426
bool btr_cur_optimistic_delete(btr_cur_t *cursor, ulint flags, mtr_t *mtr)
Removes the record on which the tree cursor is positioned on a leaf page.
Definition: btr0cur.h:464
static void btr_cur_position(dict_index_t *index, rec_t *rec, buf_block_t *block, btr_cur_t *cursor)
Positions a tree cursor at a given record.
static buf_block_t * btr_cur_get_block(const btr_cur_t *cursor)
Returns the buffer block on which the tree cursor is positioned.
int64_t btr_estimate_n_rows_in_range(dict_index_t *index, const dtuple_t *tuple1, page_cur_mode_t mode1, const dtuple_t *tuple2, page_cur_mode_t mode2)
Estimates the number of rows in a given index range.
Definition: btr0cur.cc:5342
bool materialize_instant_default(const dict_index_t *index, const rec_t *rec)
If default value of INSTANT ADD column is to be materialize in updated row.
Definition: btr0cur.cc:3442
bool btr_cur_pessimistic_delete(dberr_t *err, bool has_reserved_extents, btr_cur_t *cursor, uint32_t flags, bool rollback, trx_id_t trx_id, undo_no_t undo_no, ulint rec_type, mtr_t *mtr, btr_pcur_t *pcur, purge_node_t *node)
Removes the record on which the tree cursor is positioned.
Definition: btr0cur.cc:4613
bool btr_cur_update_alloc_zip_func(page_zip_des_t *page_zip, page_cur_t *cursor, dict_index_t *index, ulint *offsets, ulint length, bool create, mtr_t *mtr)
See if there is enough place in the page modification log to log an update-in-place.
Definition: btr0cur.cc:3253
constexpr uint32_t BTR_CUR_RETRY_SLEEP_TIME_MS
If pessimistic delete fails because of lack of file space, there is still a good change of success a ...
Definition: btr0cur.h:757
dberr_t btr_cur_pessimistic_insert(uint32_t flags, btr_cur_t *cursor, ulint **offsets, mem_heap_t **heap, dtuple_t *entry, rec_t **rec, big_rec_t **big_rec, que_thr_t *thr, mtr_t *mtr)
Performs an insert on a page of an index tree.
Definition: btr0cur.cc:2929
btr_cur_method
Values for the flag documenting the used search method.
Definition: btr0cur.h:644
@ BTR_CUR_HASH_FAIL
failure using hash, success using binary search.
Definition: btr0cur.h:653
@ BTR_CUR_DELETE_REF
row_purge_poss_sec() failed
Definition: btr0cur.h:663
@ BTR_CUR_INSERT_TO_IBUF
performed the intended insert to the insert buffer
Definition: btr0cur.h:657
@ BTR_CUR_BINARY
success using the binary search
Definition: btr0cur.h:655
@ BTR_CUR_HASH
successful shortcut using the hash index
Definition: btr0cur.h:648
@ BTR_CUR_DELETE_IBUF
performed the intended delete in the insert/delete buffer
Definition: btr0cur.h:661
@ BTR_CUR_UNSET
Flag for initialization only, not in real use.
Definition: btr0cur.h:646
@ BTR_CUR_DEL_MARK_IBUF
performed the intended delete mark in the insert/delete buffer
Definition: btr0cur.h:659
@ BTR_CUR_HASH_NOT_ATTEMPTED
a search using hash index was not performed.
Definition: btr0cur.h:650
ulint btr_cur_n_sea
Number of successful adaptive hash index lookups in btr_cur_search_to_nth_level().
Definition: btr0cur.cc:131
dberr_t btr_cur_pessimistic_update(ulint flags, btr_cur_t *cursor, ulint **offsets, mem_heap_t **offsets_heap, mem_heap_t *entry_heap, big_rec_t **big_rec, upd_t *update, ulint cmpl_info, que_thr_t *thr, trx_id_t trx_id, undo_no_t undo_no, mtr_t *mtr, btr_pcur_t *pcur=nullptr)
Performs an update of a record on a page of a tree.
Definition: btr0cur.cc:3770
void btr_cur_open_at_index_side_with_no_latch(bool from_left, dict_index_t *index, btr_cur_t *cursor, ulint level, ut::Location location, mtr_t *mtr)
Opens a cursor at either end of an index.
Definition: btr0cur.cc:2168
ulint btr_cur_n_non_sea_old
Old value of btr_cur_n_non_sea.
Definition: btr0cur.cc:135
void btr_cur_update_in_place_log(ulint flags, const rec_t *rec, dict_index_t *index, const upd_t *update, trx_id_t trx_id, roll_ptr_t roll_ptr, mtr_t *mtr)
Writes a redo log record of updating a record in-place.
Definition: btr0cur.cc:3133
The index tree general types.
Page_fetch
Definition: buf0buf.h:58
Page identifier.
Definition: buf0types.h:207
Page size descriptor.
Definition: page0size.h:50
int page
Definition: ctype-mb.cc:1224
dberr_t
Definition: db0err.h:39
constexpr page_no_t FIL_NULL
'null' (undefined) page offset in the context of file spaces
Definition: fil0fil.h:1156
The hash table with external chains.
static int flags[50]
Definition: hp_test1.cc:40
static int flag
Definition: hp_test1.cc:40
static uint update
Definition: myisamlog.cc:94
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:908
static mysql_service_status_t create(my_h_string *) noexcept
Definition: mysql_string_all_empty.cc:43
mode
Definition: file_handle.h:61
page_cur_mode_t
Definition: page0types.h:176
byte page_t
Type of the index page.
Definition: page0types.h:152
Query graph global types.
byte rec_t
Definition: rem0types.h:41
Row operation global types.
static bool rollback(THD *thd)
Abort the current statement and transaction.
Definition: sql_cmd_srs.cc:140
Definition: completion_hash.h:35
Storage format for overflow data in a big record, that is, a clustered index record which needs exter...
Definition: data0data.h:852
The tree cursor: the definition appears here only for the compiler to know struct size!
Definition: btr0cur.h:668
btr_search_prefix_info_t prefix_info
AHI prefix used in a hash search if flag is any of BTR_CUR_HASH, BTR_CUR_HASH_FAIL or BTR_CUR_HASH_NO...
Definition: btr0cur.h:721
dict_index_t * index
Index on which the cursor is positioned.
Definition: btr0cur.h:670
buf_block_t * left_block
this field is used to store a pointer to the left neighbor page, in the cases BTR_SEARCH_PREV and BTR...
Definition: btr0cur.h:677
que_thr_t * thr
this field is only used when btr_cur_search_to_nth_level is called for an index entry insertion: the ...
Definition: btr0cur.h:682
bool m_own_rtr_info
Ownership of the above rtr_info member.
Definition: btr0cur.h:736
struct btr_cur_t::@195 ahi
ulint low_match
If search mode was PAGE_CUR_LE, the number of matched fields to the first user record AT THE CURSOR o...
Definition: btr0cur.h:707
ulint up_bytes
Number of matched bytes to the right at the time cursor positioned; only used internally in searches:...
Definition: btr0cur.h:702
page_cur_t page_cur
Page cursor.
Definition: btr0cur.h:672
btr_path_t * path_arr
In estimating the number of rows in range, we store in this array information of the path through the...
Definition: btr0cur.h:730
ulint up_match
If the search mode was PAGE_CUR_LE, the number of matched fields to the the first user record to the ...
Definition: btr0cur.h:699
uint64_t ahi_hash_value
hash value used in the search if flag is any of BTR_CUR_HASH, BTR_CUR_HASH_FAIL or BTR_CUR_HASH_NOT_A...
Definition: btr0cur.h:724
btr_cur_method flag
The following fields are used in btr_cur_search_to_nth_level to pass information:
Definition: btr0cur.h:688
ulint tree_height
Tree height if the search is done for a pessimistic insert or update operation.
Definition: btr0cur.h:691
ulint low_bytes
Number of matched bytes to the left at the time cursor positioned; only used internally in searches: ...
Definition: btr0cur.h:710
purge_node_t * purge_node
Purge node, for BTR_DELETE.
Definition: btr0cur.h:674
Page_fetch m_fetch_mode
If cursor is used in a scan or simple page fetch.
Definition: btr0cur.h:739
buf_block_t * blocks[3]
Definition: btr0cur.h:70
ulint savepoints[3]
Definition: btr0cur.h:71
A slot in the path array.
Definition: btr0cur.h:615
ulint nth_rec
Index of the record where the page cursor stopped on this level (index in alphabetical order).
Definition: btr0cur.h:625
ulint n_recs
Number of the records on the page, not counting inf and sup.
Definition: btr0cur.h:629
ulint page_level
Level of the page.
Definition: btr0cur.h:637
page_no_t page_no
Number of the page containing the record.
Definition: btr0cur.h:632
Definition: btr0pcur.h:99
Structure used by AHI to contain information on record prefixes to be considered in hash index subsys...
Definition: buf0buf.h:1722
The buffer control block structure.
Definition: buf0buf.h:1747
Data structure for an index.
Definition: dict0mem.h:1041
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:696
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:302
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:177
Index page cursor.
Definition: page0cur.h:311
Compressed page descriptor.
Definition: page0types.h:201
Definition: row0purge.h:93
Definition: que0que.h:242
Vectors holding the matching internal pages/nodes and leaf records.
Definition: gis0type.h:109
Definition: trx0trx.h:675
Definition: row0upd.h:565
ib_id_t undo_no_t
Undo number.
Definition: trx0types.h:142
ib_id_t trx_id_t
Transaction identifier (DB_TRX_ID, DATA_TRX_ID)
Definition: trx0types.h:138
ib_id_t roll_ptr_t
Rollback pointer (DB_ROLL_PTR, DATA_ROLL_PTR)
Definition: trx0types.h:140
Version control for database, common definitions, and include files.
#define IF_DEBUG(...)
Definition: univ.i:674
unsigned long int ulint
Definition: univ.i:406
constexpr ulint ULINT_UNDEFINED
The 'undefined' value for a ulint.
Definition: univ.i:420