#include "univ.i"
#include "dict0dict.h"
#include "data0data.h"
#include "mtr0mtr.h"
#include "page0cur.h"
#include "btr0cur.h"
#include "btr0btr.h"
#include "btr0types.h"
Go to the source code of this file.
Classes | |
struct | btr_pcur_struct |
Macros | |
#define | btr0pcur_h |
#define | BTR_PCUR_ON 1 |
#define | BTR_PCUR_BEFORE 2 |
#define | BTR_PCUR_AFTER 3 |
#define | BTR_PCUR_BEFORE_FIRST_IN_TREE 4 /* in an empty tree */ |
#define | BTR_PCUR_AFTER_LAST_IN_TREE 5 /* in an empty tree */ |
#define | btr_pcur_open(i, t, md, l, c, m) btr_pcur_open_func(i,t,md,l,c,__FILE__,__LINE__,m) |
#define | btr_pcur_open_with_no_init(ix, t, md, l, cur, has, m) btr_pcur_open_with_no_init_func(ix,t,md,l,cur,has,__FILE__,__LINE__,m) |
#define | btr_pcur_open_on_user_rec(i, t, md, l, c, m) btr_pcur_open_on_user_rec_func(i,t,md,l,c,__FILE__,__LINE__,m) |
#define | btr_pcur_open_at_rnd_pos(i, l, c, m) btr_pcur_open_at_rnd_pos_func(i,l,c,__FILE__,__LINE__,m) |
#define | btr_pcur_restore_position(l, cur, mtr) btr_pcur_restore_position_func(l,cur,__FILE__,__LINE__,mtr) |
#define | btr_pcur_get_btr_cur(cursor) (&(cursor)->btr_cur) |
#define | btr_pcur_get_page_cur(cursor) (&(cursor)->btr_cur.page_cur) |
#define | BTR_PCUR_IS_POSITIONED |
#define | BTR_PCUR_WAS_POSITIONED 1187549791 |
#define | BTR_PCUR_NOT_POSITIONED 1328997689 |
#define | BTR_PCUR_OLD_STORED 908467085 |
#define | BTR_PCUR_OLD_NOT_STORED 122766467 |
Functions | |
UNIV_INTERN btr_pcur_t * | btr_pcur_create_for_mysql (void) |
UNIV_INTERN void | btr_pcur_free_for_mysql (btr_pcur_t *cursor) |
UNIV_INTERN void | btr_pcur_copy_stored_position (btr_pcur_t *pcur_receive, btr_pcur_t *pcur_donate) |
UNIV_INLINE void | btr_pcur_init (btr_pcur_t *pcur) |
UNIV_INLINE void | btr_pcur_open_func (dict_index_t *index, const dtuple_t *tuple, ulint mode, ulint latch_mode, btr_pcur_t *cursor, const char *file, ulint line, mtr_t *mtr) |
UNIV_INLINE void | btr_pcur_open_with_no_init_func (dict_index_t *index, const dtuple_t *tuple, ulint mode, ulint latch_mode, btr_pcur_t *cursor, ulint has_search_latch, const char *file, ulint line, mtr_t *mtr) |
UNIV_INLINE void | btr_pcur_open_at_index_side (ibool from_left, dict_index_t *index, ulint latch_mode, btr_pcur_t *pcur, ibool do_init, mtr_t *mtr) |
UNIV_INLINE ulint | btr_pcur_get_up_match (btr_pcur_t *cursor) |
UNIV_INLINE ulint | btr_pcur_get_low_match (btr_pcur_t *cursor) |
UNIV_INTERN void | btr_pcur_open_on_user_rec_func (dict_index_t *index, const dtuple_t *tuple, ulint mode, ulint latch_mode, btr_pcur_t *cursor, const char *file, ulint line, mtr_t *mtr) |
UNIV_INLINE void | btr_pcur_open_at_rnd_pos_func (dict_index_t *index, ulint latch_mode, btr_pcur_t *cursor, const char *file, ulint line, mtr_t *mtr) |
UNIV_INLINE void | btr_pcur_close (btr_pcur_t *cursor) |
UNIV_INTERN void | btr_pcur_store_position (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INTERN ibool | btr_pcur_restore_position_func (ulint latch_mode, btr_pcur_t *cursor, const char *file, ulint line, mtr_t *mtr) |
UNIV_INTERN void | btr_pcur_release_leaf (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INLINE ulint | btr_pcur_get_rel_pos (const btr_pcur_t *cursor) |
UNIV_INLINE void | btr_pcur_set_mtr (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INLINE mtr_t * | btr_pcur_get_mtr (btr_pcur_t *cursor) |
UNIV_INLINE void | btr_pcur_commit_specify_mtr (btr_pcur_t *pcur, mtr_t *mtr) |
UNIV_INLINE ibool | btr_pcur_move_to_next (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INTERN ibool | btr_pcur_move_to_prev (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INLINE void | btr_pcur_move_to_last_on_page (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INLINE ibool | btr_pcur_move_to_next_user_rec (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INTERN void | btr_pcur_move_to_next_page (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INTERN void | btr_pcur_move_backward_from_page (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INLINE page_t * | btr_pcur_get_page (btr_pcur_t *cursor) |
UNIV_INLINE buf_block_t * | btr_pcur_get_block (btr_pcur_t *cursor) |
UNIV_INLINE rec_t * | btr_pcur_get_rec (btr_pcur_t *cursor) |
UNIV_INLINE ibool | btr_pcur_is_on_user_rec (const btr_pcur_t *cursor) |
UNIV_INLINE ibool | btr_pcur_is_after_last_on_page (const btr_pcur_t *cursor) |
UNIV_INLINE ibool | btr_pcur_is_before_first_on_page (const btr_pcur_t *cursor) |
UNIV_INLINE ibool | btr_pcur_is_before_first_in_tree (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INLINE ibool | btr_pcur_is_after_last_in_tree (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INLINE void | btr_pcur_move_to_next_on_page (btr_pcur_t *cursor) |
UNIV_INLINE void | btr_pcur_move_to_prev_on_page (btr_pcur_t *cursor) |
#define BTR_PCUR_IS_POSITIONED |
Definition at line 522 of file btr0pcur.h.
UNIV_INLINE void btr_pcur_close | ( | btr_pcur_t * | cursor) |
Frees the possible old_rec_buf buffer of a persistent cursor and sets the latch mode of the persistent cursor to BTR_NO_LATCHES. in: persistent cursor
Referenced by dict_check_tablespaces_and_store_max_id(), dict_get_first_table_name_in_db(), dict_load_foreigns(), dict_load_table(), dict_load_table_on_id(), ibuf_merge_or_delete_for_page(), row_get_clust_rec(), row_ins_check_foreign_constraint(), row_merge_drop_temp_indexes(), row_mysql_drop_temp_tables(), row_search_max_autoinc(), row_truncate_table_for_mysql(), and sel_node_free_private().
UNIV_INLINE void btr_pcur_commit_specify_mtr | ( | btr_pcur_t * | pcur, |
mtr_t * | mtr | ||
) |
Commits the mtr and sets the pcur latch mode to BTR_NO_LATCHES, that is, the cursor becomes detached. If there have been modifications to the page where pcur is positioned, this can be used instead of btr_pcur_release_leaf. Function btr_pcur_store_position should be used before calling this, if restoration of cursor is wanted later. in: mtr to commit
pcur | in: persistent cursor |
Referenced by ibuf_merge_or_delete_for_page(), row_merge_drop_temp_indexes(), row_mysql_drop_temp_tables(), row_purge_poss_sec(), and row_undo_search_clust_to_pcur().
UNIV_INTERN void btr_pcur_copy_stored_position | ( | btr_pcur_t * | pcur_receive, |
btr_pcur_t * | pcur_donate | ||
) |
Copies the stored position of a pcur to another pcur. in: pcur from which the info is copied
Copies the stored position of a pcur to another pcur.
pcur_receive | in: pcur which will receive the position info |
pcur_donate | in: pcur from which the info is copied |
Definition at line 165 of file btr0pcur.cc.
References btr_pcur_struct::buf_size, mem_free, btr_pcur_struct::old_n_fields, btr_pcur_struct::old_rec, btr_pcur_struct::old_rec_buf, and ut_memcpy().
UNIV_INTERN btr_pcur_t* btr_pcur_create_for_mysql | ( | void | ) |
Allocates memory for a persistent cursor object and initializes the cursor.
Definition at line 41 of file btr0pcur.cc.
References btr_pcur_struct::btr_cur, btr_pcur_init(), and btr_cur_struct::index.
UNIV_INTERN void btr_pcur_free_for_mysql | ( | btr_pcur_t * | cursor) |
Frees the memory for a persistent cursor object. in, own: persistent cursor
Frees the memory for a persistent cursor object.
cursor | in, own: persistent cursor |
Definition at line 58 of file btr0pcur.cc.
References btr_pcur_struct::btr_cur, BTR_NO_LATCHES, btr_pcur_struct::latch_mode, mem_free, btr_pcur_struct::old_n_fields, btr_pcur_struct::old_rec, btr_pcur_struct::old_rec_buf, btr_pcur_struct::old_stored, btr_cur_struct::page_cur, btr_pcur_struct::pos_state, and page_cur_struct::rec.
UNIV_INLINE buf_block_t* btr_pcur_get_block | ( | btr_pcur_t * | cursor) |
Returns the buffer block of a persistent cursor.
Referenced by btr_pcur_move_backward_from_page(), btr_pcur_move_to_next_page(), btr_pcur_release_leaf(), btr_pcur_restore_position_func(), btr_pcur_store_position(), row_ins_check_foreign_constraint(), row_search_for_mysql(), and row_unlock_for_mysql().
UNIV_INLINE ulint btr_pcur_get_low_match | ( | btr_pcur_t * | cursor) |
Gets the low_match value for a pcur after a search.
Referenced by row_search_index_entry(), and row_search_on_row_ref().
UNIV_INLINE mtr_t* btr_pcur_get_mtr | ( | btr_pcur_t * | cursor) |
Gets the mtr field for a pcur.
UNIV_INLINE page_t* btr_pcur_get_page | ( | btr_pcur_t * | cursor) |
Returns the page of a persistent cursor.
Referenced by btr_pcur_move_backward_from_page(), btr_pcur_move_to_next_page(), and row_search_max_autoinc().
UNIV_INLINE rec_t* btr_pcur_get_rec | ( | btr_pcur_t * | cursor) |
Returns the record of a persistent cursor.
Referenced by btr_pcur_restore_position_func(), btr_search_guess_on_hash(), dict_check_tablespaces_and_store_max_id(), dict_get_first_table_name_in_db(), dict_load_foreigns(), dict_load_table(), dict_load_table_on_id(), dict_truncate_index_tree(), ibuf_merge_or_delete_for_page(), row_get_clust_rec(), row_ins_check_foreign_constraint(), row_merge_drop_temp_indexes(), row_mysql_drop_temp_tables(), row_purge_poss_sec(), row_search_for_mysql(), row_search_index_entry(), row_search_on_row_ref(), row_truncate_table_for_mysql(), row_undo_search_clust_to_pcur(), and row_unlock_for_mysql().
UNIV_INLINE ulint btr_pcur_get_rel_pos | ( | const btr_pcur_t * | cursor) |
Gets the rel_pos field for a cursor whose position has been stored.
UNIV_INLINE ulint btr_pcur_get_up_match | ( | btr_pcur_t * | cursor) |
Gets the up_match value for a pcur after a search.
UNIV_INLINE void btr_pcur_init | ( | btr_pcur_t * | pcur) |
Sets the old_rec_buf field to NULL. in: persistent cursor
Referenced by btr_pcur_create_for_mysql(), and row_undo_node_create().
UNIV_INLINE ibool btr_pcur_is_after_last_in_tree | ( | btr_pcur_t * | cursor, |
mtr_t * | mtr | ||
) |
Checks if the persistent cursor is after the last user record in the index tree. in: mtr
cursor | in: persistent cursor |
Referenced by ibuf_merge_or_delete_for_page().
UNIV_INLINE ibool btr_pcur_is_after_last_on_page | ( | const btr_pcur_t * | cursor) |
Checks if the persistent cursor is after the last user record on a page. in: persistent cursor
Referenced by btr_pcur_move_to_next_page(), btr_pcur_open_on_user_rec_func(), and ibuf_merge_or_delete_for_page().
UNIV_INLINE ibool btr_pcur_is_before_first_in_tree | ( | btr_pcur_t * | cursor, |
mtr_t * | mtr | ||
) |
Checks if the persistent cursor is before the first user record in the index tree. in: mtr
cursor | in: persistent cursor |
Referenced by btr_pcur_move_backward_from_page(), and btr_pcur_move_to_prev().
UNIV_INLINE ibool btr_pcur_is_before_first_on_page | ( | const btr_pcur_t * | cursor) |
Checks if the persistent cursor is before the first user record on a page. in: persistent cursor
Referenced by btr_pcur_move_backward_from_page(), and btr_pcur_move_to_prev().
UNIV_INLINE ibool btr_pcur_is_on_user_rec | ( | const btr_pcur_t * | cursor) |
Checks if the persistent cursor is on a user record. in: persistent cursor
Referenced by btr_pcur_restore_position_func(), dict_check_tablespaces_and_store_max_id(), dict_get_first_table_name_in_db(), dict_load_foreigns(), dict_load_table(), dict_load_table_on_id(), ibuf_merge_or_delete_for_page(), row_merge_drop_temp_indexes(), row_mysql_drop_temp_tables(), and row_truncate_table_for_mysql().
UNIV_INTERN void btr_pcur_move_backward_from_page | ( | btr_pcur_t * | cursor, |
mtr_t * | mtr | ||
) |
Moves the persistent cursor backward if it is on the first record of the page. Releases the latch on the current page, and bufferunfixes it. Note that to prevent a possible deadlock, the operation first stores the position of the cursor, releases the leaf latch, acquires necessary latches and restores the cursor position again before returning. The alphabetical position of the cursor is guaranteed to be sensible on return, but it may happen that the cursor is not positioned on the last record of any page, because the structure of the tree may have changed while the cursor had no latches. in: mtr
Moves the persistent cursor backward if it is on the first record of the page. Commits mtr. Note that to prevent a possible deadlock, the operation first stores the position of the cursor, commits mtr, acquires the necessary latches and restores the cursor position again before returning. The alphabetical position of the cursor is guaranteed to be sensible on return, but it may happen that the cursor is not positioned on the last record of any page, because the structure of the tree may have changed during the time when the cursor had no latches.
cursor | in: persistent cursor, must be on the first record of the current page |
mtr | in: mtr |
Definition at line 450 of file btr0pcur.cc.
References btr_leaf_page_release(), BTR_MODIFY_LEAF, BTR_MODIFY_PREV, BTR_NO_LATCHES, btr_page_get_prev(), btr_pcur_get_block(), btr_pcur_get_page(), btr_pcur_is_before_first_in_tree(), btr_pcur_is_before_first_on_page(), BTR_SEARCH_LEAF, BTR_SEARCH_PREV, FIL_NULL, btr_pcur_struct::latch_mode, mtr_commit(), mtr_start(), btr_pcur_struct::old_stored, page_cur_set_after_last(), btr_pcur_struct::pos_state, ut_a, ut_ad, and ut_error.
UNIV_INLINE void btr_pcur_move_to_last_on_page | ( | btr_pcur_t * | cursor, |
mtr_t * | mtr | ||
) |
Moves the persistent cursor to the last record on the same page. in: mtr
cursor | in: persistent cursor |
Referenced by row_search_for_mysql().
UNIV_INLINE ibool btr_pcur_move_to_next | ( | btr_pcur_t * | cursor, |
mtr_t * | mtr | ||
) |
Moves the persistent cursor to the next record in the tree. If no records are left, the cursor stays 'after last in tree'.
cursor | in: persistent cursor; NOTE that the function may release the page latch |
Referenced by row_ins_check_foreign_constraint(), and row_search_for_mysql().
UNIV_INLINE void btr_pcur_move_to_next_on_page | ( | btr_pcur_t * | cursor) |
Moves the persistent cursor to the next record on the same page. in/out: persistent cursor
UNIV_INTERN void btr_pcur_move_to_next_page | ( | btr_pcur_t * | cursor, |
mtr_t * | mtr | ||
) |
Moves the persistent cursor to the first record on the next page. Releases the latch on the current page, and bufferunfixes it. Note that there must not be modifications on the current page, as then the x-latch can be released only in mtr_commit. in: mtr
Moves the persistent cursor to the first record on the next page. Releases the latch on the current page, and bufferunfixes it. Note that there must not be modifications on the current page, as then the x-latch can be released only in mtr_commit.
cursor | in: persistent cursor; must be on the last record of the current page |
mtr | in: mtr |
Definition at line 395 of file btr0pcur.cc.
References btr_block_get, btr_leaf_page_release(), BTR_NO_LATCHES, btr_page_get_next(), btr_page_get_prev(), btr_pcur_get_block(), btr_pcur_get_page(), btr_pcur_is_after_last_on_page(), buf_block_get_page_no(), buf_block_get_space(), buf_block_get_zip_size(), buf_block_struct::check_index_page_at_flush, FIL_NULL, btr_pcur_struct::latch_mode, btr_pcur_struct::old_stored, page_check_dir(), page_cur_set_before_first(), page_is_comp(), btr_pcur_struct::pos_state, ut_a, and ut_ad.
UNIV_INLINE ibool btr_pcur_move_to_next_user_rec | ( | btr_pcur_t * | cursor, |
mtr_t * | mtr | ||
) |
Moves the persistent cursor to the next user record in the tree. If no user records are left, the cursor ends up 'after last in tree'.
cursor | in: persistent cursor; NOTE that the function may release the page latch |
Referenced by btr_pcur_open_on_user_rec_func(), dict_check_tablespaces_and_store_max_id(), dict_get_first_table_name_in_db(), dict_load_foreigns(), dict_load_table_on_id(), row_merge_drop_temp_indexes(), row_mysql_drop_temp_tables(), and row_truncate_table_for_mysql().
UNIV_INTERN ibool btr_pcur_move_to_prev | ( | btr_pcur_t * | cursor, |
mtr_t * | mtr | ||
) |
Moves the persistent cursor to the previous record in the tree. If no records are left, the cursor stays 'before first in tree'.
Moves the persistent cursor to the previous record in the tree. If no records are left, the cursor stays 'before first in tree'.
cursor | in: persistent cursor; NOTE that the function may release the page latch |
mtr | in: mtr |
Definition at line 525 of file btr0pcur.cc.
References BTR_NO_LATCHES, btr_pcur_is_before_first_in_tree(), btr_pcur_is_before_first_on_page(), btr_pcur_move_to_prev_on_page(), btr_pcur_struct::latch_mode, btr_pcur_struct::old_stored, btr_pcur_struct::pos_state, and ut_ad.
UNIV_INLINE void btr_pcur_move_to_prev_on_page | ( | btr_pcur_t * | cursor) |
Moves the persistent cursor to the previous record on the same page. in/out: persistent cursor
Referenced by btr_pcur_move_to_prev().
UNIV_INLINE void btr_pcur_open_at_index_side | ( | ibool | from_left, |
dict_index_t * | index, | ||
ulint | latch_mode, | ||
btr_pcur_t * | pcur, | ||
ibool | do_init, | ||
mtr_t * | mtr | ||
) |
Opens a persistent cursor at either end of an index. in: mtr
from_left | in: TRUE if open to the low end, FALSE if to the high end |
index | in: index |
latch_mode | in: latch mode |
pcur | in: cursor |
do_init | in: TRUE if should be initialized |
Referenced by dict_check_tablespaces_and_store_max_id(), dict_startscan_system(), row_merge_drop_temp_indexes(), row_mysql_drop_temp_tables(), row_search_for_mysql(), and row_search_max_autoinc().
UNIV_INLINE void btr_pcur_open_at_rnd_pos_func | ( | dict_index_t * | index, |
ulint | latch_mode, | ||
btr_pcur_t * | cursor, | ||
const char * | file, | ||
ulint | line, | ||
mtr_t * | mtr | ||
) |
Positions a cursor at a randomly chosen position within a B-tree. in: mtr
index | in: index |
latch_mode | in: BTR_SEARCH_LEAF, ... |
cursor | in/out: B-tree pcur |
file | in: file name |
line | in: line where called |
UNIV_INLINE void btr_pcur_open_func | ( | dict_index_t * | index, |
const dtuple_t * | tuple, | ||
ulint | mode, | ||
ulint | latch_mode, | ||
btr_pcur_t * | cursor, | ||
const char * | file, | ||
ulint | line, | ||
mtr_t * | mtr | ||
) |
Initializes and opens a persistent cursor to an index tree. It should be closed with btr_pcur_close. in: mtr
index | in: index |
tuple | in: tuple on which search done |
mode | in: PAGE_CUR_L, ...; NOTE that if the search is made using a unique prefix of a record, mode should be PAGE_CUR_LE, not PAGE_CUR_GE, as the latter may end up on the previous page from the record! |
latch_mode | in: BTR_SEARCH_LEAF, ... |
cursor | in: memory buffer for persistent cursor |
file | in: file name |
line | in: line where called |
Referenced by btr_pcur_open_on_user_rec_func().
UNIV_INTERN void btr_pcur_open_on_user_rec_func | ( | dict_index_t * | index, |
const dtuple_t * | tuple, | ||
ulint | mode, | ||
ulint | latch_mode, | ||
btr_pcur_t * | cursor, | ||
const char * | file, | ||
ulint | line, | ||
mtr_t * | mtr | ||
) |
If mode is PAGE_CUR_G or PAGE_CUR_GE, opens a persistent cursor on the first user record satisfying the search condition, in the case PAGE_CUR_L or PAGE_CUR_LE, on the last user record. If no such user record exists, then in the first case sets the cursor after last in tree, and in the latter case before first in tree. The latching mode must be BTR_SEARCH_LEAF or BTR_MODIFY_LEAF. in: mtr
If mode is PAGE_CUR_G or PAGE_CUR_GE, opens a persistent cursor on the first user record satisfying the search condition, in the case PAGE_CUR_L or PAGE_CUR_LE, on the last user record. If no such user record exists, then in the first case sets the cursor after last in tree, and in the latter case before first in tree. The latching mode must be BTR_SEARCH_LEAF or BTR_MODIFY_LEAF.
index | in: index |
tuple | in: tuple on which search done |
mode | in: PAGE_CUR_L, ... |
latch_mode | in: BTR_SEARCH_LEAF or BTR_MODIFY_LEAF |
cursor | in: memory buffer for persistent cursor |
file | in: file name |
line | in: line where called |
mtr | in: mtr |
Definition at line 562 of file btr0pcur.cc.
References btr_pcur_is_after_last_on_page(), btr_pcur_move_to_next_user_rec(), btr_pcur_open_func(), ut_ad, and ut_error.
UNIV_INLINE void btr_pcur_open_with_no_init_func | ( | dict_index_t * | index, |
const dtuple_t * | tuple, | ||
ulint | mode, | ||
ulint | latch_mode, | ||
btr_pcur_t * | cursor, | ||
ulint | has_search_latch, | ||
const char * | file, | ||
ulint | line, | ||
mtr_t * | mtr | ||
) |
Opens an persistent cursor to an index tree without initializing the cursor. in: mtr
index | in: index |
tuple | in: tuple on which search done |
mode | in: PAGE_CUR_L, ...; NOTE that if the search is made using a unique prefix of a record, mode should be PAGE_CUR_LE, not PAGE_CUR_GE, as the latter may end up on the previous page of the record! |
latch_mode | in: BTR_SEARCH_LEAF, ...; NOTE that if has_search_latch != 0 then we maybe do not acquire a latch on the cursor page, but assume that the caller uses his btr search latch to protect the record! |
cursor | in: memory buffer for persistent cursor |
has_search_latch | in: latch mode the caller currently has on btr_search_latch: RW_S_LATCH, or 0 |
file | in: file name |
line | in: line where called |
Referenced by btr_pcur_restore_position_func().
UNIV_INTERN void btr_pcur_release_leaf | ( | btr_pcur_t * | cursor, |
mtr_t * | mtr | ||
) |
If the latch mode of the cursor is BTR_LEAF_SEARCH or BTR_LEAF_MODIFY, releases the page latch and bufferfix reserved by the cursor. NOTE! In the case of BTR_LEAF_MODIFY, there should not exist changes made by the current mini-transaction to the data protected by the cursor latch, as then the latch must not be released until mtr_commit. in: mtr
If the latch mode of the cursor is BTR_LEAF_SEARCH or BTR_LEAF_MODIFY, releases the page latch and bufferfix reserved by the cursor. NOTE! In the case of BTR_LEAF_MODIFY, there should not exist changes made by the current mini-transaction to the data protected by the cursor latch, as then the latch must not be released until mtr_commit.
cursor | in: persistent cursor |
mtr | in: mtr |
Definition at line 369 of file btr0pcur.cc.
References btr_leaf_page_release(), BTR_NO_LATCHES, btr_pcur_get_block(), btr_pcur_struct::latch_mode, btr_pcur_struct::pos_state, ut_a, and ut_ad.
UNIV_INTERN ibool btr_pcur_restore_position_func | ( | ulint | latch_mode, |
btr_pcur_t * | cursor, | ||
const char * | file, | ||
ulint | line, | ||
mtr_t * | mtr | ||
) |
Restores the stored position of a persistent cursor bufferfixing the page and obtaining the specified latches. If the cursor position was saved when the (1) cursor was positioned on a user record: this function restores the position to the last record LESS OR EQUAL to the stored record; (2) cursor was positioned on a page infimum record: restores the position to the last record LESS than the user record which was the successor of the page infimum; (3) cursor was positioned on the page supremum: restores to the first record GREATER than the user record which was the predecessor of the supremum. (4) cursor was positioned before the first or after the last in an empty tree: restores to before first or after the last in the tree.
Restores the stored position of a persistent cursor bufferfixing the page and obtaining the specified latches. If the cursor position was saved when the (1) cursor was positioned on a user record: this function restores the position to the last record LESS OR EQUAL to the stored record; (2) cursor was positioned on a page infimum record: restores the position to the last record LESS than the user record which was the successor of the page infimum; (3) cursor was positioned on the page supremum: restores to the first record GREATER than the user record which was the predecessor of the supremum. (4) cursor was positioned before the first or after the last in an empty tree: restores to before first or after the last in the tree.
latch_mode | in: BTR_SEARCH_LEAF, ... |
cursor | in: detached persistent cursor |
file | in: file name |
line | in: line where called |
mtr | in: mtr |
Definition at line 208 of file btr0pcur.cc.
References btr_cur_get_index(), BTR_MODIFY_LEAF, btr_pcur_get_block(), btr_pcur_get_rec(), btr_pcur_is_on_user_rec(), btr_pcur_open_with_no_init_func(), BTR_SEARCH_LEAF, buf_block_get_modify_clock(), cmp_dtuple_rec(), cmp_rec_rec(), btr_pcur_struct::latch_mode, mem_heap_create, mem_heap_free, btr_pcur_struct::modify_clock, btr_pcur_struct::old_n_fields, btr_pcur_struct::old_rec, btr_pcur_struct::old_stored, btr_pcur_struct::pos_state, btr_pcur_struct::rel_pos, btr_pcur_struct::search_mode, btr_pcur_struct::trx_if_known, trx_print(), ut_a, ut_ad, ut_error, and ut_print_buf().
UNIV_INLINE void btr_pcur_set_mtr | ( | btr_pcur_t * | cursor, |
mtr_t * | mtr | ||
) |
Sets the mtr field for a pcur. in, own: mtr
cursor | in: persistent cursor |
UNIV_INTERN void btr_pcur_store_position | ( | btr_pcur_t * | cursor, |
mtr_t * | mtr | ||
) |
The position of the cursor is stored by taking an initial segment of the record the cursor is positioned on, before, or after, and copying it to the cursor data structure, or just setting a flag if the cursor id before the first in an EMPTY tree, or after the last in an EMPTY tree. NOTE that the page where the cursor is positioned must not be empty if the index tree is not totally empty! in: mtr
The position of the cursor is stored by taking an initial segment of the record the cursor is positioned on, before, or after, and copying it to the cursor data structure, or just setting a flag if the cursor id before the first in an EMPTY tree, or after the last in an EMPTY tree. NOTE that the page where the cursor is positioned must not be empty if the index tree is not totally empty!
cursor | in: persistent cursor |
mtr | in: mtr |
Definition at line 89 of file btr0pcur.cc.
References btr_cur_get_index(), BTR_NO_LATCHES, btr_page_get_next(), btr_page_get_prev(), btr_pcur_get_block(), buf_block_get_modify_clock(), btr_pcur_struct::buf_size, FIL_NULL, btr_pcur_struct::latch_mode, btr_pcur_struct::modify_clock, btr_pcur_struct::old_n_fields, btr_pcur_struct::old_rec, btr_pcur_struct::old_rec_buf, btr_pcur_struct::old_stored, page_align(), page_get_n_recs(), page_offset(), page_rec_get_next(), page_rec_get_prev(), page_rec_is_infimum_low(), page_rec_is_supremum_low(), btr_pcur_struct::pos_state, btr_pcur_struct::rel_pos, ut_a, and ut_ad.