102 void init(
size_t read_level = 0);
238#ifndef UNIV_HOTBACKUP
282#ifndef UNIV_HOTBACKUP
401 pcur->m_btr_cur.index =
nullptr;
428 return (old_fetch_mode);
552 ulint latch_mode,
bool init_pcur,
617 cur, has_search_latch, location.
filename,
712#ifndef UNIV_HOTBACKUP
752 return (cur->up_match);
763 return (cur->low_match);
constexpr ulint BTR_LATCH_MODE_WITHOUT_FLAGS(ulint latch_mode)
Definition: btr0btr.h:130
@ BTR_MODIFY_TREE
Start modifying the entire B-tree.
Definition: btr0btr.h:69
@ BTR_MODIFY_LEAF
(Prepare to) modify a record on a leaf page and X-latch it.
Definition: btr0btr.h:65
@ BTR_NO_LATCHES
Obtain no latches.
Definition: btr0btr.h:67
@ BTR_SEARCH_LEAF
Search a record on a leaf page and S-latch it.
Definition: btr0btr.h:63
ulint BTR_LATCH_MODE_WITHOUT_INTENTION(ulint latch_mode)
Definition: btr0btr.h:138
static page_no_t btr_page_get_prev(const page_t *page, mtr_t *mtr)
Gets the previous index page number.
static page_no_t btr_page_get_next(const page_t *page, mtr_t *mtr)
Gets the next index page number.
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:1849
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:2252
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:618
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:2166
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)
Searches an index tree and positions a tree cursor on a given level.
Definition: btr0cur.cc:1714
static rec_t * btr_cur_get_rec(const btr_cur_t *cursor)
Returns the record pointer of a tree cursor.
static page_cur_t * btr_cur_get_page_cur(const btr_cur_t *cursor)
Returns the page cursor component of a tree cursor.
static page_t * btr_cur_get_page(btr_cur_t *cursor)
Returns the page of a tree cursor.
static buf_block_t * btr_cur_get_block(const btr_cur_t *cursor)
Returns the buffer block on which the tree cursor is positioned.
pcur_pos_t
Position state of persistent B-tree cursor.
Definition: btr0pcur.h:64
@ BTR_PCUR_IS_POSITIONED_OPTIMISTIC
The persistent cursor is positioned by optimistic get to the same record as it was positioned at.
Definition: btr0pcur.h:82
@ BTR_PCUR_IS_POSITIONED
The persistent cursor is positioned by index search.
Definition: btr0pcur.h:86
@ BTR_PCUR_NOT_POSITIONED
The persistent cursor is not positioned.
Definition: btr0pcur.h:67
@ BTR_PCUR_WAS_POSITIONED
The persistent cursor was previously positioned.
Definition: btr0pcur.h:76
btr_pcur_pos_t
Relative positions for a stored cursor position.
Definition: btr0pcur.h:50
@ BTR_PCUR_AFTER_LAST_IN_TREE
Definition: btr0pcur.h:60
@ BTR_PCUR_ON
Definition: btr0pcur.h:52
@ BTR_PCUR_BEFORE_FIRST_IN_TREE
Definition: btr0pcur.h:59
@ BTR_PCUR_UNSET
Definition: btr0pcur.h:51
@ BTR_PCUR_AFTER
Definition: btr0pcur.h:54
@ BTR_PCUR_BEFORE
Definition: btr0pcur.h:53
The index tree general types.
Page_fetch
Definition: buf0buf.h:57
@ SCAN
Same as NORMAL, but hint that the fetch is part of a large scan.
Definition: buf0block_hint.h:31
void clear()
Clears currently stored pointer.
Definition: buf0block_hint.cc:37
SQL data field and tuple.
dberr_t
Definition: db0err.h:38
@ DB_SUCCESS
Definition: db0err.h:42
@ DB_END_OF_INDEX
Definition: db0err.h:214
static ulint dict_index_is_spatial(const dict_index_t *index)
Check whether the index is a Spatial Index.
constexpr page_no_t FIL_NULL
'null' (undefined) page offset in the context of file spaces
Definition: fil0fil.h:1113
void rtr_clean_rtr_info(rtr_info_t *rtr_info, bool free_all)
Clean up R-Tree search structure.
Definition: gis0sea.cc:935
#define mtr_commit(m)
Commit a mini-transaction.
Definition: mtr0mtr.h:58
mode
Definition: file_handle.h:59
void delete_(T *ptr) noexcept
Releases storage which has been dynamically allocated through any of the ut::new*() variants.
Definition: ut0new.h:807
void free(void *ptr) noexcept
Releases storage which has been dynamically allocated through any of the ut::malloc*(),...
Definition: ut0new.h:715
static bool page_cur_is_after_last(const page_cur_t *cur)
Returns true if the cursor is after last user record.
static void page_cur_set_after_last(const buf_block_t *block, page_cur_t *cur)
Sets the cursor object to point after the last user record on the page.
static void page_cur_move_to_prev(page_cur_t *cur)
Moves the cursor to the previous record on page.
static void page_cur_set_before_first(const buf_block_t *block, page_cur_t *cur)
Sets the cursor object to point before the first user record on the page.
static void page_cur_move_to_next(page_cur_t *cur)
Moves the cursor to the next record on page.
static bool page_cur_is_before_first(const page_cur_t *cur)
Returns true if the cursor is before first user record on page.
page_cur_mode_t
Definition: page0types.h:175
@ PAGE_CUR_G
Definition: page0types.h:177
@ PAGE_CUR_UNSUPP
Definition: page0types.h:176
@ PAGE_CUR_L
Definition: page0types.h:179
byte page_t
Type of the index page.
Definition: page0types.h:151
byte rec_t
Definition: rem0types.h:40
The tree cursor: the definition appears here only for the compiler to know struct size!
Definition: btr0cur.h:667
dict_index_t * index
Index on which the cursor is positioned.
Definition: btr0cur.h:669
page_cur_t page_cur
Page cursor.
Definition: btr0cur.h:671
rtr_info_t * rtr_info
rtree search info.
Definition: btr0cur.h:732
Page_fetch m_fetch_mode
If cursor is used in a scan or simple page fetch.
Definition: btr0cur.h:738
Definition: btr0pcur.h:98
bool restore_position(ulint latch_mode, mtr_t *mtr, ut::Location location)
Restores the stored position of a persistent cursor bufferfixing the page and obtaining the specified...
Definition: btr0pcur.cc:146
import_ctx_t * import_ctx
Definition: btr0pcur.h:502
bool move_to_prev(mtr_t *mtr)
Moves the persistent cursor to the previous record in the tree.
Definition: btr0pcur.cc:413
void move_to_prev_on_page()
Moves the persistent cursor to the prev record on the same page.
Definition: btr0pcur.h:818
void open_at_side(bool from_left, dict_index_t *index, ulint latch_mode, bool init_pcur, ulint level, mtr_t *mtr)
Opens a persistent cursor at either end of an index.
Definition: btr0pcur.h:551
void free_rec_buf()
Free old_rec_buf.
Definition: btr0pcur.h:233
bool is_clustered() const
Definition: btr0pcur.h:383
pcur_pos_t m_pos_state
position() and restore_position() state.
Definition: btr0pcur.h:479
bool m_old_stored
true if old_rec is stored
Definition: btr0pcur.h:458
void open_no_init(dict_index_t *index, const dtuple_t *tuple, page_cur_mode_t mode, ulint latch_mode, ulint has_search_latch, mtr_t *mtr, ut::Location location)
Opens an persistent cursor to an index tree without initializing the cursor.
Definition: btr0pcur.h:597
btr_pcur_pos_t m_rel_pos
BTR_PCUR_ON, BTR_PCUR_BEFORE, or BTR_PCUR_AFTER, depending on whether cursor was on,...
Definition: btr0pcur.h:469
static btr_pcur_t * create_for_mysql()
Allocates memory for a persistent cursor object and initializes the cursor.
Definition: btr0pcur.h:398
dict_index_t * index()
Definition: btr0pcur.h:105
bool set_random_position(dict_index_t *index, ulint latch_mode, mtr_t *mtr, ut::Location location)
Positions a cursor at a randomly chosen position within a B-tree.
Definition: btr0pcur.h:577
dberr_t move_to_next_user_rec(mtr_t *mtr)
Moves the persistent cursor to the next user record in the tree.
Definition: btr0pcur.h:836
ulint get_low_match() const
Gets the low_match value for a pcur after a search.
Definition: btr0pcur.h:755
bool is_after_last_on_page() const
Checks if the persistent cursor is after the last user record on a page.
Definition: btr0pcur.h:766
ulint get_rel_pos() const
Gets the rel_pos field for a cursor whose position has been stored.
Definition: btr0pcur.h:714
bool move_to_next(mtr_t *mtr)
Moves the persistent cursor to the next record in the tree.
Definition: btr0pcur.h:859
buf_block_t * get_block()
Returns the current buffer block (non const version).
Definition: btr0pcur.h:655
bool is_positioned() const
Definition: btr0pcur.h:377
ulint m_latch_mode
see TODO note below! BTR_SEARCH_LEAF, BTR_MODIFY_LEAF, BTR_MODIFY_TREE or BTR_NO_LATCHES,...
Definition: btr0pcur.h:455
page_cur_mode_t m_search_mode
PAGE_CUR_G, ...
Definition: btr0pcur.h:482
static void copy_stored_position(btr_pcur_t *dst, const btr_pcur_t *src)
Copies the stored position of a pcur to another pcur.
Definition: btr0pcur.cc:115
void open_on_user_rec(dict_index_t *index, const dtuple_t *tuple, page_cur_mode_t mode, ulint latch_mode, mtr_t *mtr, ut::Location location)
If mode is PAGE_CUR_G or PAGE_CUR_GE, opens a persistent cursor on the first user record satisfying t...
Definition: btr0pcur.cc:434
static void free_for_mysql(btr_pcur_t *&pcur)
Frees the memory for a persistent cursor object and the cursor itself.
Definition: btr0pcur.h:410
void begin_leaf(dict_index_t *index, ulint latch_mode, mtr_t *mtr)
Opens a persistent cursor at first leaf page (low end).
Definition: btr0pcur.h:133
void move_to_next_page(mtr_t *mtr)
Moves the persistent cursor to the first record on the next page.
Definition: btr0pcur.cc:295
uint64_t m_modify_clock
the modify clock value of the buffer block when the cursor position was stored
Definition: btr0pcur.h:476
size_t m_buf_size
old_rec_buf size if old_rec_buf is not nullptr
Definition: btr0pcur.h:495
void move_to_next_on_page()
Moves the persistent cursor to the next record on the same page.
Definition: btr0pcur.h:809
void close()
Frees the possible memory heap of a persistent cursor and sets the latch mode of the persistent curso...
Definition: btr0pcur.h:723
void commit_specify_mtr(mtr_t *mtr)
Commits the mtr and sets the pcur latch mode to BTR_NO_LATCHES, that is, the cursor becomes detached.
Definition: btr0pcur.h:880
void move_to_last_on_page(mtr_t *mtr)
Moves the persistent cursor to the last record on the same page.
Definition: btr0pcur.h:827
Page_fetch set_fetch_type(Page_fetch fetch_mode)
Set the cursor access type: Normal or Scan.
Definition: btr0pcur.h:421
void move_backward_from_page(mtr_t *mtr)
Moves the persistent cursor backward if it is on the first record of the page.
Definition: btr0pcur.cc:355
void init(size_t read_level=0)
Sets the old_rec_buf field to nullptr.
Definition: btr0pcur.h:505
ulint m_old_n_fields
number of fields in old_rec
Definition: btr0pcur.h:465
void move_before_first_on_page()
Moves the persistent cursor to the infimum record on the same page.
Definition: btr0pcur.h:890
ulint get_up_match() const
Gets the up_match value for a pcur after a search.
Definition: btr0pcur.h:744
bool is_before_first_on_page() const
Checks if the persistent cursor is before the first user record on a page.
Definition: btr0pcur.h:773
bool is_before_first_in_tree(mtr_t *mtr) const
Checks if the persistent cursor is before the first user record in the index tree.
Definition: btr0pcur.h:787
page_t * get_page()
Returns the page of a persistent pcur (non const version).
Definition: btr0pcur.h:643
void open(dict_index_t *index, ulint level, const dtuple_t *tuple, page_cur_mode_t mode, ulint latch_mode, mtr_t *mtr, ut::Location location)
Initializes and opens a persistent cursor to an index tree It should be closed with btr_pcur::close.
Definition: btr0pcur.h:517
page_cur_t * get_page_cur()
Definition: btr0pcur.h:635
bool is_on_user_rec() const
Checks if the persistent cursor is on a user record.
Definition: btr0pcur.h:780
const btr_cur_t * get_btr_cur() const
Definition: btr0pcur.h:628
trx_t * m_trx_if_known
the transaction, if we know it; otherwise this field is not defined; can ONLY BE USED in error prints...
Definition: btr0pcur.h:486
void reset()
Resets a persistent cursor object, freeing "::old_rec_buf" if it is allocated and resetting the other...
Definition: btr0pcur.h:898
rec_t * m_old_rec
if cursor position is stored, contains an initial segment of the latest record cursor was positioned ...
Definition: btr0pcur.h:462
btr_cur_t m_btr_cur
a B-tree cursor
Definition: btr0pcur.h:446
void store_position(mtr_t *mtr)
The position of the cursor is stored by taking an initial segment of the record the cursor is positio...
Definition: btr0pcur.cc:41
ulint m_read_level
Read level where the cursor would be positioned or re-positioned.
Definition: btr0pcur.h:498
buf::Block_hint m_block_when_stored
buffer block when the position was stored
Definition: btr0pcur.h:472
byte * m_old_rec_buf
nullptr, or a dynamically allocated buffer for old_rec
Definition: btr0pcur.h:492
bool is_after_last_in_tree(mtr_t *mtr) const
Checks if the persistent cursor is after the last user record in the index tree.
Definition: btr0pcur.h:798
rec_t * get_rec()
Returns the current record (non const version).
Definition: btr0pcur.h:667
The buffer control block structure.
Definition: buf0buf.h:1688
byte * frame
pointer to buffer frame which is of size UNIV_PAGE_SIZE, and aligned to an address divisible by UNIV_...
Definition: buf0buf.h:1704
Data structure for an index.
Definition: dict0mem.h:1045
bool is_clustered() const
Definition: dict0mem.h:1310
dict_table_t * table
back pointer to table
Definition: dict0mem.h:1059
bool is_intrinsic() const
Determine whether the table is intrinsic.
Definition: dict0mem.h:2685
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:681
Definition: btr0pcur.h:90
bool is_error
Definition: btr0pcur.h:92
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:181
Index page cursor.
Definition: page0cur.h:310
buf_block_t * block
Pointer to the current block containing rec.
Definition: page0cur.h:321
rec_t * rec
pointer to a record on page
Definition: page0cur.h:315
Definition: trx0trx.h:685
const char * filename
Definition: ut0core.h:33
size_t line
Definition: ut0core.h:34
Version control for database, common definitions, and include files.
unsigned long int ulint
Definition: univ.i:405
constexpr ulint ULINT_UNDEFINED
The 'undefined' value for a ulint.
Definition: univ.i:419
#define UT_LOCATION_HERE
Definition: ut0core.h:46
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:68
#define UT_NOT_USED(A)
Silence warnings about an unused variable by doing a null assignment.
Definition: ut0dbg.h:105
#define UT_NEW_THIS_FILE_PSI_KEY
Definition: ut0new.h:562