~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/row/row0umod.c

Imported InnoDB plugin with changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
                                we may run out of file space */
83
83
        undo_node_t*    node,   /* in: row undo node */
84
84
        que_thr_t*      thr,    /* in: query thread */
85
 
        mtr_t*          mtr,    /* in: mtr */
 
85
        mtr_t*          mtr,    /* in: mtr; must be committed before
 
86
                                latching any further pages */
86
87
        ulint           mode)   /* in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE */
87
88
{
88
 
        big_rec_t*      dummy_big_rec;
89
89
        btr_pcur_t*     pcur;
90
90
        btr_cur_t*      btr_cur;
91
91
        ulint           err;
106
106
                                                btr_cur, node->update,
107
107
                                                node->cmpl_info, thr, mtr);
108
108
        } else {
 
109
                mem_heap_t*     heap            = NULL;
 
110
                big_rec_t*      dummy_big_rec;
 
111
 
109
112
                ut_ad(mode == BTR_MODIFY_TREE);
110
113
 
111
114
                err = btr_cur_pessimistic_update(
112
115
                        BTR_NO_LOCKING_FLAG
113
116
                        | BTR_NO_UNDO_LOG_FLAG
114
117
                        | BTR_KEEP_SYS_FLAG,
115
 
                        btr_cur, &dummy_big_rec, node->update,
 
118
                        btr_cur, &heap, &dummy_big_rec, node->update,
116
119
                        node->cmpl_info, thr, mtr);
 
120
 
 
121
                ut_a(!dummy_big_rec);
 
122
                if (UNIV_LIKELY_NULL(heap)) {
 
123
                        mem_heap_free(heap);
 
124
                }
117
125
        }
118
126
 
119
127
        return(err);
411
419
        btr_pcur_t      pcur;
412
420
        upd_t*          update;
413
421
        ulint           err             = DB_SUCCESS;
414
 
        ibool           found;
415
422
        big_rec_t*      dummy_big_rec;
416
423
        mtr_t           mtr;
417
424
        trx_t*          trx             = thr_get_trx(thr);
419
426
        log_free_check();
420
427
        mtr_start(&mtr);
421
428
 
422
 
        found = row_search_index_entry(index, entry, mode, &pcur, &mtr);
423
 
 
424
 
        if (!found) {
 
429
        /* Ignore indexes that are being created. */
 
430
        if (UNIV_UNLIKELY(*index->name == TEMP_INDEX_PREFIX)) {
 
431
 
 
432
                return(DB_SUCCESS);
 
433
        }
 
434
 
 
435
        if (UNIV_UNLIKELY(!row_search_index_entry(index, entry,
 
436
                                                  mode, &pcur, &mtr))) {
425
437
                fputs("InnoDB: error in sec index entry del undo in\n"
426
438
                      "InnoDB: ", stderr);
427
439
                dict_index_name_print(stderr, trx, index);
457
469
                        err = btr_cur_optimistic_update(
458
470
                                BTR_KEEP_SYS_FLAG | BTR_NO_LOCKING_FLAG,
459
471
                                btr_cur, update, 0, thr, &mtr);
460
 
                        if (err == DB_OVERFLOW || err == DB_UNDERFLOW) {
 
472
                        switch (err) {
 
473
                        case DB_OVERFLOW:
 
474
                        case DB_UNDERFLOW:
 
475
                        case DB_ZIP_OVERFLOW:
461
476
                                err = DB_FAIL;
462
477
                        }
463
478
                } else {
464
479
                        ut_a(mode == BTR_MODIFY_TREE);
465
480
                        err = btr_cur_pessimistic_update(
466
481
                                BTR_KEEP_SYS_FLAG | BTR_NO_LOCKING_FLAG,
467
 
                                btr_cur, &dummy_big_rec,
 
482
                                btr_cur, &heap, &dummy_big_rec,
468
483
                                update, 0, thr, &mtr);
 
484
                        ut_a(!dummy_big_rec);
469
485
                }
470
486
 
471
487
                mem_heap_free(heap);
497
513
        while (node->index != NULL) {
498
514
                index = node->index;
499
515
 
500
 
                entry = row_build_index_entry(node->row, index, heap);
501
 
 
 
516
                entry = row_build_index_entry(node->row, node->ext,
 
517
                                              index, heap);
 
518
                ut_a(entry);
502
519
                err = row_undo_mod_del_mark_or_remove_sec(node, thr, index,
503
520
                                                          entry);
504
521
                if (err != DB_SUCCESS) {
536
553
        while (node->index != NULL) {
537
554
                index = node->index;
538
555
 
539
 
                entry = row_build_index_entry(node->row, index, heap);
540
 
 
 
556
                entry = row_build_index_entry(node->row, node->ext,
 
557
                                              index, heap);
 
558
                ut_a(entry);
541
559
                err = row_undo_mod_del_unmark_sec_and_undo_update(
542
560
                        BTR_MODIFY_LEAF, thr, index, entry);
543
561
                if (err == DB_FAIL) {
590
608
                                                     node->update)) {
591
609
 
592
610
                        /* Build the newest version of the index entry */
593
 
                        entry = row_build_index_entry(node->row, index, heap);
594
 
 
 
611
                        entry = row_build_index_entry(node->row, node->ext,
 
612
                                                      index, heap);
 
613
                        ut_a(entry);
595
614
                        /* NOTE that if we updated the fields of a
596
615
                        delete-marked secondary index record so that
597
616
                        alphabetically they stayed the same, e.g.,
617
636
                        the secondary index record if we updated its fields
618
637
                        but alphabetically they stayed the same, e.g.,
619
638
                        'abc' -> 'aBc'. */
 
639
                        mem_heap_empty(heap);
 
640
                        entry = row_build_index_entry(node->undo_row,
 
641
                                                      node->undo_ext,
 
642
                                                      index, heap);
 
643
                        ut_a(entry);
620
644
 
621
 
                        row_upd_index_replace_new_col_vals(entry, index,
622
 
                                                           node->update, NULL);
623
645
                        err = row_undo_mod_del_unmark_sec_and_undo_update(
624
646
                                BTR_MODIFY_LEAF, thr, index, entry);
625
647
                        if (err == DB_FAIL) {
704
726
 
705
727
/***************************************************************
706
728
Undoes a modify operation on a row of a table. */
707
 
 
 
729
UNIV_INTERN
708
730
ulint
709
731
row_undo_mod(
710
732
/*=========*/
712
734
        undo_node_t*    node,   /* in: row undo node */
713
735
        que_thr_t*      thr)    /* in: query thread */
714
736
{
715
 
        ibool   found;
716
737
        ulint   err;
717
738
 
718
739
        ut_ad(node && thr);
720
741
 
721
742
        row_undo_mod_parse_undo_rec(node, thr);
722
743
 
723
 
        if (node->table == NULL) {
724
 
                found = FALSE;
725
 
        } else {
726
 
                found = row_undo_search_clust_to_pcur(node);
727
 
        }
728
 
 
729
 
        if (!found) {
 
744
        if (!node->table || !row_undo_search_clust_to_pcur(node)) {
730
745
                /* It is already undone, or will be undone by another query
731
746
                thread, or table was dropped */
732
747