~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/trx/trx0rec.c

  • Committer: Monty Taylor
  • Date: 2009-08-12 06:25:19 UTC
  • mto: (1114.1.1 innodb-plugin-merge)
  • mto: This revision was merged to the branch mainline in revision 1183.
  • Revision ID: mordred@inaugust.com-20090812062519-cij02mrrunvnxblt
Tags: innodb-plugin-1.0.4
InnoDB Plugin 1.0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
*****************************************************************************/
18
18
 
19
 
/******************************************************
 
19
/**************************************************//**
 
20
@file trx/trx0rec.c
20
21
Transaction undo log record
21
22
 
22
23
Created 3/26/1996 Heikki Tuuri
30
31
 
31
32
#include "fsp0fsp.h"
32
33
#include "mach0data.h"
33
 
#include "trx0rseg.h"
34
 
#include "trx0trx.h"
35
34
#include "trx0undo.h"
 
35
#include "mtr0log.h"
 
36
#ifndef UNIV_HOTBACKUP
36
37
#include "dict0dict.h"
37
38
#include "ut0mem.h"
38
39
#include "row0ext.h"
39
40
#include "row0upd.h"
40
41
#include "que0que.h"
41
42
#include "trx0purge.h"
 
43
#include "trx0rseg.h"
42
44
#include "row0row.h"
43
45
 
44
46
/*=========== UNDO LOG RECORD CREATION AND DECODING ====================*/
45
47
 
46
 
/**************************************************************************
 
48
/**********************************************************************//**
47
49
Writes the mtr log entry of the inserted undo log record on the undo log
48
50
page. */
49
51
UNIV_INLINE
50
52
void
51
53
trx_undof_page_add_undo_rec_log(
52
54
/*============================*/
53
 
        page_t* undo_page,      /* in: undo log page */
54
 
        ulint   old_free,       /* in: start offset of the inserted entry */
55
 
        ulint   new_free,       /* in: end offset of the entry */
56
 
        mtr_t*  mtr)            /* in: mtr */
 
55
        page_t* undo_page,      /*!< in: undo log page */
 
56
        ulint   old_free,       /*!< in: start offset of the inserted entry */
 
57
        ulint   new_free,       /*!< in: end offset of the entry */
 
58
        mtr_t*  mtr)            /*!< in: mtr */
57
59
{
58
60
        byte*           log_ptr;
59
61
        const byte*     log_end;
82
84
                mlog_catenate_string(mtr, undo_page + old_free + 2, len);
83
85
        }
84
86
}
 
87
#endif /* !UNIV_HOTBACKUP */
85
88
 
86
 
/***************************************************************
87
 
Parses a redo log record of adding an undo log record. */
 
89
/***********************************************************//**
 
90
Parses a redo log record of adding an undo log record.
 
91
@return end of log record or NULL */
88
92
UNIV_INTERN
89
93
byte*
90
94
trx_undo_parse_add_undo_rec(
91
95
/*========================*/
92
 
                        /* out: end of log record or NULL */
93
 
        byte*   ptr,    /* in: buffer */
94
 
        byte*   end_ptr,/* in: buffer end */
95
 
        page_t* page)   /* in: page or NULL */
 
96
        byte*   ptr,    /*!< in: buffer */
 
97
        byte*   end_ptr,/*!< in: buffer end */
 
98
        page_t* page)   /*!< in: page or NULL */
96
99
{
97
100
        ulint   len;
98
101
        byte*   rec;
130
133
        return(ptr + len);
131
134
}
132
135
 
133
 
/**************************************************************************
134
 
Calculates the free space left for extending an undo log record. */
 
136
#ifndef UNIV_HOTBACKUP
 
137
/**********************************************************************//**
 
138
Calculates the free space left for extending an undo log record.
 
139
@return bytes left */
135
140
UNIV_INLINE
136
141
ulint
137
142
trx_undo_left(
138
143
/*==========*/
139
 
                                /* out: bytes left */
140
 
        const page_t*   page,   /* in: undo log page */
141
 
        const byte*     ptr)    /* in: pointer to page */
 
144
        const page_t*   page,   /*!< in: undo log page */
 
145
        const byte*     ptr)    /*!< in: pointer to page */
142
146
{
143
147
        /* The '- 10' is a safety margin, in case we have some small
144
148
        calculation error below */
146
150
        return(UNIV_PAGE_SIZE - (ptr - page) - 10 - FIL_PAGE_DATA_END);
147
151
}
148
152
 
149
 
/**************************************************************************
 
153
/**********************************************************************//**
150
154
Set the next and previous pointers in the undo page for the undo record
151
155
that was written to ptr. Update the first free value by the number of bytes
152
 
written for this undo record.*/
 
