~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to storage/innodb_plugin/include/row0vers.h

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 
 
3
Copyright (c) 1997, 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., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
 
16
 
 
17
*****************************************************************************/
 
18
 
 
19
/**************************************************//**
 
20
@file include/row0vers.h
 
21
Row versions
 
22
 
 
23
Created 2/6/1997 Heikki Tuuri
 
24
*******************************************************/
 
25
 
 
26
#ifndef row0vers_h
 
27
#define row0vers_h
 
28
 
 
29
#include "univ.i"
 
30
#include "data0data.h"
 
31
#include "dict0types.h"
 
32
#include "trx0types.h"
 
33
#include "que0types.h"
 
34
#include "rem0types.h"
 
35
#include "mtr0mtr.h"
 
36
#include "read0types.h"
 
37
 
 
38
/*****************************************************************//**
 
39
Finds out if an active transaction has inserted or modified a secondary
 
40
index record. NOTE: the kernel mutex is temporarily released in this
 
41
function!
 
42
@return NULL if committed, else the active transaction */
 
43
UNIV_INTERN
 
44
trx_t*
 
45
row_vers_impl_x_locked_off_kernel(
 
46
/*==============================*/
 
47
        const rec_t*    rec,    /*!< in: record in a secondary index */
 
48
        dict_index_t*   index,  /*!< in: the secondary index */
 
49
        const ulint*    offsets);/*!< in: rec_get_offsets(rec, index) */
 
50
/*****************************************************************//**
 
51
Finds out if we must preserve a delete marked earlier version of a clustered
 
52
index record, because it is >= the purge view.
 
53
@return TRUE if earlier version should be preserved */
 
54
UNIV_INTERN
 
55
ibool
 
56
row_vers_must_preserve_del_marked(
 
57
/*==============================*/
 
58
        trx_id_t        trx_id, /*!< in: transaction id in the version */
 
59
        mtr_t*          mtr);   /*!< in: mtr holding the latch on the
 
60
                                clustered index record; it will also
 
61
                                hold the latch on purge_view */
 
62
/*****************************************************************//**
 
63
Finds out if a version of the record, where the version >= the current
 
64
purge view, should have ientry as its secondary index entry. We check
 
65
if there is any not delete marked version of the record where the trx
 
66
id >= purge view, and the secondary index entry == ientry; exactly in
 
67
this case we return TRUE.
 
68
@return TRUE if earlier version should have */
 
69
UNIV_INTERN
 
70
ibool
 
71
row_vers_old_has_index_entry(
 
72
/*=========================*/
 
73
        ibool           also_curr,/*!< in: TRUE if also rec is included in the
 
74
                                versions to search; otherwise only versions
 
75
                                prior to it are searched */
 
76
        const rec_t*    rec,    /*!< in: record in the clustered index; the
 
77
                                caller must have a latch on the page */
 
78
        mtr_t*          mtr,    /*!< in: mtr holding the latch on rec; it will
 
79
                                also hold the latch on purge_view */
 
80
        dict_index_t*   index,  /*!< in: the secondary index */
 
81
        const dtuple_t* ientry);/*!< in: the secondary index entry */
 
82
/*****************************************************************//**
 
83
Constructs the version of a clustered index record which a consistent
 
84
read should see. We assume that the trx id stored in rec is such that
 
85
the consistent read should not see rec in its present version.
 
86
@return DB_SUCCESS or DB_MISSING_HISTORY */
 
87
UNIV_INTERN
 
88
ulint
 
89
row_vers_build_for_consistent_read(
 
90
/*===============================*/
 
91
        const rec_t*    rec,    /*!< in: record in a clustered index; the
 
92
                                caller must have a latch on the page; this
 
93
                                latch locks the top of the stack of versions
 
94
                                of this records */
 
95
        mtr_t*          mtr,    /*!< in: mtr holding the latch on rec; it will
 
96
                                also hold the latch on purge_view */
 
97
        dict_index_t*   index,  /*!< in: the clustered index */
 
98
        ulint**         offsets,/*!< in/out: offsets returned by
 
99
                                rec_get_offsets(rec, index) */
 
100
        read_view_t*    view,   /*!< in: the consistent read view */
 
101
        mem_heap_t**    offset_heap,/*!< in/out: memory heap from which
 
102
                                the offsets are allocated */
 
103
        mem_heap_t*     in_heap,/*!< in: memory heap from which the memory for
 
104
                                *old_vers is allocated; memory for possible
 
105
                                intermediate versions is allocated and freed
 
106
                                locally within the function */
 
107
        rec_t**         old_vers);/*!< out, own: old version, or NULL if the
 
108
                                record does not exist in the view, that is,
 
109
                                it was freshly inserted afterwards */
 
110
 
 
111
/*****************************************************************//**
 
112
Constructs the last committed version of a clustered index record,
 
113
which should be seen by a semi-consistent read.
 
114
@return DB_SUCCESS or DB_MISSING_HISTORY */
 
115
UNIV_INTERN
 
116
ulint
 
117
row_vers_build_for_semi_consistent_read(
 
118
/*====================================*/
 
119
        const rec_t*    rec,    /*!< in: record in a clustered index; the
 
120
                                caller must have a latch on the page; this
 
121
                                latch locks the top of the stack of versions
 
122
                                of this records */
 
123
        mtr_t*          mtr,    /*!< in: mtr holding the latch on rec */
 
124
        dict_index_t*   index,  /*!< in: the clustered index */
 
125
        ulint**         offsets,/*!< in/out: offsets returned by
 
126
                                rec_get_offsets(rec, index) */
 
127
        mem_heap_t**    offset_heap,/*!< in/out: memory heap from which
 
128
                                the offsets are allocated */
 
129
        mem_heap_t*     in_heap,/*!< in: memory heap from which the memory for
 
130
                                *old_vers is allocated; memory for possible
 
131
                                intermediate versions is allocated and freed
 
132
                                locally within the function */
 
133
        const rec_t**   old_vers);/*!< out: rec, old version, or NULL if the
 
134
                                record does not exist in the view, that is,
 
135
                                it was freshly inserted afterwards */
 
136
 
 
137
 
 
138
#ifndef UNIV_NONINL
 
139
#include "row0vers.ic"
 
140
#endif
 
141
 
 
142
#endif