103 void init(
size_t read_level = 0);
239#ifndef UNIV_HOTBACKUP
283#ifndef UNIV_HOTBACKUP
402 pcur->m_btr_cur.index =
nullptr;
429 return (old_fetch_mode);
553 ulint latch_mode,
bool init_pcur,
618 cur, has_search_latch, location.
filename,
713#ifndef UNIV_HOTBACKUP
753 return (cur->up_match);
764 return (cur->low_match);
constexpr ulint BTR_LATCH_MODE_WITHOUT_FLAGS(ulint latch_mode)
Definition: btr0btr.h:133
@ BTR_MODIFY_TREE
Start modifying the entire B-tree.
Definition: btr0btr.h:70
@ BTR_MODIFY_LEAF
(Prepare to) modify a record on a leaf page and X-latch it.
Definition: btr0btr.h:66
@ BTR_NO_LATCHES
Obtain no latches.
Definition: btr0btr.h:68
@ BTR_SEARCH_LEAF
Search a record on a leaf page and S-latch it.
Definition: btr0btr.h:64
ulint BTR_LATCH_MODE_WITHOUT_INTENTION(ulint latch_mode)
Definition: btr0btr.h:141
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:1851
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
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
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
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:1716
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:65
@ 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:83
@ BTR_PCUR_IS_POSITIONED
The persistent cursor is positioned by index search.
Definition: btr0pcur.h:87
@ BTR_PCUR_NOT_POSITIONED
The persistent cursor is not positioned.
Definition: btr0pcur.h:68
@ BTR_PCUR_WAS_POSITIONED
The persistent cursor was previously positioned.
Definition: btr0pcur.h:77
btr_pcur_pos_t
Relative positions for a stored cursor position.
Definition: btr0pcur.h:51
@ BTR_PCUR_AFTER_LAST_IN_TREE
Definition: btr0pcur.h:61
@ BTR_PCUR_ON
Definition: btr0pcur.h:53
@ BTR_PCUR_BEFORE_FIRST_IN_TREE
Definition: btr0pcur.h:60
@ BTR_PCUR_UNSET
Definition: btr0pcur.h:52
@ BTR_PCUR_AFTER
Definition: btr0pcur.h:55
@ BTR_PCUR_BEFORE
Definition: btr0pcur.h:54
The index tree general types.
Page_fetch
Definition: buf0buf.h:58
@ SCAN
Same as NORMAL, but hint that the fetch is part of a large scan.
Definition: buf0block_hint.h:32
void clear()
Clears currently stored pointer.
Definition: buf0block_hint.cc:38
SQL data field and tuple.
dberr_t
Definition: db0err.h:39
@ DB_SUCCESS
Definition: db0err.h:43
@ DB_END_OF_INDEX
Definition: db0err.h:219
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:1159
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:59
mode
Definition: file_handle.h:61
void delete_(T *ptr) noexcept
Releases storage which has been dynamically allocated through any of the ut::new*() variants.
Definition: ut0new.h:810
void free(void *ptr) noexcept
Releases storage which has been dynamically allocated through any of the ut::malloc*(),...
Definition: ut0new.h:718
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:176
@ PAGE_CUR_G
Definition: page0types.h:178
@ PAGE_CUR_UNSUPP
Definition: page0types.h:177
@ PAGE_CUR_L
Definition: page0types.h:180
byte page_t
Type of the index page.
Definition: page0types.h:152
byte rec_t
Definition: rem0types.h:41
The tree cursor: the definition appears here only for the compiler to know struct size!
Definition: btr0cur.h:668
dict_index_t * index
Index on which the cursor is positioned.
Definition: btr0cur.h:670
page_cur_t page_cur
Page cursor.
Definition: btr0cur.h:672
rtr_info_t * rtr_info
rtree search info.
Definition: btr0cur.h:733
Page_fetch m_fetch_mode
If cursor is used in a scan or simple page fetch.
Definition: btr0cur.h:739
Definition: btr0pcur.h:99
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:147
import_ctx_t * import_ctx
Definition: btr0pcur.h:503
bool move_to_prev(mtr_t *mtr)
Moves the persistent cursor to the previous record in the tree.
Definition: btr0pcur.cc:418
void move_to_prev_on_page()
Moves the persistent cursor to the prev record on the same page.
Definition: btr0pcur.h:819
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:552
void free_rec_buf()
Free old_rec_buf.
Definition: btr0pcur.h:234
bool is_clustered() const
Definition: btr0pcur.h:384
pcur_pos_t m_pos_state
position() and restore_position() state.
Definition: btr0pcur.h:480
bool m_old_stored
true if old_rec is stored
Definition: btr0pcur.h:459
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:598
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:470
static btr_pcur_t * create_for_mysql()
Allocates memory for a persistent cursor object and initializes the cursor.
Definition: btr0pcur.h:399
dict_index_t * index()
Definition: btr0pcur.h:106
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:578
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:837
ulint get_low_match() const
Gets the low_match value for a pcur after a search.
Definition: btr0pcur.h:756
bool is_after_last_on_page() const
Checks if the persistent cursor is after the last user record on a page.
Definition: btr0pcur.h:767
ulint get_rel_pos() const
Gets the rel_pos field for a cursor whose position has been stored.
Definition: btr0pcur.h:715
bool move_to_next(mtr_t *mtr)
Moves the persistent cursor to the next record in the tree.
Definition: btr0pcur.h:860
buf_block_t * get_block()
Returns the current buffer block (non const version).
Definition: btr0pcur.h:656
bool is_positioned() const
Definition: btr0pcur.h:378
ulint m_latch_mode
see TODO note below! BTR_SEARCH_LEAF, BTR_MODIFY_LEAF, BTR_MODIFY_TREE or BTR_NO_LATCHES,...
Definition: btr0pcur.h:456
page_cur_mode_t m_search_mode
PAGE_CUR_G, ...
Definition: btr0pcur.h:483
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:116
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:439
static void free_for_mysql(btr_pcur_t *&pcur)
Frees the memory for a persistent cursor object and the cursor itself.
Definition: btr0pcur.h:411
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:134
void move_to_next_page(mtr_t *mtr)
Moves the persistent cursor to the first record on the next page.
Definition: btr0pcur.cc:296
uint64_t m_modify_clock
the modify clock value of the buffer block when the cursor position was stored
Definition: btr0pcur.h:477
size_t m_buf_size
old_rec_buf size if old_rec_buf is not nullptr
Definition: btr0pcur.h:496
void move_to_next_on_page()
Moves the persistent cursor to the next record on the same page.
Definition: btr0pcur.h:810
void close()
Frees the possible memory heap of a persistent cursor and sets the latch mode of the persistent curso...
Definition: btr0pcur.h:724
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:881
void move_to_last_on_page(mtr_t *mtr)
Moves the persistent cursor to the last record on the same page.
Definition: btr0pcur.h:828
Page_fetch set_fetch_type(Page_fetch fetch_mode)
Set the cursor access type: Normal or Scan.
Definition: btr0pcur.h:422
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:360
void init(size_t read_level=0)
Sets the old_rec_buf field to nullptr.
Definition: btr0pcur.h:506
ulint m_old_n_fields
number of fields in old_rec
Definition: btr0pcur.h:466
void move_before_first_on_page()
Moves the persistent cursor to the infimum record on the same page.
Definition: btr0pcur.h:891
ulint get_up_match() const
Gets the up_match value for a pcur after a search.
Definition: btr0pcur.h:745
bool is_before_first_on_page() const
Checks if the persistent cursor is before the first user record on a page.
Definition: btr0pcur.h:774
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:788
page_t * get_page()
Returns the page of a persistent pcur (non const version).
Definition: btr0pcur.h:644
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:518
page_cur_t * get_page_cur()
Definition: btr0pcur.h:636
bool is_on_user_rec() const
Checks if the persistent cursor is on a user record.
Definition: btr0pcur.h:781
const btr_cur_t * get_btr_cur() const
Definition: btr0pcur.h:629
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:487
void reset()
Resets a persistent cursor object, freeing "::old_rec_buf" if it is allocated and resetting the other...
Definition: btr0pcur.h:899
rec_t * m_old_rec
if cursor position is stored, contains an initial segment of the latest record cursor was positioned ...
Definition: btr0pcur.h:463
btr_cur_t m_btr_cur
a B-tree cursor
Definition: btr0pcur.h:447
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:42
ulint m_read_level
Read level where the cursor would be positioned or re-positioned.
Definition: btr0pcur.h:499
buf::Block_hint m_block_when_stored
buffer block when the position was stored
Definition: btr0pcur.h:473
byte * m_old_rec_buf
nullptr, or a dynamically allocated buffer for old_rec
Definition: btr0pcur.h:493
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:799
rec_t * get_rec()
Returns the current record (non const version).
Definition: btr0pcur.h:668
The buffer control block structure.
Definition: buf0buf.h:1747
byte * frame
pointer to buffer frame which is of size UNIV_PAGE_SIZE, and aligned to an address divisible by UNIV_...
Definition: buf0buf.h:1769
Data structure for an index.
Definition: dict0mem.h:1046
bool is_clustered() const
Definition: dict0mem.h:1311
dict_table_t * table
back pointer to table
Definition: dict0mem.h:1060
bool is_intrinsic() const
Determine whether the table is intrinsic.
Definition: dict0mem.h:2696
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:694
Definition: btr0pcur.h:91
bool is_error
Definition: btr0pcur.h:93
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:177
Index page cursor.
Definition: page0cur.h:311
buf_block_t * block
Pointer to the current block containing rec.
Definition: page0cur.h:322
rec_t * rec
pointer to a record on page
Definition: page0cur.h:316
Definition: trx0trx.h:675
const char * filename
Definition: ut0core.h:37
size_t line
Definition: ut0core.h:38
Version control for database, common definitions, and include files.
unsigned long int ulint
Definition: univ.i:406
constexpr ulint ULINT_UNDEFINED
The 'undefined' value for a ulint.
Definition: univ.i:420
#define UT_LOCATION_HERE
Definition: ut0core.h:73
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:105
#define UT_NOT_USED(A)
Silence warnings about an unused variable by doing a null assignment.
Definition: ut0dbg.h:158
#define UT_NEW_THIS_FILE_PSI_KEY
Definition: ut0new.h:565