156
written for this undo record.
 
157
@return offset of the inserted entry on the page if succeeded, 0 if fail */
153
158
static
154
159
ulint
155
160
trx_undo_page_set_next_prev_and_add(
156
161
/*================================*/
157
 
                                        /* out: offset of the inserted entry
158
 
                                        on the page if succeeded, 0 if fail */
159
 
        page_t*         undo_page,      /* in/out: undo log page */
160
 
        byte*           ptr,            /* in: ptr up to where data has been
 
162
        page_t*         undo_page,      /*!< in/out: undo log page */
 
163
        byte*           ptr,            /*!< in: ptr up to where data has been
161
164
                                        written on this undo page. */
162
 
        mtr_t*          mtr)            /* in: mtr */
 
165
        mtr_t*          mtr)            /*!< in: mtr */
163
166
{
164
 
        ulint           first_free;     /* offset within undo_page */
165
 
        ulint           end_of_rec;     /* offset within undo_page */
 
167
        ulint           first_free;     /*!< offset within undo_page */
 
168
        ulint           end_of_rec;     /*!< offset within undo_page */
166
169
        byte*           ptr_to_first_free;
167
170
                                        /* pointer within undo_page
168
171
                                        that points to the next free
199
202
        return(first_free);
200
203
}
201
204
 
202
 
/**************************************************************************
203
 
Reports in the undo log of an insert of a clustered index record. */
 
205
/**********************************************************************//**
 
206
Reports in the undo log of an insert of a clustered index record.
 
207
@return offset of the inserted entry on the page if succeed, 0 if fail */
204
208
static
205
209
ulint
206
210
trx_undo_page_report_insert(
207
211
/*========================*/
208
 
                                        /* out: offset of the inserted entry
209
 
                                        on the page if succeed, 0 if fail */
210
 
        page_t*         undo_page,      /* in: undo log page */
211
 
        trx_t*          trx,            /* in: transaction */
212
 
        dict_index_t*   index,          /* in: clustered index */
213
 
        const dtuple_t* clust_entry,    /* in: index entry which will be
 
212
        page_t*         undo_page,      /*!< in: undo log page */
 
213
        trx_t*          trx,            /*!< in: transaction */
 
214
        dict_index_t*   index,          /*!< in: clustered index */
 
215
        const dtuple_t* clust_entry,    /*!< in: index entry which will be
214
216
                                        inserted to the clustered index */
215
 
        mtr_t*          mtr)            /* in: mtr */
 
217
        mtr_t*          mtr)            /*!< in: mtr */
216
218
{
217
219
        ulint           first_free;
218
220
        byte*           ptr;
272
274
        return(trx_undo_page_set_next_prev_and_add(undo_page, ptr, mtr));
273
275
}
274
276
 
275
 
/**************************************************************************
276
 
Reads from an undo log record the general parameters. */
 
277
/**********************************************************************//**
 
278
Reads from an undo log record the general parameters.
 
279
@return remaining part of undo log record after reading these values */
277
280
UNIV_INTERN
278
281
byte*
279
282
trx_undo_rec_get_pars(
280
283
/*==================*/
281
 
                                        /* out: remaining part of undo log
282
 
                                        record after reading these values */
283
 
        trx_undo_rec_t* undo_rec,       /* in: undo log record */
284
 
        ulint*          type,           /* out: undo record type:
 
284
        trx_undo_rec_t* undo_rec,       /*!< in: undo log record */
 
285
        ulint*          type,           /*!< out: undo record type:
285
286
                                        TRX_UNDO_INSERT_REC, ... */
286
 
        ulint*          cmpl_info,      /* out: compiler info, relevant only
 
287
        ulint*          cmpl_info,      /*!< out: compiler info, relevant only
287
288
                                        for update type records */
288
 
        ibool*          updated_extern, /* out: TRUE if we updated an
 
289
        ibool*          updated_extern, /*!< out: TRUE if we updated an
289
290
                                        externally stored fild */
290
 
        dulint*         undo_no,        /* out: undo log record number */
291
 
        dulint*         table_id)       /* out: table id */
 
291
        undo_no_t*      undo_no,        /*!< out: undo log record number */
 
292
        dulint*         table_id)       /*!< out: table id */
292
293
{
293
294
        byte*           ptr;
294
295
        ulint           type_cmpl;
317
318
        return(ptr);
318
319
}
319
320
 
320
 
/**************************************************************************
321
 
Reads from an undo log record a stored column value. */
 
