InnoDB Plugin  1.0
Functions
btr0pcur.ic File Reference
This graph shows which files directly or indirectly include this file:

Functions

UNIV_INLINE ulint btr_pcur_get_rel_pos (const btr_pcur_t *cursor)
UNIV_INLINE btr_cur_tbtr_pcur_get_btr_cur (const btr_pcur_t *cursor)
UNIV_INLINE page_cur_tbtr_pcur_get_page_cur (const btr_pcur_t *cursor)
UNIV_INLINE page_tbtr_pcur_get_page (const btr_pcur_t *cursor)
UNIV_INLINE buf_block_tbtr_pcur_get_block (const btr_pcur_t *cursor)
UNIV_INLINE rec_t * btr_pcur_get_rec (const btr_pcur_t *cursor)
UNIV_INLINE ulint btr_pcur_get_up_match (const btr_pcur_t *cursor)
UNIV_INLINE ulint btr_pcur_get_low_match (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_on_user_rec (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)
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_INLINE ibool btr_pcur_move_to_next (btr_pcur_t *cursor, mtr_t *mtr)
UNIV_INLINE void btr_pcur_commit_specify_mtr (btr_pcur_t *pcur, mtr_t *mtr)
UNIV_INLINE void btr_pcur_init (btr_pcur_t *pcur)
UNIV_INLINE void btr_pcur_open_low (dict_index_t *index, ulint level, 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 (bool from_left, dict_index_t *index, ulint latch_mode, btr_pcur_t *pcur, bool init_pcur, ulint level, 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_INLINE void btr_pcur_move_before_first_on_page (btr_pcur_t *cursor)

Detailed Description

The index tree persistent cursor

Created 2/23/1996 Heikki Tuuri

Function Documentation

UNIV_INLINE void btr_pcur_close ( btr_pcur_t cursor)

Frees the possible memory heap of a persistent cursor and sets the latch mode of the persistent cursor to BTR_NO_LATCHES. WARNING: this function does not release the latch on the page where the cursor is currently positioned. The latch is acquired by the "move to next/previous" family of functions. Since recursive shared locks are not allowed, you must take care (if using the cursor in S-mode) to manually release the latch by either calling btr_leaf_page_release(btr_pcur_get_block(&pcur), pcur.latch_mode, mtr) or by committing the mini-transaction right after btr_pcur_close(). A subsequent attempt to crawl the same page in the same mtr would cause an assertion failure.

Parameters
cursorin: persistent 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. Function btr_pcur_store_position should be used before calling this, if restoration of cursor is wanted later.

Parameters
pcurin: persistent cursor
mtrin: mtr to commit
UNIV_INLINE buf_block_t* btr_pcur_get_block ( const btr_pcur_t cursor)

Returns the buffer block of a persistent cursor.

Returns
pointer to the block
Parameters
cursorin: persistent cursor
UNIV_INLINE btr_cur_t* btr_pcur_get_btr_cur ( const btr_pcur_t cursor)

Returns the btr cursor component of a persistent cursor.

Returns
pointer to btr cursor component
Parameters
cursorin: persistent cursor
UNIV_INLINE ulint btr_pcur_get_low_match ( const 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
Parameters
cursorin: persistent cursor
UNIV_INLINE page_t* btr_pcur_get_page ( const btr_pcur_t cursor)

Returns the page of a persistent cursor.

Returns
pointer to the page
Parameters
cursorin: persistent cursor
UNIV_INLINE page_cur_t* btr_pcur_get_page_cur ( const btr_pcur_t cursor)

Returns the page cursor component of a persistent cursor.

Returns
pointer to page cursor component
Parameters
cursorin: persistent cursor
UNIV_INLINE rec_t* btr_pcur_get_rec ( const btr_pcur_t cursor)

Returns the record of a persistent cursor.

Returns
pointer to the record
Parameters
cursorin: persistent cursor
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, ...
Parameters
cursorin: persistent cursor
UNIV_INLINE ulint btr_pcur_get_up_match ( const 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
Parameters
cursorin: persistent cursor
UNIV_INLINE void btr_pcur_init ( btr_pcur_t pcur)

Sets the old_rec_buf field to NULL.

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

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

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

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

Parameters
cursorin: persistent cursor
UNIV_INLINE ibool btr_pcur_is_on_user_rec ( const btr_pcur_t cursor)

Checks if the persistent cursor is on a user record.

Parameters
cursorin: persistent cursor
UNIV_INLINE void btr_pcur_move_before_first_on_page ( btr_pcur_t cursor)

Moves the persistent cursor to the infimum record on the same page.

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

Parameters
cursorin: persistent cursor
mtrin: mtr
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
Parameters
cursorin: persistent cursor; NOTE that the function may release the page latch
mtrin: mtr
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.

Parameters
cursorin/out: persistent cursor
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
Parameters
cursorin: persistent cursor; NOTE that the function may release the page latch
mtrin: mtr
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.

Parameters
cursorin/out: persistent cursor
UNIV_INLINE void btr_pcur_open_at_index_side ( bool  from_left,
dict_index_t index,
ulint  latch_mode,
btr_pcur_t pcur,
bool  init_pcur,
ulint  level,
mtr_t mtr 
)

Opens a persistent cursor at either end of an index.

Parameters
from_leftin: true if open to the low end, false if to the high end
indexin: index
latch_modein: latch mode
pcurin/out: cursor
init_pcurin: whether to initialize pcur
levelin: level to search for (0=leaf)
mtrin/out: mini-transaction
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.

Parameters
indexin: index
latch_modein: BTR_SEARCH_LEAF, ...
cursorin/out: B-tree pcur
filein: file name
linein: line where called
mtrin: mtr
UNIV_INLINE void btr_pcur_open_low ( dict_index_t index,
ulint  level,
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.

Parameters
indexin: index
levelin: level in the btree
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
mtrin: 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 
)

Opens an persistent cursor to an index tree without initializing the cursor.

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
mtrin: mtr