~drizzle-trunk/drizzle/development

641.2.2 by Monty Taylor
InnoDB Plugin 1.0.3
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
1802.10.2 by Monty Taylor
Update all of the copyright headers to include the correct address.
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
641.2.2 by Monty Taylor
InnoDB Plugin 1.0.3
16
17
*****************************************************************************/
18
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
19
/**************************************************//**
20
@file include/trx0rec.ic
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
21
Transaction undo log record
22
23
Created 3/26/1996 Heikki Tuuri
24
*******************************************************/
25
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
26
#ifndef UNIV_HOTBACKUP
27
/**********************************************************************//**
28
Reads from an undo log record the record type.
29
@return	record type */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
30
UNIV_INLINE
31
ulint
32
trx_undo_rec_get_type(
33
/*==================*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
34
	const trx_undo_rec_t*	undo_rec)	/*!< in: undo log record */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
35
{
36
	return(mach_read_from_1(undo_rec + 2) & (TRX_UNDO_CMPL_INFO_MULT - 1));
37
}
38
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
39
/**********************************************************************//**
40
Reads from an undo log record the record compiler info.
41
@return	compiler info */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
42
UNIV_INLINE
43
ulint
44
trx_undo_rec_get_cmpl_info(
45
/*=======================*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
46
	const trx_undo_rec_t*	undo_rec)	/*!< in: undo log record */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
47
{
48
	return(mach_read_from_1(undo_rec + 2) / TRX_UNDO_CMPL_INFO_MULT);
49
}
50
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
51
/**********************************************************************//**
52
Returns TRUE if an undo log record contains an extern storage field.
53
@return	TRUE if extern */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
54
UNIV_INLINE
55
ibool
56
trx_undo_rec_get_extern_storage(
57
/*============================*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
58
	const trx_undo_rec_t*	undo_rec)	/*!< in: undo log record */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
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
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
68
/**********************************************************************//**
69
Reads the undo log record number.
70
@return	undo no */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
71
UNIV_INLINE
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
72
undo_no_t
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
73
trx_undo_rec_get_undo_no(
74
/*=====================*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
75
	const trx_undo_rec_t*	undo_rec)	/*!< in: undo log record */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
76
{
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
77
	const byte*	ptr;
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
78
79
	ptr = undo_rec + 3;
80
1819.9.31 by Marko Mäkelä, Stewart Smith
Merge Revision revid:marko.makela@oracle.com-20100623110659-pk5bqnmo0j7hj6md from MySQL InnoDB
81
	return(mach_ull_read_much_compressed(ptr));
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
82
}
83
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
84
/**********************************************************************//**
85
Returns the start of the undo record data area.
86
@return	offset to the data area */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
87
UNIV_INLINE
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
88
ulint
89
trx_undo_rec_get_offset(
90
/*====================*/
91
	undo_no_t	undo_no)	/*!< in: undo no read from node */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
92
{
1819.9.31 by Marko Mäkelä, Stewart Smith
Merge Revision revid:marko.makela@oracle.com-20100623110659-pk5bqnmo0j7hj6md from MySQL InnoDB
93
	return (3 + mach_ull_get_much_compressed_size(undo_no));
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
94
}
95
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
96
/***********************************************************************//**
97
Copies the undo record to the heap.
98
@return	own: copy of undo log record */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
99
UNIV_INLINE
100
trx_undo_rec_t*
101
trx_undo_rec_copy(
102
/*==============*/
1819.5.3 by stewart at flamingspork
[patch 003/129] Merge patch for revision 1788 from InnoDB SVN:
103
	const trx_undo_rec_t*	undo_rec,	/*!< in: undo log record */
104
	mem_heap_t*		heap)		/*!< in: heap where copied */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
105
{
106
	ulint		len;
107
108
	len = mach_read_from_2(undo_rec)
109
		- ut_align_offset(undo_rec, UNIV_PAGE_SIZE);
1992.6.2 by Monty Taylor
Cleaned up for additional gcc 4.5 warnings.
110
	return (trx_undo_rec_t*)mem_heap_dup(heap, undo_rec, len);
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
111
}
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
112
#endif /* !UNIV_HOTBACKUP */