321
/**********************************************************************//**
 
322
Reads from an undo log record a stored column value.
 
323
@return remaining part of undo log record after reading these values */
322
324
static
323
325
byte*
324
326
trx_undo_rec_get_col_val(
325
327
/*=====================*/
326
 
                        /* out: remaining part of undo log record after
327
 
                        reading these values */
328
 
        byte*   ptr,    /* in: pointer to remaining part of undo log record */
329
 
        byte**  field,  /* out: pointer to stored field */
330
 
        ulint*  len,    /* out: length of the field, or UNIV_SQL_NULL */
331
 
        ulint*  orig_len)/* out: original length of the locally
 
328
        byte*   ptr,    /*!< in: pointer to remaining part of undo log record */
 
329
        byte**  field,  /*!< out: pointer to stored field */
 
330
        ulint*  len,    /*!< out: length of the field, or UNIV_SQL_NULL */
 
331
        ulint*  orig_len)/*!< out: original length of the locally
332
332
                        stored part of an externally stored column, or 0 */
333
333
{
334
334
        *len = mach_read_compressed(ptr);
367
367
        return(ptr);
368
368
}
369
369
 
370
 
/***********************************************************************
371
 
Builds a row reference from an undo log record. */
 
370
/*******************************************************************//**
 
371
Builds a row reference from an undo log record.
 
372
@return pointer to remaining part of undo record */
372
373
UNIV_INTERN
373
374
byte*
374
375
trx_undo_rec_get_row_ref(
375
376
/*=====================*/
376
 
                                /* out: pointer to remaining part of undo
377
 
                                record */
378
 
        byte*           ptr,    /* in: remaining part of a copy of an undo log
 
377
        byte*           ptr,    /*!< in: remaining part of a copy of an undo log
379
378
                                record, at the start of the row reference;
380
379
                                NOTE that this copy of the undo log record must
381
380
                                be preserved as long as the row reference is
382
381
                                used, as we do NOT copy the data in the
383
382
                                record! */
384
 
        dict_index_t*   index,  /* in: clustered index */
385
 
        dtuple_t**      ref,    /* out, own: row reference */
386
 
        mem_heap_t*     heap)   /* in: memory heap from which the memory
 
383
        dict_index_t*   index,  /*!< in: clustered index */
 
384
        dtuple_t**      ref,    /*!< out, own: row reference */
 
385
        mem_heap_t*     heap)   /*!< in: memory heap from which the memory
387
386
                                needed is allocated */
388
387
{
389
388
        ulint           ref_len;
414
413
        return(ptr);
415
414
}
416
415
 
417
 
/***********************************************************************
418
 
Skips a row reference from an undo log record. */
 
416
/*******************************************************************//**
 
417
Skips a row reference from an undo log record.
 
418
@return pointer to remaining part of undo record */
419
419
UNIV_INTERN
420
420
byte*
421
421
trx_undo_rec_skip_row_ref(
422
422
/*======================*/
423
 
                                /* out: pointer to remaining part of undo
424
 
                                record */
425
 
        byte*           ptr,    /* in: remaining part in update undo log
 
423
        byte*           ptr,    /*!< in: remaining part in update undo log
426
424
                                record, at the start of the row reference */
427
 
        dict_index_t*   index)  /* in: clustered index */
 
425
        dict_index_t*   index)  /*!< in: clustered index */
428
426
{
429
427
        ulint   ref_len;
430
428
        ulint   i;
445
443
        return(ptr);
446
444
}
447
445
 
448
 
/**************************************************************************
 
446
/**********************************************************************//**
449
447
Fetch a prefix of an externally stored column, for writing to the undo log
450
 
of an update or delete marking of a clustered index record. */
 
448
of an update or delete marking of a clustered index record.
 
449
@return ext_buf */
451
450
static
452
451
byte*
453
452
trx_undo_page_fetch_ext(
454
453
/*====================*/
455
 
                                        /* out: ext_buf */
456
 
        byte*           ext_buf,        /* in: a buffer of
 
454
        byte*           ext_buf,        /*!< in: a buffer of
457
455
                                        REC_MAX_INDEX_COL_LEN
458
456
                                        + BTR_EXTERN_FIELD_REF_SIZE */
459
 
        ulint           zip_size,       /* compressed page size in bytes,
 
457
        ulint           zip_size,       /*!< compressed page size in bytes,
460
458
                                        or 0 for uncompressed BLOB  */
461
 
        const byte*     field,          /* in: an externally stored column */
462
 
        ulint*          len)            /* in: length of field;
 
459
        const byte*     field,          /*!< in: an externally stored column */
 
460
        ulint*          len)            /*!< in: length of field;
463
461
                                        out: used length of ext_buf */
464
462
{
465
463
        /* Fetch the BLOB. */
475
473
        return(ext_buf);
476
474
}
477
475
 
