~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

Reverted 1103

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (C) 1996, 2009, Innobase Oy. All Rights Reserved.
4
 
 
5
 
This program is free software; you can redistribute it and/or modify it under
6
 
the terms of the GNU General Public License as published by the Free Software
7
 
Foundation; version 2 of the License.
8
 
 
9
 
This program is distributed in the hope that it will be useful, but WITHOUT
10
 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
 
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
 
 
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
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/**************************************************//**
20
 
@file include/trx0rec.ic
21
 
Transaction undo log record
22
 
 
23
 
Created 3/26/1996 Heikki Tuuri
24
 
*******************************************************/
25
 
 
26
 
#ifndef UNIV_HOTBACKUP
27
 
/**********************************************************************//**
28
 
Reads from an undo log record the record type.
29
 
@return record type */
30
 
UNIV_INLINE
31
 
ulint
32
 
trx_undo_rec_get_type(
33
 
/*==================*/
34
 
        const trx_undo_rec_t*   undo_rec)       /*!< in: undo log record */
35
 
{
36
 
        return(mach_read_from_1(undo_rec + 2) & (TRX_UNDO_CMPL_INFO_MULT - 1));
37
 
}
38
 
 
39
 
/**********************************************************************//**
40
 
Reads from an undo log record the record compiler info.
41
 
@return compiler info */
42
 
UNIV_INLINE
43
 
ulint
44
 
trx_undo_rec_get_cmpl_info(
45
 
/*=======================*/
46
 
        const trx_undo_rec_t*   undo_rec)       /*!< in: undo log record */
47
 
{
48
 
        return(mach_read_from_1(undo_rec + 2) / TRX_UNDO_CMPL_INFO_MULT);
49
 
}
50
 
 
51
 
/**********************************************************************//**
52
 
Returns TRUE if an undo log record contains an extern storage field.
53
 
@return TRUE if extern */
54
 
UNIV_INLINE
55
 
ibool
56
 
trx_undo_rec_get_extern_storage(
57
 
/*============================*/
58
 
        const trx_undo_rec_t*   undo_rec)       /*!< in: undo log record */
59
 
{
60
 
        if (mach_read_from_1(undo_rec + 2) & TRX_UNDO_UPD_EXTERN) {
61
 
 
62
 
                return(TRUE);
63
 
        }
64
 
 
65
 
        return(FALSE);
66
 
}
67
 
 
68
 
/**********************************************************************//**
69
 
Reads the undo log record number.
70
 
@return undo no */
71
 
UNIV_INLINE
72
 
undo_no_t
73
 
trx_undo_rec_get_undo_no(
74
 
/*=====================*/
75
 
        const trx_undo_rec_t*   undo_rec)       /*!< in: undo log record */
76
 
{
77
 
        const byte*     ptr;
78
 
 
79
 
        ptr = undo_rec + 3;
80
 
 
81
 
        return(mach_ull_read_much_compressed(ptr));
82
 
}
83
 
 
84
 
/**********************************************************************//**
85
 
Returns the start of the undo record data area.
86
 
@return offset to the data area */
87
 
UNIV_INLINE
88
 
ulint
89
 
trx_undo_rec_get_offset(
90
 
/*====================*/
91
 
        undo_no_t       undo_no)        /*!< in: undo no read from node */
92
 
{
93
 
        return (3 + mach_ull_get_much_compressed_size(undo_no));
94
 
}
95
 
 
96
 
/***********************************************************************//**
97
 
Copies the undo record to the heap.
98
 
@return own: copy of undo log record */
99
 
UNIV_INLINE
100
 
trx_undo_rec_t*
101
 
trx_undo_rec_copy(
102
 
/*==============*/
103
 
        const trx_undo_rec_t*   undo_rec,       /*!< in: undo log record */
104
 
        mem_heap_t*             heap)           /*!< in: heap where copied */
105
 
{
106
 
        ulint           len;
107
 
 
108
 
        len = mach_read_from_2(undo_rec)
109
 
                - ut_align_offset(undo_rec, UNIV_PAGE_SIZE);
110
 
        return (trx_undo_rec_t*)mem_heap_dup(heap, undo_rec, len);
111
 
}
112
 
#endif /* !UNIV_HOTBACKUP */