~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2009-03-12 14:38:12 UTC
  • mfrom: (910.4.20 sparc)
  • Revision ID: brian@tangent.org-20090312143812-g02zsr6krx54nxjp
Merge from Stewart.

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