478
 
/**************************************************************************
479
 
Writes to the undo log a prefix of an externally stored column. */
 
476
/**********************************************************************//**
 
477
Writes to the undo log a prefix of an externally stored column.
 
478
@return undo log position */
480
479
static
481
480
byte*
482
481
trx_undo_page_report_modify_ext(
483
482
/*============================*/
484
 
                                        /* out: undo log position */
485
 
        byte*           ptr,            /* in: undo log position,
 
483
        byte*           ptr,            /*!< in: undo log position,
486
484
                                        at least 15 bytes must be available */
487
 
        byte*           ext_buf,        /* in: a buffer of
 
485
        byte*           ext_buf,        /*!< in: a buffer of
488
486
                                        REC_MAX_INDEX_COL_LEN
489
487
                                        + BTR_EXTERN_FIELD_REF_SIZE,
490
488
                                        or NULL when should not fetch
491
489
                                        a longer prefix */
492
 
        ulint           zip_size,       /* compressed page size in bytes,
 
490
        ulint           zip_size,       /*!< compressed page size in bytes,
493
491
                                        or 0 for uncompressed BLOB  */
494
 
        const byte**    field,          /* in/out: the locally stored part of
 
492
        const byte**    field,          /*!< in/out: the locally stored part of
495
493
                                        the externally stored column */
496
 
        ulint*          len)            /* in/out: length of field, in bytes */
 
494
        ulint*          len)            /*!< in/out: length of field, in bytes */
497
495
{
498
496
        if (ext_buf) {
499
497
                /* If an ordering column is externally stored, we will
516
514
        return(ptr);
517
515
}
518
516
 
519
 
/**************************************************************************
 
517
/**********************************************************************//**
520
518
Reports in the undo log of an update or delete marking of a clustered index
521
 
record. */
 
519
record.
 
520
@return byte offset of the inserted undo log entry on the page if
 
521
succeed, 0 if fail */
522
522
static
523
523
ulint
524
524
trx_undo_page_report_modify(
525
525
/*========================*/
526
 
                                        /* out: byte offset of the inserted
527
 
                                        undo log entry on the page if succeed,
528
 
                                        0 if fail */
529
 
        page_t*         undo_page,      /* in: undo log page */
530
 
        trx_t*          trx,            /* in: transaction */
531
 
        dict_index_t*   index,          /* in: clustered index where update or
 
526
        page_t*         undo_page,      /*!< in: undo log page */
 
527
        trx_t*          trx,            /*!< in: transaction */
 
528
        dict_index_t*   index,          /*!< in: clustered index where update or
532
529
                                        delete marking is done */
533
 
        const rec_t*    rec,            /* in: clustered index record which
 
530
        const rec_t*    rec,            /*!< in: clustered index record which
534
531
                                        has NOT yet been modified */
535
 
        const ulint*    offsets,        /* in: rec_get_offsets(rec, index) */
536
 
        const upd_t*    update,         /* in: update vector which tells the
 
532
        const ulint*    offsets,        /*!< in: rec_get_offsets(rec, index) */
 
533
        const upd_t*    update,         /*!< in: update vector which tells the
537
534
                                        columns to be updated; in the case of
538
535
                                        a delete, this should be set to NULL */
539
 
        ulint           cmpl_info,      /* in: compiler info on secondary
 
536
        ulint           cmpl_info,      /*!< in: compiler info on secondary
540
537
                                        index updates */
541
 
        mtr_t*          mtr)            /* in: mtr */
 
538
        mtr_t*          mtr)            /*!< in: mtr */
542
539
{
543
540
        dict_table_t*   table;
544
541
        ulint           first_free;
549
546
        ulint           type_cmpl;
550
547
        byte*           type_cmpl_ptr;
551
548
        ulint           i;
552
 
        dulint          trx_id;
 
549
        trx_id_t        trx_id;
553
550
        ibool           ignore_prefix = FALSE;
554
551
        byte            ext_buf[REC_MAX_INDEX_COL_LEN
555
552
                                + BTR_EXTERN_FIELD_REF_SIZE];
825
822
        return(first_free);
826
823
}
827
824
 
828
 
/**************************************************************************
 
825
/**********************************************************************//**
829
826
Reads from an undo log update record the system field values of the old
830
 
version. */
 
827
version.
 
828
@return remaining part of undo log record after reading these values */
831
829
UNIV_INTERN
832
830
byte*
833
831
trx_undo_update_rec_get_sys_cols(
834
832
/*=============================*/
835
 
                                /* out: remaining part of undo log
836
 
                                record after reading these values */
837
 
        byte*   ptr,            /* in: remaining part of undo log
838
 
                                record after reading general
839
 
                                parameters */
840
 
        dulint* trx_id,         /* out: trx id */
841
 
        dulint* roll_ptr,       /* out: roll ptr */
842
 
        ulint*  info_bits)      /* out: info bits state */
 
833
        byte*           ptr,            /*!< in: remaining part of undo
 
834
                                        log record after reading
 
835
                                        general parameters */
 
836
        trx_id_t*       trx_id,         /*!< out: trx id */
 
837
        roll_ptr_t*     roll_ptr,       /*!< out: roll ptr */
 
838
        ulint*          info_bits)      /*!< out: info bits state */
843
839
{
844
840
        /* Read the state of the info bits */
845
841
        *info_bits = mach_read_from_1(ptr);
856
852
        return(ptr);
857
853
}
858
854
 
859
 
/**************************************************************************
860
 
Reads from an update undo log record the number of updated fields. */
 
855
/**********************************************************************//**
 
856
Reads from an update undo log record the number of updated fields.
 
857
@return remaining part of undo log record after reading this value */
861
858
UNIV_INLINE
862
859
byte*
863
860
trx_undo_update_rec_get_n_upd_fields(
864
861
/*=================================*/
865
 
                        /* out: remaining part of undo log record after
866
 
                        reading this value */
867
 
        byte*   ptr,    /* in: pointer to remaining part of undo log record */
868
 
        ulint*  n)      /* out: number of fields */
 
862
        byte*   ptr,    /*!< in: pointer to remaining part of undo log record */
 
863
        ulint*  n)      /*!< out: number of fields */
869
864
{
870
865
        *n = mach_read_compressed(ptr);
871
866
        ptr += mach_get_compressed_size(*n);
873
868
        return(ptr);
874
869
}
875
870
 
876
 
/**************************************************************************
877
 
Reads from an update undo log record a stored field number. */
 
871
/**********************************************************************//**
 
872
Reads from an update undo log record a stored field number.
 
873
@return remaining part of undo log record after reading this value */
878
874
UNIV_INLINE
879
875
byte*
880
876
trx_undo_update_rec_get_field_no(
881
877
/*=============================*/
882
 
                        /* out: remaining part of undo log record after
883
 
                        reading this value */
884
 
        byte*   ptr,    /* in: pointer to remaining part of undo log record */
885
 
        ulint*  field_no)/* out: field number */
 
878
        byte*   ptr,    /*!< in: pointer to remaining part of undo log record */
 
879
        ulint*  field_no)/*!< out: field number */
886
880
{
887
881
        *field_no = mach_read_compressed(ptr);
888
882
        ptr += mach_get_compressed_size(*field_no);
890
884
        return(ptr);
891
885
}
892
886
 
893
 
/***********************************************************************
894
 
Builds an update vector based on a remaining part of an undo log record. */
 
887
/*******************************************************************//**
 
888
Builds an update vector based on a remaining part of an undo log record.
 
889
@return remaining part of the record, NULL if an error detected, which
 
890
means that the record is corrupted */
895
891
UNIV_INTERN
896
892
byte*
897
893
trx_undo_update_rec_get_update(
898
894
/*===========================*/
899
 
                                /* out: remaining part of the record,
900
 
                                NULL if an error detected, which means that
901
 
                                the record is corrupted */
902
 
        byte*           ptr,    /* in: remaining part in update undo log
 
895
        byte*           ptr,    /*!< in: remaining part in update undo log
903
896
                                record, after reading the row reference
904
897
                                NOTE that this copy of the undo log record must
905
898
                                be preserved as long as the update vector is
906
899
                                used, as we do NOT copy the data in the
907
900
                                record! */
908
 
        dict_index_t*   index,  /* in: clustered index */
909
 
        ulint           type,   /* in: TRX_UNDO_UPD_EXIST_REC,
 
901
        dict_index_t*   index,  /*!< in: clustered index */
 
902
        ulint           type,   /*!< in: TRX_UNDO_UPD_EXIST_REC,
910
903
                                TRX_UNDO_UPD_DEL_REC, or
911
904
                                TRX_UNDO_DEL_MARK_REC; in the last case,
912
905
                                only trx id and roll ptr fields are added to
913
906
                                the update vector */
914
 
        dulint          trx_id, /* in: transaction id from this undo record */
915
 
        dulint          roll_ptr,/* in: roll pointer from this undo record */
916
 
        ulint           info_bits,/* in: info bits from this undo record */
917
 
        trx_t*          trx,    /* in: transaction */
918
 
        mem_heap_t*     heap,   /* in: memory heap from which the memory
 
907
        trx_id_t        trx_id, /*!< in: transaction id from this undo record */
 
908
        roll_ptr_t      roll_ptr,/*!< in: roll pointer from this undo record */
 
909
        ulint           info_bits,/*!< in: info bits from this undo record */
 
910
        trx_t*          trx,    /*!< in: transaction */
 
911
        mem_heap_t*     heap,   /*!< in: memory heap from which the memory
919
912
                                needed is allocated */
920
 
        upd_t**         upd)    /* out, own: update vector */
 
