#include "univ.i"
#include "buf0types.h"
#include "page0page.h"
#include "rem0rec.h"
#include "data0data.h"
#include "mtr0mtr.h"
Go to the source code of this file.
Classes | |
struct | page_cur_struct |
Macros | |
#define | page0cur_h |
#define | PAGE_CUR_ADAPT |
#define | PAGE_CUR_UNSUPP 0 |
#define | PAGE_CUR_G 1 |
#define | PAGE_CUR_GE 2 |
#define | PAGE_CUR_L 3 |
#define | PAGE_CUR_LE 4 |
#define | page_cur_get_page(cur) page_align((cur)->rec) |
#define | page_cur_get_block(cur) (cur)->block |
#define | page_cur_get_page_zip(cur) buf_block_get_page_zip((cur)->block) |
#define | page_cur_get_rec(cur) (cur)->rec |
Functions | |
UNIV_INLINE void | page_cur_set_before_first (const buf_block_t *block, page_cur_t *cur) |
UNIV_INLINE void | page_cur_set_after_last (const buf_block_t *block, page_cur_t *cur) |
UNIV_INLINE ibool | page_cur_is_before_first (const page_cur_t *cur) |
UNIV_INLINE ibool | page_cur_is_after_last (const page_cur_t *cur) |
UNIV_INLINE void | page_cur_position (const rec_t *rec, const buf_block_t *block, page_cur_t *cur) |
UNIV_INLINE void | page_cur_invalidate (page_cur_t *cur) |
UNIV_INLINE void | page_cur_move_to_next (page_cur_t *cur) |
UNIV_INLINE void | page_cur_move_to_prev (page_cur_t *cur) |
UNIV_INLINE rec_t * | page_cur_tuple_insert (page_cur_t *cursor, const dtuple_t *tuple, dict_index_t *index, ulint n_ext, mtr_t *mtr) |
UNIV_INLINE rec_t * | page_cur_rec_insert (page_cur_t *cursor, const rec_t *rec, dict_index_t *index, ulint *offsets, mtr_t *mtr) |
UNIV_INTERN rec_t * | page_cur_insert_rec_low (rec_t *current_rec, dict_index_t *index, const rec_t *rec, ulint *offsets, mtr_t *mtr) |
UNIV_INTERN rec_t * | page_cur_insert_rec_zip (rec_t **current_rec, buf_block_t *block, dict_index_t *index, const rec_t *rec, ulint *offsets, mtr_t *mtr) |
UNIV_INTERN void | page_copy_rec_list_end_to_created_page (page_t *new_page, rec_t *rec, dict_index_t *index, mtr_t *mtr) |
UNIV_INTERN void | page_cur_delete_rec (page_cur_t *cursor, dict_index_t *index, const ulint *offsets, mtr_t *mtr) |
UNIV_INLINE ulint | page_cur_search (const buf_block_t *block, const dict_index_t *index, const dtuple_t *tuple, ulint mode, page_cur_t *cursor) |
UNIV_INTERN void | page_cur_search_with_match (const buf_block_t *block, const dict_index_t *index, const dtuple_t *tuple, ulint mode, ulint *iup_matched_fields, ulint *iup_matched_bytes, ulint *ilow_matched_fields, ulint *ilow_matched_bytes, page_cur_t *cursor) |
UNIV_INTERN void | page_cur_open_on_rnd_user_rec (buf_block_t *block, page_cur_t *cursor) |
UNIV_INTERN byte * | page_cur_parse_insert_rec (ibool is_short, byte *ptr, byte *end_ptr, buf_block_t *block, dict_index_t *index, mtr_t *mtr) |
UNIV_INTERN byte * | page_parse_copy_rec_list_to_created_page (byte *ptr, byte *end_ptr, buf_block_t *block, dict_index_t *index, mtr_t *mtr) |
UNIV_INTERN byte * | page_cur_parse_delete_rec (byte *ptr, byte *end_ptr, buf_block_t *block, dict_index_t *index, mtr_t *mtr) |
UNIV_INTERN void page_copy_rec_list_end_to_created_page | ( | page_t * | new_page, |
rec_t * | rec, | ||
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Copies records from page to a newly created page, from a given record onward, including that record. Infimum and supremum records are not copied. in: mtr
Copies records from page to a newly created page, from a given record onward, including that record. Infimum and supremum records are not copied.
new_page | in/out: index page to copy to |
rec | in: first record to copy |
index | in: record descriptor |
mtr | in: mtr |
Definition at line 1599 of file page0cur.cc.
References dyn_array_get_data_size(), mtr_struct::log, mach_write_to_4(), mem_heap_free, mtr_set_log_mode(), page_align(), page_copy_rec_list_end_to_created_page(), page_dir_get_n_heap(), page_dir_set_n_heap(), page_dir_set_n_slots(), page_dir_slot_set_n_owned(), page_dir_slot_set_rec(), page_header_set_field(), page_header_set_ptr(), page_is_comp(), page_offset(), page_rec_get_next(), page_rec_is_comp(), page_rec_is_infimum(), page_rec_is_supremum(), rec_copy(), rec_offs_size(), rec_set_heap_no_new(), rec_set_heap_no_old(), rec_set_n_owned_new(), rec_set_n_owned_old(), rec_set_next_offs_new(), rec_set_next_offs_old(), ut_a, and ut_ad.
Referenced by page_copy_rec_list_end(), and page_copy_rec_list_end_to_created_page().
UNIV_INTERN void page_cur_delete_rec | ( | page_cur_t * | cursor, |
dict_index_t * | index, | ||
const ulint * | offsets, | ||
mtr_t * | mtr | ||
) |
Deletes a record at the page cursor. The cursor is moved to the next record after the deleted one. in: mini-transaction handle
Deletes a record at the page cursor. The cursor is moved to the next record after the deleted one.
cursor | in/out: a page cursor |
index | in: record descriptor |
offsets | in: rec_get_offsets(cursor->rec, index) |
mtr | in: mini-transaction handle |
Definition at line 1858 of file page0cur.cc.
References buf_block_modify_clock_inc(), dict_table_is_comp(), page_cur_delete_rec(), page_cur_move_to_next(), page_dir_balance_slot(), page_dir_find_owner_slot(), page_dir_slot_get_n_owned(), page_dir_slot_get_rec(), page_dir_slot_set_n_owned(), page_dir_slot_set_rec(), page_header_set_ptr(), page_is_comp(), page_mem_free(), page_rec_get_next(), page_rec_is_user_rec(), page_rec_set_next(), page_cur_struct::rec, rec_offs_validate(), dict_index_struct::table, ut_a, and ut_ad.
Referenced by btr_cur_optimistic_update(), page_cur_delete_rec(), page_cur_parse_delete_rec(), page_delete_rec_list_end(), and page_delete_rec_list_start().
UNIV_INTERN rec_t* page_cur_insert_rec_low | ( | rec_t * | current_rec, |
dict_index_t * | index, | ||
const rec_t * | rec, | ||
ulint * | offsets, | ||
mtr_t * | mtr | ||
) |
Inserts a record next to page cursor on an uncompressed page. Returns pointer to inserted record if succeed, i.e., enough space available, NULL otherwise. The cursor stays at the same position.
Inserts a record next to page cursor on an uncompressed page. Returns pointer to inserted record if succeed, i.e., enough space available, NULL otherwise. The cursor stays at the same position.
< the relevant page
< cursor position at previous
insert
< a free record that was reused,
or NULL
< inserted record
< heap number of the inserted
record
current_rec | in: pointer to current record after which the new record is inserted |
index | in: record descriptor |
rec | in: pointer to a physical record |
offsets | in/out: rec_get_offsets(rec, index) |
mtr | in: mini-transaction handle, or NULL |
Definition at line 950 of file page0cur.cc.
References dict_table_is_comp(), mem_heap_free, page_align(), page_cur_insert_rec_low(), page_dir_find_owner_slot(), page_dir_split_slot(), page_get_n_recs(), page_header_get_field(), page_header_get_ptr, page_header_set_field(), page_header_set_ptr(), page_is_comp(), page_mem_alloc_free(), page_mem_alloc_heap(), page_rec_find_owner_rec(), page_rec_get_next(), page_rec_is_supremum(), page_rec_set_next(), rec_copy(), rec_get_heap_no_new(), rec_get_heap_no_old(), rec_get_n_owned_new(), rec_get_n_owned_old(), rec_get_next_ptr(), rec_get_node_ptr_flag(), rec_get_status(), rec_offs_comp(), rec_offs_data_size(), rec_offs_extra_size(), rec_offs_size(), rec_offs_validate(), rec_set_heap_no_new(), rec_set_heap_no_old(), rec_set_n_owned_new(), rec_set_n_owned_old(), dict_index_struct::table, and ut_ad.
Referenced by page_copy_rec_list_end_no_locks(), page_copy_rec_list_start(), page_cur_insert_rec_low(), and page_cur_insert_rec_zip().
UNIV_INTERN rec_t* page_cur_insert_rec_zip | ( | rec_t ** | current_rec, |
buf_block_t * | block, | ||
dict_index_t * | index, | ||
const rec_t * | rec, | ||
ulint * | offsets, | ||
mtr_t * | mtr | ||
) |
Inserts a record next to page cursor on a compressed and uncompressed page. Returns pointer to inserted record if succeed, i.e., enough space available, NULL otherwise. The cursor stays at the same position.
Inserts a record next to page cursor on a compressed and uncompressed page. Returns pointer to inserted record if succeed, i.e., enough space available, NULL otherwise. The cursor stays at the same position.
< the relevant page
< cursor position at previous
insert
< a free record that was reused,
or NULL
< inserted record
< heap number of the inserted
record
current_rec | in/out: pointer to current record after which the new record is inserted |
block | in: buffer block of *current_rec |
index | in: record descriptor |
rec | in: pointer to a physical record |
offsets | in/out: rec_get_offsets(rec, index) |
mtr | in: mini-transaction handle, or NULL |
Definition at line 1217 of file page0cur.cc.
References buf_block_get_page_zip, dict_index_get_sys_col_pos(), dict_index_is_clust(), dict_table_is_comp(), mem_heap_free, page_align(), page_cur_insert_rec_low(), page_cur_insert_rec_zip(), page_dir_find_owner_slot(), page_dir_split_slot(), page_get_n_recs(), page_header_get_field(), page_header_get_ptr, page_header_set_field(), page_header_set_ptr(), page_is_comp(), page_is_leaf(), page_mem_alloc_free(), page_mem_alloc_heap(), page_rec_find_owner_rec(), page_rec_get_next(), page_rec_is_supremum(), page_rec_set_next(), page_zip_available(), page_zip_dir_add_slot(), page_zip_dir_insert(), page_zip_write_rec(), rec_copy(), rec_get_heap_no_new(), rec_get_n_owned_new(), rec_get_next_ptr(), rec_get_node_ptr_flag(), rec_get_nth_field_offs(), rec_get_status(), rec_offs_comp(), rec_offs_data_size(), rec_offs_extra_size(), rec_offs_size(), rec_offs_validate(), rec_set_heap_no_new(), rec_set_n_owned_new(), dict_index_struct::table, ut_a, and ut_ad.
Referenced by page_cur_insert_rec_zip().
UNIV_INLINE void page_cur_invalidate | ( | page_cur_t * | cur) |
Invalidates a page cursor by setting the record pointer NULL. out: page cursor
UNIV_INLINE ibool page_cur_is_after_last | ( | const page_cur_t * | cur) |
Returns TRUE if the cursor is after last user record.
Referenced by lock_move_rec_list_end(), page_copy_rec_list_end_no_locks(), and page_print_list().
UNIV_INLINE ibool page_cur_is_before_first | ( | const page_cur_t * | cur) |
Returns TRUE if the cursor is before first user record on page.
Referenced by lock_move_rec_list_end(), and page_copy_rec_list_end_no_locks().
UNIV_INLINE void page_cur_move_to_next | ( | page_cur_t * | cur) |
Moves the cursor to the next record on page. in/out: cursor; must not be after last
Referenced by btr_cur_optimistic_update(), lock_move_rec_list_end(), lock_move_rec_list_start(), lock_move_reorganize_page(), page_copy_rec_list_end_no_locks(), page_copy_rec_list_start(), page_cur_delete_rec(), page_cur_open_on_rnd_user_rec(), page_delete_rec_list_start(), and page_print_list().
UNIV_INLINE void page_cur_move_to_prev | ( | page_cur_t * | cur) |
Moves the cursor to the previous record on page. in/out: cursor; not before first
Referenced by btr_cur_optimistic_update().
UNIV_INTERN void page_cur_open_on_rnd_user_rec | ( | buf_block_t * | block, |
page_cur_t * | cursor | ||
) |
Positions a page cursor on a randomly chosen user record on a page. If there are no user records, sets the cursor on the infimum record. out: page cursor
Positions a page cursor on a randomly chosen user record on a page. If there are no user records, sets the cursor on the infimum record.
block | in: page |
cursor | out: page cursor |
Definition at line 545 of file page0cur.cc.
References page_cur_move_to_next(), page_cur_open_on_rnd_user_rec(), page_cur_set_before_first(), and page_get_n_recs().
Referenced by btr_cur_open_at_rnd_pos_func(), and page_cur_open_on_rnd_user_rec().
UNIV_INTERN byte* page_cur_parse_delete_rec | ( | byte * | ptr, |
byte * | end_ptr, | ||
buf_block_t * | block, | ||
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Parses log record of a record delete on a page.
Parses log record of a record delete on a page.
ptr | in: buffer |
end_ptr | in: buffer end |
block | in: page or NULL |
index | in: record descriptor |
mtr | in: mtr or NULL |
Definition at line 1809 of file page0cur.cc.
References buf_block_get_page_zip, mach_read_from_2(), mem_heap_free, page_cur_delete_rec(), page_cur_parse_delete_rec(), page_cur_position(), page_is_comp(), ut_a, and ut_ad.
Referenced by page_cur_parse_delete_rec().
UNIV_INTERN byte* page_cur_parse_insert_rec | ( | ibool | is_short, |
byte * | ptr, | ||
byte * | end_ptr, | ||
buf_block_t * | block, | ||
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Parses a log record of a record insert on a page.
Parses a log record of a record insert on a page.
is_short | in: TRUE if short inserts |
ptr | in: buffer |
end_ptr | in: buffer end |
block | in: page or NULL |
index | in: record descriptor |
mtr | in: mtr or NULL |
Definition at line 757 of file page0cur.cc.
References buf_block_get_page_zip, dict_table_is_comp(), recv_sys_struct::found_corrupt_log, mach_parse_compressed(), mach_read_from_1(), mach_read_from_2(), mem_free, mem_heap_free, page_cur_parse_insert_rec(), page_cur_position(), page_cur_rec_insert(), page_is_comp(), page_offset(), page_rec_get_prev(), rec_get_info_and_status_bits(), rec_offs_extra_size(), rec_offs_size(), rec_set_info_and_status_bits(), rec_set_info_bits_old(), recv_sys, dict_index_struct::table, ut_a, ut_ad, ut_error, ut_memcpy(), and ut_print_buf().
Referenced by page_cur_parse_insert_rec(), and page_parse_copy_rec_list_to_created_page().
UNIV_INLINE void page_cur_position | ( | const rec_t * | rec, |
const buf_block_t * | block, | ||
page_cur_t * | cur | ||
) |
Positions the cursor on the given record. out: page cursor
rec | in: record on a page |
block | in: buffer block containing the record |
Referenced by lock_move_rec_list_end(), lock_move_rec_list_start(), page_copy_rec_list_end_no_locks(), page_cur_parse_delete_rec(), page_cur_parse_insert_rec(), page_cur_search_with_match(), and page_delete_rec_list_end().
UNIV_INLINE rec_t* page_cur_rec_insert | ( | page_cur_t * | cursor, |
const rec_t * | rec, | ||
dict_index_t * | index, | ||
ulint * | offsets, | ||
mtr_t * | mtr | ||
) |
Inserts a record next to page cursor. Returns pointer to inserted record if succeed, i.e., enough space available, NULL otherwise. The cursor stays at the same logical position, but the physical position may change if it is pointing to a compressed page that was reorganized.
cursor | in/out: a page cursor |
rec | in: record to insert |
index | in: record descriptor |
offsets | in/out: rec_get_offsets(rec, index) |
Referenced by page_cur_parse_insert_rec().
UNIV_INLINE ulint page_cur_search | ( | const buf_block_t * | block, |
const dict_index_t * | index, | ||
const dtuple_t * | tuple, | ||
ulint | mode, | ||
page_cur_t * | cursor | ||
) |
Searches the right position for a page cursor.
block | in: buffer block |
index | in: record descriptor |
tuple | in: data tuple |
mode | in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G, or PAGE_CUR_GE |
Referenced by btr_page_split_and_insert(), and btr_root_raise_and_insert().
UNIV_INTERN void page_cur_search_with_match | ( | const buf_block_t * | block, |
const dict_index_t * | index, | ||
const dtuple_t * | tuple, | ||
ulint | mode, | ||
ulint * | iup_matched_fields, | ||
ulint * | iup_matched_bytes, | ||
ulint * | ilow_matched_fields, | ||
ulint * | ilow_matched_bytes, | ||
page_cur_t * | cursor | ||
) |
Searches the right position for a page cursor. out: page cursor
Searches the right position for a page cursor.
block | in: buffer block |
index | in: record descriptor |
tuple | in: data tuple |
mode | in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G, or PAGE_CUR_GE |
iup_matched_fields | in/out: already matched fields in upper limit record |
iup_matched_bytes | in/out: already matched bytes in a field not yet completely matched |
ilow_matched_fields | in/out: already matched fields in lower limit record |
ilow_matched_bytes | in/out: already matched bytes in a field not yet completely matched |
cursor | out: page cursor |
Definition at line 246 of file page0cur.cc.
References buf_block_get_page_zip, cmp_dtuple_rec_with_match(), dtuple_get_n_fields_cmp(), mem_heap_free, page_check_dir(), page_cmp_dtuple_rec_with_match(), page_cur_position(), page_cur_search_with_match(), page_dir_get_n_slots(), page_dir_slot_get_rec(), page_header_get_field(), page_header_get_ptr, page_is_leaf(), page_rec_get_next_const(), page_rec_is_infimum(), page_rec_is_supremum(), ut_a, ut_ad, and ut_pair_min().
Referenced by btr_cur_search_to_nth_level(), and page_cur_search_with_match().
UNIV_INLINE 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. in: cursor
block | in: index page |
Referenced by btr_pcur_move_backward_from_page().
UNIV_INLINE 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. in: cursor
block | in: index page |
Referenced by btr_pcur_move_to_next_page(), btr_root_raise_and_insert(), lock_move_rec_list_end(), lock_move_rec_list_start(), lock_move_reorganize_page(), page_copy_rec_list_start(), page_cur_open_on_rnd_user_rec(), page_delete_rec_list_start(), and page_print_list().
UNIV_INLINE rec_t* page_cur_tuple_insert | ( | page_cur_t * | cursor, |
const dtuple_t * | tuple, | ||
dict_index_t * | index, | ||
ulint | n_ext, | ||
mtr_t * | mtr | ||
) |
Inserts a record next to page cursor. Returns pointer to inserted record if succeed, i.e., enough space available, NULL otherwise. The cursor stays at the same logical position, but the physical position may change if it is pointing to a compressed page that was reorganized.
cursor | in/out: a page cursor |
tuple | in: pointer to a data tuple |
index | in: record descriptor |
n_ext | in: number of externally stored columns |
Referenced by btr_page_split_and_insert(), and btr_root_raise_and_insert().
UNIV_INTERN byte* page_parse_copy_rec_list_to_created_page | ( | byte * | ptr, |
byte * | end_ptr, | ||
buf_block_t * | block, | ||
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Parses a log record of copying a record list end to a new created page.
Parses a log record of copying a record list end to a new created page.
ptr | in: buffer |
end_ptr | in: buffer end |
block | in: page or NULL |
index | in: record descriptor |
mtr | in: mtr or NULL |
Definition at line 1542 of file page0cur.cc.
References buf_block_get_page_zip, mach_read_from_4(), page_cur_parse_insert_rec(), page_header_set_field(), page_header_set_ptr(), page_parse_copy_rec_list_to_created_page(), and ut_a.
Referenced by page_parse_copy_rec_list_to_created_page().