~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/trx0rec.ic

  • 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 include/trx0rec.ic
20
21
Transaction undo log record
21
22
 
22
23
Created 3/26/1996 Heikki Tuuri
23
24
*******************************************************/
24
25
 
25
 
/**************************************************************************
26
 
Reads from an undo log record the record type. */
 
26
#ifndef UNIV_HOTBACKUP
 
27
/**********************************************************************//**
 
28
Reads from an undo log record the record type.
 
29
@return record type */
27
30
UNIV_INLINE
28
31
ulint
29
32
trx_undo_rec_get_type(
30
33
/*==================*/
31
 
                                        /* out: record type */
32
 
        trx_undo_rec_t* undo_rec)       /* in: undo log record */
 
34
        const trx_undo_rec_t*   undo_rec)       /*!< in: undo log record */
33
35
{
34
36
        return(mach_read_from_1(undo_rec + 2) & (TRX_UNDO_CMPL_INFO_MULT - 1));
35
37
}
36
38
 
37
 
/**************************************************************************
38
 
Reads from an undo log record the record compiler info. */
 
39
/**********************************************************************//**
 
40
Reads from an undo log record the record compiler info.
 
41
@return compiler info */
39
42
UNIV_INLINE
40
43
ulint
41
44
trx_undo_rec_get_cmpl_info(
42
45
/*=======================*/
43
 
                                        /* out: compiler info */
44
 
        trx_undo_rec_t* undo_rec)       /* in: undo log record */
 
46
        const trx_undo_rec_t*   undo_rec)       /*!< in: undo log record */
45
47
{
46
48
        return(mach_read_from_1(undo_rec + 2) / TRX_UNDO_CMPL_INFO_MULT);
47
49
}
48
50
 
49
 
/**************************************************************************
50
 
Returns TRUE if an undo log record contains an extern storage field. */
 
51
/**********************************************************************//**
 
52
Returns TRUE if an undo log record contains an extern storage field.
 
53
@return TRUE if extern */
51
54
UNIV_INLINE
52
55
ibool
53
56
trx_undo_rec_get_extern_storage(
54
57
/*============================*/
55
 
                                        /* out: TRUE if extern */
56
 
        trx_undo_rec_t* undo_rec)       /* in: undo log record */
 
58
        const trx_undo_rec_t*   undo_rec)       /*!< in: undo log record */
57
59
{
58
60
        if (mach_read_from_1(undo_rec + 2) & TRX_UNDO_UPD_EXTERN) {
59
61
 
63
65
        return(FALSE);
64
66
}
65
67
 
66
 
/**************************************************************************
67
 
Reads the undo log record number. */
 
68
/**********************************************************************//**
 
69
Reads the undo log record number.
 
70
@return undo no */
68
71
UNIV_INLINE
69
 
dulint
 
72
undo_no_t
70
73
trx_undo_rec_get_undo_no(
71
74
/*=====================*/
72
 
                                        /* out: undo no */
73
 
        trx_undo_rec_t* undo_rec)       /* in: undo log record */
 
75
        const trx_undo_rec_t*   undo_rec)       /*!< in: undo log record */
74
76
{
75
 
        byte*   ptr;
 
77
        const byte*     ptr;
76
78
 
77
79
        ptr = undo_rec + 3;
78
80
 
79
81
        return(mach_dulint_read_much_compressed(ptr));
80
82
}
81
83
 
82
 
/**************************************************************************
83
 
Returns the start of the undo record data area. */
 
84
/**********************************************************************//**
 
85
Returns the start of the undo record data area.
 
86
@return offset to the data area */
84
87
UNIV_INLINE
85
 
byte*
86
 
trx_undo_rec_get_ptr(
87
 
/*=================*/
88
 
                                        /* out: compiler info */
89
 
        trx_undo_rec_t* undo_rec,       /* in: undo log record */
90
 
        dulint          undo_no)        /* in: undo no read from node */
 
88
ulint
 
89
trx_undo_rec_get_offset(
 
90
/*====================*/
 
91
        undo_no_t       undo_no)        /*!< in: undo no read from node */
91
92
{
92
 
        return (((byte*) undo_rec) + 3
93
 
                + mach_dulint_get_much_compressed_size(undo_no));
 
93
        return (3 + mach_dulint_get_much_compressed_size(undo_no));
94
94
}
95
95
 
96
 
/***************************************************************************
97
 
Copies the undo record to the heap. */
 
96
/***********************************************************************//**
 
97
Copies the undo record to the heap.
 
98
@return own: copy of undo log record */
98
99
UNIV_INLINE
99
100
trx_undo_rec_t*
100
101
trx_undo_rec_copy(
101
102
/*==============*/
102
 
                                        /* out, own: copy of undo log record */
103
 
        trx_undo_rec_t* undo_rec,       /* in: undo log record */
104
 
        mem_heap_t*     heap)           /* in: heap where copied */
 
103
        trx_undo_rec_t* undo_rec,       /*!< in: undo log record */
 
104
        mem_heap_t*     heap)           /*!< in: heap where copied */
105
105
{
106
106
        ulint           len;
107
 
        trx_undo_rec_t* rec_copy;
108
107
 
109
108
        len = mach_read_from_2(undo_rec)
110
109
                - ut_align_offset(undo_rec, UNIV_PAGE_SIZE);
111
 
        rec_copy = mem_heap_alloc(heap, len);
112
 
 
113
 
        ut_memcpy(rec_copy, undo_rec, len);
114
 
 
115
 
        return(rec_copy);
 
110
        return(mem_heap_dup(heap, undo_rec, len));
116
111
}
 
112
#endif /* !UNIV_HOTBACKUP */