913
        upd_t**         upd)    /*!< out, own: update vector */
921
914
{
922
915
        upd_field_t*    upd_field;
923
916
        upd_t*          update;
1012
1005
        return(ptr);
1013
1006
}
1014
1007
 
1015
 
/***********************************************************************
 
1008
/*******************************************************************//**
1016
1009
Builds a partial row from an update undo log record. It contains the
1017
 
columns which occur as ordering in any index of the table. */
 
1010
columns which occur as ordering in any index of the table.
 
1011
@return pointer to remaining part of undo record */
1018
1012
UNIV_INTERN
1019
1013
byte*
1020
1014
trx_undo_rec_get_partial_row(
1021
1015
/*=========================*/
1022
 
                                /* out: pointer to remaining part of undo
1023
 
                                record */
1024
 
        byte*           ptr,    /* in: remaining part in update undo log
 
1016
        byte*           ptr,    /*!< in: remaining part in update undo log
1025
1017
                                record of a suitable type, at the start of
1026
1018
                                the stored index columns;
1027
1019
                                NOTE that this copy of the undo log record must
1028
1020
                                be preserved as long as the partial row is
1029
1021
                                used, as we do NOT copy the data in the
1030
1022
                                record! */
1031
 
        dict_index_t*   index,  /* in: clustered index */
1032
 
        dtuple_t**      row,    /* out, own: partial row */
1033
 
        ibool           ignore_prefix, /* in: flag to indicate if we
 
1023
        dict_index_t*   index,  /*!< in: clustered index */
 
1024
        dtuple_t**      row,    /*!< out, own: partial row */
 
1025
        ibool           ignore_prefix, /*!< in: flag to indicate if we
1034
1026
                                expect blob prefixes in undo. Used
1035
1027
                                only in the assertion. */
1036
 
        mem_heap_t*     heap)   /* in: memory heap from which the memory
 
1028
        mem_heap_t*     heap)   /*!< in: memory heap from which the memory
1037
1029
                                needed is allocated */
1038
1030
{
1039
1031
        const byte*     end_ptr;
1092
1084
 
1093
1085
        return(ptr);
1094
1086
}
 
1087
#endif /* !UNIV_HOTBACKUP */
1095
1088
 
1096
 
/***************************************************************************
 
1089
/***********************************************************************//**
1097
1090
Erases the unused undo log page end. */
1098
1091
static
1099
1092
void
1100
1093
trx_undo_erase_page_end(
1101
1094
/*====================*/
1102
 
        page_t* undo_page,      /* in: undo page whose end to erase */
1103
 
        mtr_t*  mtr)            /* in: mtr */
 
1095
        page_t* undo_page,      /*!< in: undo page whose end to erase */
 
1096
        mtr_t*  mtr)            /*!< in: mtr */
1104
1097
{
1105
1098
        ulint   first_free;
1106
1099
 
1112
1105
        mlog_write_initial_log_record(undo_page, MLOG_UNDO_ERASE_END, mtr);
1113
1106
}
1114
1107
 
1115
 
/***************************************************************
1116
 
Parses a redo log record of erasing of an undo page end. */
 
1108
/***********************************************************//**
 
1109
Parses a redo log record of erasing of an undo page end.
 
1110
@return end of log record or NULL */
1117
1111
UNIV_INTERN
1118
1112
byte*
1119
1113
trx_undo_parse_erase_page_end(
1120
1114
/*==========================*/
1121
 
                        /* out: end of log record or NULL */
1122
 
        byte*   ptr,    /* in: buffer */
1123
 
        byte*   end_ptr __attribute__((unused)), /* in: buffer end */
1124
 
        page_t* page,   /* in: page or NULL */
1125
 
        mtr_t*  mtr)    /* in: mtr or NULL */
 
1115
        byte*   ptr,    /*!< in: buffer */
 
1116
        byte*   end_ptr __attribute__((unused)), /*!< in: buffer end */
 
1117
        page_t* page,   /*!< in: page or NULL */
 
1118
        mtr_t*  mtr)    /*!< in: mtr or NULL */
1126
1119
{
1127
1120
        ut_ad(ptr && end_ptr);
1128
1121
 
1136
1129
        return(ptr);
1137
1130
}
1138
1131
 
