MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
btr0pcur.cc File Reference
#include "btr0pcur.h"
#include "ut0byte.h"
#include "rem0cmp.h"
#include "trx0trx.h"
Include dependency graph for btr0pcur.cc:

Go to the source code of this file.

Functions

UNIV_INTERN btr_pcur_tbtr_pcur_create_for_mysql (void)
UNIV_INTERN void btr_pcur_reset (btr_pcur_t *cursor)
UNIV_INTERN void btr_pcur_free_for_mysql (btr_pcur_t *cursor)
UNIV_INTERN void btr_pcur_store_position (btr_pcur_t *cursor, mtr_t *mtr)
UNIV_INTERN void btr_pcur_copy_stored_position (btr_pcur_t *pcur_receive, btr_pcur_t *pcur_donate)
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_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_INTERN ibool btr_pcur_move_to_prev (btr_pcur_t *cursor, mtr_t *mtr)
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)

Detailed Description

The index tree persistent cursor

Created 2/23/1996 Heikki Tuuri

Definition in file btr0pcur.cc.

Function Documentation

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.

Parameters
pcur_receivein: pcur which will receive the position info
pcur_donatein: pcur from which the info is copied

Definition at line 179 of file btr0pcur.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void btr_pcur_free_for_mysql ( btr_pcur_t cursor)

Frees the memory for a persistent cursor object.

Parameters
cursorin, own: persistent cursor

Definition at line 84 of file btr0pcur.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

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. 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 462 of file btr0pcur.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

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

Definition at line 406 of file btr0pcur.cc.

Here is the call graph for this function:

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

Definition at line 537 of file btr0pcur.cc.

Here is the call graph for this function:

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.

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 574 of file btr0pcur.cc.

Here is the call graph for this function:

UNIV_INTERN void btr_pcur_reset ( btr_pcur_t cursor)

Resets a persistent cursor object, freeing ::old_rec_buf if it is allocated and resetting the other members to their initial values.

Parameters
cursorin, out: persistent cursor

Definition at line 59 of file btr0pcur.cc.

Here is the caller graph for this function:

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
Parameters
latch_modein: BTR_SEARCH_LEAF, ...
cursorin: detached persistent cursor
filein: file name
linein: line where called
mtrin: mtr

Definition at line 223 of file btr0pcur.cc.

Here is the call graph for this function:

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!

Parameters
cursorin: persistent cursor
mtrin: mtr

Definition at line 101 of file btr0pcur.cc.

Here is the call graph for this function:

Here is the caller graph for this function: