29 #include "btr0pcur.ic"
41 btr_pcur_create_for_mysql(
void)
58 btr_pcur_free_for_mysql(
75 cursor->
pos_state = BTR_PCUR_NOT_POSITIONED;
89 btr_pcur_store_position(
104 block = btr_pcur_get_block(cursor);
107 page_cursor = btr_pcur_get_page_cur(cursor);
109 rec = page_cur_get_rec(page_cursor);
113 ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_S_FIX)
114 || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
129 cursor->
rel_pos = BTR_PCUR_AFTER_LAST_IN_TREE;
131 cursor->
rel_pos = BTR_PCUR_BEFORE_FIRST_IN_TREE;
141 cursor->
rel_pos = BTR_PCUR_AFTER;
147 cursor->
rel_pos = BTR_PCUR_BEFORE;
153 cursor->
old_rec = dict_index_copy_rec_order_prefix(
157 cursor->block_when_stored = block;
165 btr_pcur_copy_stored_position(
208 btr_pcur_restore_position_func(
223 ut_ad(mtr->state == MTR_ACTIVE);
227 if (UNIV_UNLIKELY(cursor->
old_stored != BTR_PCUR_OLD_STORED)
228 || UNIV_UNLIKELY(cursor->
pos_state != BTR_PCUR_WAS_POSITIONED
229 && cursor->
pos_state != BTR_PCUR_IS_POSITIONED)) {
240 (cursor->
rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
241 || cursor->
rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
246 btr_cur_open_at_index_side(
247 cursor->
rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE,
248 index, latch_mode, btr_pcur_get_btr_cur(cursor), mtr);
251 cursor->
pos_state = BTR_PCUR_IS_POSITIONED;
252 cursor->block_when_stored = btr_pcur_get_block(cursor);
264 if (UNIV_LIKELY(buf_page_optimistic_get(
266 cursor->block_when_stored,
269 cursor->
pos_state = BTR_PCUR_IS_POSITIONED;
271 buf_block_dbg_add_level(btr_pcur_get_block(cursor),
274 if (cursor->
rel_pos == BTR_PCUR_ON) {
277 const ulint* offsets1;
278 const ulint* offsets2;
282 rec = btr_pcur_get_rec(cursor);
285 offsets1 = rec_get_offsets(
288 offsets2 = rec_get_offsets(
293 rec, offsets1, offsets2,
308 tuple = dict_index_build_data_tuple(index, cursor->
old_rec,
314 if (UNIV_LIKELY(cursor->
rel_pos == BTR_PCUR_ON)) {
316 }
else if (cursor->
rel_pos == BTR_PCUR_AFTER) {
324 cursor, 0, file, line, mtr);
329 if (cursor->
rel_pos == BTR_PCUR_ON
333 btr_pcur_get_rec(cursor), index,
334 NULL, ULINT_UNDEFINED, &heap))) {
340 cursor->block_when_stored = btr_pcur_get_block(cursor);
342 cursor->block_when_stored);
356 btr_pcur_store_position(cursor, mtr);
369 btr_pcur_release_leaf(
379 block = btr_pcur_get_block(cursor);
385 cursor->
pos_state = BTR_PCUR_WAS_POSITIONED;
395 btr_pcur_move_to_next_page(
414 page = btr_pcur_get_page(cursor);
423 next_page = buf_block_get_frame(next_block);
424 #ifdef UNIV_BTR_DEBUG
450 btr_pcur_move_backward_from_page(
481 btr_pcur_store_position(cursor, mtr);
487 btr_pcur_restore_position(latch_mode2, cursor, mtr);
489 page = btr_pcur_get_page(cursor);
496 prev_block = btr_pcur_get_btr_cur(cursor)->left_block;
502 btr_pcur_get_page_cur(cursor));
509 prev_block = btr_pcur_get_btr_cur(cursor)->left_block;
525 btr_pcur_move_to_prev(
543 btr_pcur_move_backward_from_page(cursor, mtr);
562 btr_pcur_open_on_user_rec_func(
578 if ((mode == PAGE_CUR_GE) || (mode == PAGE_CUR_G)) {
585 ut_ad((mode == PAGE_CUR_LE) || (mode == PAGE_CUR_L));