1139
 
/***************************************************************************
 
1132
#ifndef UNIV_HOTBACKUP
 
1133
/***********************************************************************//**
1140
1134
Writes information to an undo log about an insert, update, or a delete marking
1141
1135
of a clustered index record. This information is used in a rollback of the
1142
1136
transaction and in consistent reads that must look to the history of this
1143
 
transaction. */
 
1137
transaction.
 
1138
@return DB_SUCCESS or error code */
1144
1139
UNIV_INTERN
1145
1140
ulint
1146
1141
trx_undo_report_row_operation(
1147
1142
/*==========================*/
1148
 
                                        /* out: DB_SUCCESS or error code */
1149
 
        ulint           flags,          /* in: if BTR_NO_UNDO_LOG_FLAG bit is
 
1143
        ulint           flags,          /*!< in: if BTR_NO_UNDO_LOG_FLAG bit is
1150
1144
                                        set, does nothing */
1151
 
        ulint           op_type,        /* in: TRX_UNDO_INSERT_OP or
 
1145
        ulint           op_type,        /*!< in: TRX_UNDO_INSERT_OP or
1152
1146
                                        TRX_UNDO_MODIFY_OP */
1153
 
        que_thr_t*      thr,            /* in: query thread */
1154
 
        dict_index_t*   index,          /* in: clustered index */
1155
 
        const dtuple_t* clust_entry,    /* in: in the case of an insert,
 
1147
        que_thr_t*      thr,            /*!< in: query thread */
 
1148
        dict_index_t*   index,          /*!< in: clustered index */
 
1149
        const dtuple_t* clust_entry,    /*!< in: in the case of an insert,
1156
1150
                                        index entry to insert into the
1157
1151
                                        clustered index, otherwise NULL */
1158
 
        const upd_t*    update,         /* in: in the case of an update,
 
1152
        const upd_t*    update,         /*!< in: in the case of an update,
1159
1153
                                        the update vector, otherwise NULL */
1160
 
        ulint           cmpl_info,      /* in: compiler info on secondary
 
1154
        ulint           cmpl_info,      /*!< in: compiler info on secondary
1161
1155
                                        index updates */
1162
 
        const rec_t*    rec,            /* in: in case of an update or delete
 
1156
        const rec_t*    rec,            /*!< in: in case of an update or delete
1163
1157
                                        marking, the record in the clustered
1164
1158
                                        index, otherwise NULL */
1165
 
        dulint*         roll_ptr)       /* out: rollback pointer to the
 
1159
        roll_ptr_t*     roll_ptr)       /*!< out: rollback pointer to the
1166
1160
                                        inserted undo log record,
1167
1161
                                        ut_dulint_zero if BTR_NO_UNDO_LOG
1168
1162
                                        flag was specified */
1324
1318
 
1325
1319
/*============== BUILDING PREVIOUS VERSION OF A RECORD ===============*/
1326
1320
 
1327
 
/**********************************************************************
 
1321
/******************************************************************//**
1328
1322
Copies an undo record to heap. This function can be called if we know that
1329
 
the undo log record exists. */
 
1323
the undo log record exists.
 
1324
@return own: copy of the record */
1330
1325
UNIV_INTERN
1331
1326
trx_undo_rec_t*
1332
1327
trx_undo_get_undo_rec_low(
1333
1328
/*======================*/
1334
 
                                        /* out, own: copy of the record */
1335
 
        dulint          roll_ptr,       /* in: roll pointer to record */
1336
 
        mem_heap_t*     heap)           /* in: memory heap where copied */
 
1329
        roll_ptr_t      roll_ptr,       /*!< in: roll pointer to record */
 
1330
        mem_heap_t*     heap)           /*!< in: memory heap where copied */
1337
1331
{
1338
1332
        trx_undo_rec_t* undo_rec;
1339
1333
        ulint           rseg_id;
1360
1354
        return(undo_rec);
1361
1355
}
1362
1356
 
1363
 
/**********************************************************************
1364
 
Copies an undo record to heap. */
 
