291
291
/* Save the old search mode of the cursor */
292
292
old_mode = cursor->search_mode;
294
if (UNIV_LIKELY(cursor->rel_pos == BTR_PCUR_ON)) {
294
switch (cursor->rel_pos) {
295
296
mode = PAGE_CUR_LE;
296
} else if (cursor->rel_pos == BTR_PCUR_AFTER) {
297
299
mode = PAGE_CUR_G;
299
ut_ad(cursor->rel_pos == BTR_PCUR_BEFORE);
301
case BTR_PCUR_BEFORE:
300
302
mode = PAGE_CUR_L;
307
#endif /* UNIV_DEBUG */
303
310
btr_pcur_open_with_no_init(index, tuple, mode, latch_mode,
306
313
/* Restore the old search mode */
307
314
cursor->search_mode = old_mode;
309
if (cursor->rel_pos == BTR_PCUR_ON
310
&& btr_pcur_is_on_user_rec(cursor, mtr)
311
&& 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
313
btr_pcur_get_rec(cursor), index,
314
NULL, ULINT_UNDEFINED, &heap))) {
316
/* We have to store the NEW value for the modify clock, since
317
the cursor can now be on a different page! But we can retain
318
the value of old_rec */
320
cursor->block_when_stored = buf_block_align(
321
btr_pcur_get_page(cursor));
322
cursor->modify_clock = buf_block_get_modify_clock(
323
cursor->block_when_stored);
324
cursor->old_stored = BTR_PCUR_OLD_STORED;
316
if (btr_pcur_is_on_user_rec(cursor, mtr)) {
317
switch (cursor->rel_pos) {
320
tuple, btr_pcur_get_rec(cursor),
321
rec_get_offsets(btr_pcur_get_rec(cursor),
323
ULINT_UNDEFINED, &heap))) {
325
/* We have to store the NEW value for
326
the modify clock, since the cursor can
327
now be on a different page! But we can
328
retain the value of old_rec */
330
cursor->block_when_stored =
332
btr_pcur_get_page(cursor));
333
cursor->modify_clock =
334
buf_block_get_modify_clock(
335
cursor->block_when_stored);
336
cursor->old_stored = BTR_PCUR_OLD_STORED;
344
case BTR_PCUR_BEFORE:
345
page_cur_move_to_next(btr_pcur_get_page_cur(cursor));
348
page_cur_move_to_prev(btr_pcur_get_page_cur(cursor));
353
#endif /* UNIV_DEBUG */
331
357
mem_heap_free(heap);