~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2009-03-22 07:55:08 UTC
  • mto: (960.5.2 mordred)
  • mto: This revision was merged to the branch mainline in revision 961.
  • Revision ID: mordred@inaugust.com-20090322075508-1h34cksq2knhaxc3
Removed global.h from a header.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
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
 
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
19
 
/**************************************************//**
20
 
@file include/row0undo.h
 
19
/******************************************************
21
20
Row undo
22
21
 
23
22
Created 1/8/1997 Heikki Tuuri
36
35
#include "que0types.h"
37
36
#include "row0types.h"
38
37
 
39
 
/********************************************************************//**
40
 
Creates a row undo node to a query graph.
41
 
@return own: undo node */
 
38
/************************************************************************
 
39
Creates a row undo node to a query graph. */
42
40
UNIV_INTERN
43
41
undo_node_t*
44
42
row_undo_node_create(
45
43
/*=================*/
46
 
        trx_t*          trx,    /*!< in: transaction */
47
 
        que_thr_t*      parent, /*!< in: parent node, i.e., a thr node */
48
 
        mem_heap_t*     heap);  /*!< in: memory heap where created */
49
 
/***********************************************************//**
 
44
                                /* out, own: undo node */
 
45
        trx_t*          trx,    /* in: transaction */
 
46
        que_thr_t*      parent, /* in: parent node, i.e., a thr node */
 
47
        mem_heap_t*     heap);  /* in: memory heap where created */
 
48
/***************************************************************
50
49
Looks for the clustered index record when node has the row reference.
51
50
The pcur in node is used in the search. If found, stores the row to node,
52
51
and stores the position of pcur, and detaches it. The pcur must be closed
53
 
by the caller in any case.
54
 
@return TRUE if found; NOTE the node->pcur must be closed by the
55
 
caller, regardless of the return value */
 
52
by the caller in any case. */
56
53
UNIV_INTERN
57
54
ibool
58
55
row_undo_search_clust_to_pcur(
59
56
/*==========================*/
60
 
        undo_node_t*    node);  /*!< in: row undo node */
61
 
/***********************************************************//**
 
57
                                /* out: TRUE if found; NOTE the node->pcur
 
58
                                must be closed by the caller, regardless of
 
59
                                the return value */
 
60
        undo_node_t*    node);  /* in: row undo node */
 
61
/***************************************************************
62
62
Undoes a row operation in a table. This is a high-level function used
63
 
in SQL execution graphs.
64
 
@return query thread to run next or NULL */
 
63
in SQL execution graphs. */
65
64
UNIV_INTERN
66
65
que_thr_t*
67
66
row_undo_step(
68
67
/*==========*/
69
 
        que_thr_t*      thr);   /*!< in: query thread */
 
68
                                /* out: query thread to run next or NULL */
 
69
        que_thr_t*      thr);   /* in: query thread */
70
70
 
71
71
/* A single query thread will try to perform the undo for all successive
72
72
versions of a clustered index record, if the transaction has modified it
83
83
and another thread is currently doing the undo for successive versions of
84
84
that index record. */
85
85
 
86
 
/** Execution state of an undo node */
87
 
enum undo_exec {
88
 
        UNDO_NODE_FETCH_NEXT = 1,       /*!< we should fetch the next
89
 
                                        undo log record */
90
 
        UNDO_NODE_PREV_VERS,            /*!< the roll ptr to previous
91
 
                                        version of a row is stored in
92
 
                                        node, and undo should be done
93
 
                                        based on it */
94
 
        UNDO_NODE_INSERT,               /*!< undo a fresh insert of a
95
 
                                        row to a table */
96
 
        UNDO_NODE_MODIFY                /*!< undo a modify operation
97
 
                                        (DELETE or UPDATE) on a row
98
 
                                        of a table */
99
 
};
 
86
/* Undo node structure */
100
87
 
101
 
/** Undo node structure */
102
88
struct undo_node_struct{
103
 
        que_common_t    common; /*!< node type: QUE_NODE_UNDO */
104
 
        enum undo_exec  state;  /*!< node execution state */
105
 
