~sergei.glushchenko/percona-server/ps51-128-max-index-gca

« back to all changes in this revision

Viewing changes to storage/innobase/btr/btr0pcur.c

  • Committer: Georgi Kodinov
  • Date: 2012-03-08 15:16:53 UTC
  • mfrom: (3560.6.122 mysql-5.1)
  • Revision ID: georgi.kodinov@oracle.com-20120308151653-sfxjkoty2y2fftcb
merge mysql-5.1->mysql-5.1-security

Show diffs side-by-side

added added

removed removed

Lines of Context:
291
291
        /* Save the old search mode of the cursor */
292
292
        old_mode = cursor->search_mode;
293
293
 
294
 
        if (UNIV_LIKELY(cursor->rel_pos == BTR_PCUR_ON)) {
 
294
        switch (cursor->rel_pos) {
 
295
        case BTR_PCUR_ON:
295
296
                mode = PAGE_CUR_LE;
296
 
        } else if (cursor->rel_pos == BTR_PCUR_AFTER) {
 
297
                break;
 
298
        case BTR_PCUR_AFTER:
297
299
                mode = PAGE_CUR_G;
298
 
        } else {
299
 
                ut_ad(cursor->rel_pos == BTR_PCUR_BEFORE);
 
300
                break;
 
301
        case BTR_PCUR_BEFORE:
300
302
                mode = PAGE_CUR_L;
 
303
                break;
 
304
#ifdef UNIV_DEBUG
 
305
        default:
 
306
                ut_error;
 
307
#endif /* UNIV_DEBUG */
301
308
        }
302
309
 
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;
308
315
 
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),
312
 
                                   rec_get_offsets(
313
 
                                           btr_pcur_get_rec(cursor), index,
314
 
                                           NULL, ULINT_UNDEFINED, &heap))) {
315
 
 
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 */
319
 
 
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;
325
 
 
326
 
                mem_heap_free(heap);
327
 
 
328
 
                return(TRUE);
 
316
        if (btr_pcur_is_on_user_rec(cursor, mtr)) {
 
317
                switch (cursor->rel_pos) {
 
318
                case BTR_PCUR_ON:
 
319
                        if (!cmp_dtuple_rec(
 
320
                                    tuple, btr_pcur_get_rec(cursor),
 
321
                                    rec_get_offsets(btr_pcur_get_rec(cursor),
 
322
                                                    index, NULL,
 
323
                                                    ULINT_UNDEFINED, &heap))) {
 
324
 
 
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 */
 
329
 
 
330
                                cursor->block_when_stored =
 
331
                                        buf_block_align(
 
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;
 
337
 
 
338
                                mem_heap_free(heap);
 
339
 
 
340
                                return(TRUE);
 
341
                        }
 
342
 
 
343
                        break;
 
344
                case BTR_PCUR_BEFORE:
 
345
                        page_cur_move_to_next(btr_pcur_get_page_cur(cursor));
 
346
                        break;
 
347
                case BTR_PCUR_AFTER:
 
348
                        page_cur_move_to_prev(btr_pcur_get_page_cur(cursor));
 
349
                        break;
 
350
#ifdef UNIV_DEBUG
 
351
                default:
 
352
                        ut_error;
 
353
#endif /* UNIV_DEBUG */
 
354
                }
329
355
        }
330
356
 
331
357
        mem_heap_free(heap);