Drizzled Public API Documentation

btr0pcur.h File Reference
#include "univ.i"
#include "dict0dict.h"
#include "data0data.h"
#include "mtr0mtr.h"
#include "page0cur.h"
#include "btr0cur.h"
#include "btr0btr.h"
#include "btr0types.h"
#include "btr0pcur.ic"

Go to the source code of this file.

Classes

struct  btr_pcur_struct

Defines

#define BTR_PCUR_ON   1
#define BTR_PCUR_BEFORE   2
#define BTR_PCUR_AFTER   3
#define BTR_PCUR_BEFORE_FIRST_IN_TREE   4
#define BTR_PCUR_AFTER_LAST_IN_TREE   5
#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   1997660512
#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_tbtr_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_tbtr_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_is_detached (btr_pcur_t *pcur)
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_tbtr_pcur_get_page (btr_pcur_t *cursor)
UNIV_INLINE buf_block_tbtr_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)

Detailed Description

The index tree persistent cursor

Created 2/23/1996 Heikki Tuuri

Definition in file btr0pcur.h.


Function Documentation

UNIV_INLINE void btr_pcur_close ( btr_pcur_t cursor)
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

Parameters:
pcurin: persistent cursor

Referenced by 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.

Parameters:
pcur_receivein: pcur which will receive the position info
pcur_donatein: 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.

Returns:
own: persistent 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.

Parameters:
cursorin, 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)
UNIV_INLINE ulint btr_pcur_get_low_match ( btr_pcur_t cursor)

Gets the low_match value for a pcur after a search.

Returns:
number of matched fields at the cursor or to the right if search mode was PAGE_CUR_LE, otherwise undefined in: memory buffer for persistent cursor

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.

Returns:
mtr in: persistent cursor
UNIV_INLINE page_t* btr_pcur_get_page ( btr_pcur_t cursor)

Returns the page of a persistent cursor.

Returns:
pointer to the page in: persistent cursor

Referenced by btr_pcur_move_backward_from_page(), btr_pcur_move_to_next_page(), ibuf_update_max_tablespace_id(), and row_search_max_autoinc().

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.

Returns:
BTR_PCUR_ON, ... in: persistent cursor
UNIV_INLINE ulint btr_pcur_get_up_match ( btr_pcur_t cursor)

Gets the up_match value for a pcur after a search.

Returns:
number of matched fields at the cursor or to the right if search mode was PAGE_CUR_GE, otherwise undefined in: memory buffer for persistent cursor
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

Parameters:
cursorin: persistent cursor
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(), and btr_pcur_open_on_user_rec_func().

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

Parameters:
cursorin: 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(), btr_pcur_move_to_prev(), and ibuf_update_max_tablespace_id().

UNIV_INLINE ibool btr_pcur_is_detached ( btr_pcur_t pcur)

Tests if a cursor is detached: that is the latch mode is BTR_NO_LATCHES.

Returns:
TRUE if detached in: persistent cursor
UNIV_INLINE ibool btr_pcur_is_on_user_rec ( const btr_pcur_t cursor)
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.

Parameters:
cursorin: persistent cursor, must be on the first record of the current page
mtrin: mtr

Definition at line 448 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

Parameters:
cursorin: 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'.

Returns:
TRUE if the cursor was not after last in tree in: mtr
Parameters:
cursorin: 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.

Parameters:
cursorin: persistent cursor; must be on the last record of the current page
mtrin: mtr

Definition at line 393 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'.

Returns:
TRUE if the cursor moved forward, ending on a user record in: mtr
Parameters:
cursorin: 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_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'.

Returns:
TRUE if the cursor was not before first in tree in: mtr

Moves the persistent cursor to the previous record in the tree. If no records are left, the cursor stays 'before first in tree'.

Returns:
TRUE if the cursor was not before first in tree
Parameters:
cursorin: persistent cursor; NOTE that the function may release the page latch
mtrin: mtr

Definition at line 523 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

Parameters:
from_leftin: TRUE if open to the low end, FALSE if to the high end
indexin: index
latch_modein: latch mode
pcurin: cursor
do_initin: TRUE if should be initialized

Referenced by dict_check_tablespaces_and_store_max_id(), dict_startscan_system(), ibuf_update_max_tablespace_id(), 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

Parameters:
indexin: index
latch_modein: BTR_SEARCH_LEAF, ...
cursorin/out: B-tree pcur
filein: file name
linein: 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

Parameters:
indexin: index
tuplein: tuple on which search done
modein: 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_modein: BTR_SEARCH_LEAF, ...
cursorin: memory buffer for persistent cursor
filein: file name
linein: 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.

Parameters:
indexin: index
tuplein: tuple on which search done
modein: PAGE_CUR_L, ...
latch_modein: BTR_SEARCH_LEAF or BTR_MODIFY_LEAF
cursorin: memory buffer for persistent cursor
filein: file name
linein: line where called
mtrin: mtr

Definition at line 560 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

Parameters:
indexin: index
tuplein: tuple on which search done
modein: 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_modein: 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!
cursorin: memory buffer for persistent cursor
has_search_latchin: latch mode the caller currently has on btr_search_latch: RW_S_LATCH, or 0
filein: file name
linein: 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.

Parameters:
cursorin: persistent cursor
mtrin: mtr

Definition at line 367 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.

Returns:
TRUE if the cursor position was stored when it was on a user record and it can be restored on a user record whose ordering fields are identical to the ones of the original user record in: 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.

Returns:
TRUE if the cursor position was stored when it was on a user record and it can be restored on a user record whose ordering fields are identical to the ones of the original user record
Parameters:
latch_modein: BTR_SEARCH_LEAF, ...
cursorin: detached persistent cursor
filein: file name
linein: line where called
mtrin: 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

Parameters:
cursorin: 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!

Parameters:
cursorin: persistent cursor
mtrin: 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.