~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/row/row0vers.c

  • Committer: patrick crews
  • Date: 2010-09-29 15:15:19 UTC
  • mfrom: (1099.4.188 drizzle)
  • Revision ID: gleebix@gmail.com-20100929151519-6mrmzd1ciw2p9nws
Tags: 2010.09.1802
Update translations

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 1997, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
13
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
 
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
71
71
                                        warning */
72
72
        trx_t*          trx;
73
73
        ulint           rec_del;
74
 
#ifdef UNIV_DEBUG
75
74
        ulint           err;
76
 
#endif /* UNIV_DEBUG */
77
75
        mtr_t           mtr;
78
76
        ulint           comp;
79
77
 
171
169
 
172
170
                heap2 = heap;
173
171
                heap = mem_heap_create(1024);
174
 
#ifdef UNIV_DEBUG
175
 
                err =
176
 
#endif /* UNIV_DEBUG */
177
 
                trx_undo_prev_version_build(clust_rec, &mtr, version,
178
 
                                            clust_index, clust_offsets,
179
 
                                            heap, &prev_version);
 
172
                err = trx_undo_prev_version_build(clust_rec, &mtr, version,
 
173
                                                  clust_index, clust_offsets,
 
174
                                                  heap, &prev_version);
180
175
                mem_heap_free(heap2); /* free version and clust_offsets */
181
176
 
182
177
                if (prev_version == NULL) {
214
209
                prev_trx_id must have already committed for the trx_id
215
210
                to be able to modify the row. Therefore, prev_trx_id
216
211
                cannot hold any implicit lock. */
217
 
                if (vers_del && trx_id != prev_trx_id) {
 
212
                if (vers_del && 0 != ut_dulint_cmp(trx_id, prev_trx_id)) {
218
213
 
219
214
                        mutex_enter(&kernel_mutex);
220
215
                        break;
285
280
                        break;
286
281
                }
287
282
 
288
 
                if (trx_id != prev_trx_id) {
 
283
                if (0 != ut_dulint_cmp(trx_id, prev_trx_id)) {
289
284
                        /* The versions modified by the trx_id transaction end
290
285
                        to prev_version: no implicit x-lock */
291
286
 
538
533
                undo_no of the record is < undo_no in the view. */
539
534
 
540
535
                if (view->type == VIEW_HIGH_GRANULARITY
541
 
                    && view->creator_trx_id == trx_id) {
 
536
                    && ut_dulint_cmp(view->creator_trx_id, trx_id) == 0) {
542
537
 
543
538
                        roll_ptr = row_get_rec_roll_ptr(version, index,
544
539
                                                        *offsets);
546
541
                        undo_no = trx_undo_rec_get_undo_no(undo_rec);
547
542
                        mem_heap_empty(heap);
548
543
 
549
 
                        if (view->undo_no > undo_no) {
 
544
                        if (ut_dulint_cmp(view->undo_no, undo_no) > 0) {
550
545
                                /* The view already sees this version: we can
551
546
                                copy it to in_heap and return */
552
547
 
553
 
                                buf = static_cast<byte *>(mem_heap_alloc(in_heap,
554
 
                                                     rec_offs_size(*offsets)));
 
548
                                buf = mem_heap_alloc(in_heap,
 
549
                                                     rec_offs_size(*offsets));
555
550
                                *old_vers = rec_copy(buf, version, *offsets);
556
551
                                rec_offs_make_valid(*old_vers, index,
557
552
                                                    *offsets);
590
585
                        /* The view already sees this version: we can copy
591
586
                        it to in_heap and return */
592
587
 
593
 
                        buf = static_cast<byte *>(mem_heap_alloc(in_heap, rec_offs_size(*offsets)));
 
588
                        buf = mem_heap_alloc(in_heap, rec_offs_size(*offsets));
594
589
                        *old_vers = rec_copy(buf, prev_version, *offsets);
595
590
                        rec_offs_make_valid(*old_vers, index, *offsets);
596
591
                        err = DB_SUCCESS;
637
632
        mem_heap_t*     heap            = NULL;
638
633
        byte*           buf;
639
634
        ulint           err;
640
 
        trx_id_t        rec_trx_id      = 0;
 
635
        trx_id_t        rec_trx_id      = ut_dulint_zero;
641
636
 
642
637
        ut_ad(dict_index_is_clust(index));
643
638
        ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
689
684
                        rolled back and the transaction is removed from
690
685
                        the global list of transactions. */
691
686
 
692
 
                        if (rec_trx_id == version_trx_id) {
 
687
                        if (!ut_dulint_cmp(rec_trx_id, version_trx_id)) {
693
688
                                /* The transaction was committed while
694
689
                                we searched for earlier versions.
695
690
                                Return the current version as a
702
697
                                                           offset_heap);
703
698
                        }
704
699
 
705
 
                        buf = static_cast<byte *>(mem_heap_alloc(in_heap, rec_offs_size(*offsets)));
 
700
                        buf = mem_heap_alloc(in_heap, rec_offs_size(*offsets));
706
701
                        *old_vers = rec_copy(buf, version, *offsets);
707
702
                        rec_offs_make_valid(*old_vers, index, *offsets);
708
703
                        err = DB_SUCCESS;