        trx_t*          trx;    /*!< trx for which undo is done */
106
 
        roll_ptr_t      roll_ptr;/*!< roll pointer to undo log record */
107
 
        trx_undo_rec_t* undo_rec;/*!< undo log record */
108
 
        undo_no_t       undo_no;/*!< undo number of the record */
109
 
        ulint           rec_type;/*!< undo log record type: TRX_UNDO_INSERT_REC,
 
89
        que_common_t    common; /* node type: QUE_NODE_UNDO */
 
90
        ulint           state;  /* node execution state */
 
91
        trx_t*          trx;    /* trx for which undo is done */
 
92
        dulint          roll_ptr;/* roll pointer to undo log record */
 
93
        trx_undo_rec_t* undo_rec;/* undo log record */
 
94
        dulint          undo_no;/* undo number of the record */
 
95
        ulint           rec_type;/* undo log record type: TRX_UNDO_INSERT_REC,
110
96
                                ... */
111
 
        roll_ptr_t      new_roll_ptr;
112
 
                                /*!< roll ptr to restore to clustered index
113
 
                                record */
114
 
        trx_id_t        new_trx_id; /*!< trx id to restore to clustered index
115
 
                                record */
116
 
        btr_pcur_t      pcur;   /*!< persistent cursor used in searching the
 
97
        dulint          new_roll_ptr; /* roll ptr to restore to clustered index
 
98
                                record */
 
99
        dulint          new_trx_id; /* trx id to restore to clustered index
 
100
                                record */
 
101
        btr_pcur_t      pcur;   /* persistent cursor used in searching the
117
102
                                clustered index record */
118
 
        dict_table_t*   table;  /*!< table where undo is done */
119
 
        ulint           cmpl_info;/*!< compiler analysis of an update */
120
 
        upd_t*          update; /*!< update vector for a clustered index
 
103
        dict_table_t*   table;  /* table where undo is done */
 
104
        ulint           cmpl_info;/* compiler analysis of an update */
 
105
        upd_t*          update; /* update vector for a clustered index
121
106
                                record */
122
 
        dtuple_t*       ref;    /*!< row reference to the next row to handle */
123
 
        dtuple_t*       row;    /*!< a copy (also fields copied to heap) of the
 
107
        dtuple_t*       ref;    /* row reference to the next row to handle */
 
108
        dtuple_t*       row;    /* a copy (also fields copied to heap) of the
124
109
                                row to handle */
125
 
        row_ext_t*      ext;    /*!< NULL, or prefixes of the externally
 
110
        row_ext_t*      ext;    /* NULL, or prefixes of the externally
126
111
                                stored columns of the row */
127
 
        dtuple_t*       undo_row;/*!< NULL, or the row after undo */
128
 
        row_ext_t*      undo_ext;/*!< NULL, or prefixes of the externally
 
112
        dtuple_t*       undo_row;/* NULL, or the row after undo */
 
113
        row_ext_t*      undo_ext;/* NULL, or prefixes of the externally
129
114
                                stored columns of undo_row */
130
 
        dict_index_t*   index;  /*!< the next index whose record should be
 
115
        dict_index_t*   index;  /* the next index whose record should be
131
116
                                handled */
132
 
        mem_heap_t*     heap;   /*!< memory heap used as auxiliary storage for
 
117
        mem_heap_t*     heap;   /* memory heap used as auxiliary storage for
133
118
                                row; this must be emptied after undo is tried
134
119
                                on a row */
135
120
};
136
121
 
 
122
/* Execution states for an undo node */
 
123
#define UNDO_NODE_FETCH_NEXT    1       /* we should fetch the next undo log
 
124
                                        record */
 
125
#define UNDO_NODE_PREV_VERS     2       /* the roll ptr to previous version of
 
126
                                        a row is stored in node, and undo
 
127
                                        should be done based on it */
 
128
#define UNDO_NODE_INSERT        3
 
129
#define UNDO_NODE_MODIFY        4
 
130
 
137
131
 
138
132
#ifndef UNIV_NONINL
139
133
#include "row0undo.ic"