1357
/******************************************************************//**
 
1358
Copies an undo record to heap.
 
1359
 
 
1360
NOTE: the caller must have latches on the clustered index page and
 
1361
purge_view.
 
1362
 
 
1363
@return DB_SUCCESS, or DB_MISSING_HISTORY if the undo log has been
 
1364
truncated and we cannot fetch the old version */
1365
1365
UNIV_INTERN
1366
1366
ulint
1367
1367
trx_undo_get_undo_rec(
1368
1368
/*==================*/
1369
 
                                        /* out: DB_SUCCESS, or
1370
 
                                        DB_MISSING_HISTORY if the undo log
1371
 
                                        has been truncated and we cannot
1372
 
                                        fetch the old version; NOTE: the
1373
 
                                        caller must have latches on the
1374
 
                                        clustered index page and purge_view */
1375
 
        dulint          roll_ptr,       /* in: roll pointer to record */
1376
 
        dulint          trx_id,         /* in: id of the trx that generated
 
1369
        roll_ptr_t      roll_ptr,       /*!< in: roll pointer to record */
 
1370
        trx_id_t        trx_id,         /*!< in: id of the trx that generated
1377
1371
                                        the roll pointer: it points to an
1378
1372
                                        undo log of this transaction */
1379
 
        trx_undo_rec_t** undo_rec,      /* out, own: copy of the record */
1380
 
        mem_heap_t*     heap)           /* in: memory heap where copied */
 
1373
        trx_undo_rec_t** undo_rec,      /*!< out, own: copy of the record */
 
1374
        mem_heap_t*     heap)           /*!< in: memory heap where copied */
1381
1375
{
1382
1376
#ifdef UNIV_SYNC_DEBUG
1383
1377
        ut_ad(rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED));
1396
1390
        return(DB_SUCCESS);
1397
1391
}
1398
1392
 
1399
 
/***********************************************************************
 
1393
/*******************************************************************//**
1400
1394
Build a previous version of a clustered index record. This function checks
1401
1395
that the caller has a latch on the index page of the clustered index record
1402
1396
and an s-latch on the purge_view. This guarantees that the stack of versions
1403
 
is locked all the way down to the purge_view. */
 
1397
is locked all the way down to the purge_view.
 
1398
@return DB_SUCCESS, or DB_MISSING_HISTORY if the previous version is
 
1399
earlier than purge_view, which means that it may have been removed,
 
1400
DB_ERROR if corrupted record */
1404
1401
UNIV_INTERN
1405
1402
ulint
1406
1403
trx_undo_prev_version_build(
1407
1404
/*========================*/
1408
 
                                /* out: DB_SUCCESS, or DB_MISSING_HISTORY if
1409
 
                                the previous version is not >= purge_view,
1410
 
                                which means that it may have been removed,
1411
 
                                DB_ERROR if corrupted record */
1412
 
        const rec_t*    index_rec,/* in: clustered index record in the
 
1405
        const rec_t*    index_rec,/*!< in: clustered index record in the
1413
1406
                                index tree */
1414
1407
        mtr_t*          index_mtr __attribute__((unused)),
1415
 
                                /* in: mtr which contains the latch to
 
1408
                                /*!< in: mtr which contains the latch to
1416
1409
                                index_rec page and purge_view */
1417
 
        const rec_t*    rec,    /* in: version of a clustered index record */
1418
 
        dict_index_t*   index,  /* in: clustered index */
1419
 
        ulint*          offsets,/* in: rec_get_offsets(rec, index) */
1420
 
        mem_heap_t*     heap,   /* in: memory heap from which the memory
 
1410
        const rec_t*    rec,    /*!< in: version of a clustered index record */
 
1411
        dict_index_t*   index,  /*!< in: clustered index */
 
1412
        ulint*          offsets,/*!< in: rec_get_offsets(rec, index) */
 
1413
        mem_heap_t*     heap,   /*!< in: memory heap from which the memory
1421
1414
                                needed is allocated */
1422
 
        rec_t**         old_vers)/* out, own: previous version, or NULL if
 
1415
        rec_t**         old_vers)/*!< out, own: previous version, or NULL if
1423
1416
                                rec is the first inserted version, or if
1424
1417
                                history data has been deleted (an error),
1425
1418
                                or if the purge COULD have removed the version
1427
1420
{
1428
1421
        trx_undo_rec_t* undo_rec        = NULL;
1429
1422
        dtuple_t*       entry;
1430
 
        dulint          rec_trx_id;
 
1423
        trx_id_t        rec_trx_id;
1431
1424
        ulint           type;
1432
 
        dulint          undo_no;
 
1425
        undo_no_t       undo_no;
1433
1426
        dulint          table_id;
1434
 
        dulint          trx_id;
1435
 
        dulint          roll_ptr;
1436
 
        dulint          old_roll_ptr;
 
1427
        trx_id_t        trx_id;
 
1428
        roll_ptr_t      roll_ptr;
 
1429
        roll_ptr_t      old_roll_ptr;
1437
1430
        upd_t*          update;
1438
1431
        byte*           ptr;
1439
1432
        ulint           info_bits;
1605
1598
 
1606
1599
        return(DB_SUCCESS);
1607
1600
}
 
1601
#endif /* !UNIV_HOTBACKUP */