~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/row/row0undo.c

  • Committer: Brian Aker
  • Date: 2009-01-06 23:40:50 UTC
  • mfrom: (642.1.69 drizzle-clean-code)
  • Revision ID: brian@tangent.org-20090106234050-w01lo5f4r3q62nik
Finished merge for Lee

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 row/row0undo.c
 
1
/******************************************************
21
2
Row undo
22
3
 
 
4
(c) 1997 Innobase Oy
 
5
 
23
6
Created 1/8/1997 Heikki Tuuri
24
7
*******************************************************/
25
8
 
120
103
if the stored roll ptr in the undo log points to a trx already (being) purged,
121
104
or if the roll ptr is NULL, i.e., it was a fresh insert. */
122
105
 
123
 
/********************************************************************//**
124
 
Creates a row undo node to a query graph.
125
 
@return own: undo node */
 
106
/************************************************************************
 
107
Creates a row undo node to a query graph. */
126
108
UNIV_INTERN
127
109
undo_node_t*
128
110
row_undo_node_create(
129
111
/*=================*/
130
 
        trx_t*          trx,    /*!< in: transaction */
131
 
        que_thr_t*      parent, /*!< in: parent node, i.e., a thr node */
132
 
        mem_heap_t*     heap)   /*!< in: memory heap where created */
 
112
                                /* out, own: undo node */
 
113
        trx_t*          trx,    /* in: transaction */
 
114
        que_thr_t*      parent, /* in: parent node, i.e., a thr node */
 
115
        mem_heap_t*     heap)   /* in: memory heap where created */
133
116
{
134
117
        undo_node_t*    undo;
135
118
 
150
133
        return(undo);
151
134
}
152
135
 
153
 
/***********************************************************//**
 
136
/***************************************************************
154
137
Looks for the clustered index record when node has the row reference.
155
138
The pcur in node is used in the search. If found, stores the row to node,
156
139
and stores the position of pcur, and detaches it. The pcur must be closed
157
 
by the caller in any case.
158
 
@return TRUE if found; NOTE the node->pcur must be closed by the
159
 
caller, regardless of the return value */
 
140
by the caller in any case. */
160
141
UNIV_INTERN
161
142
ibool
162
143
row_undo_search_clust_to_pcur(
163
144
/*==========================*/
164
 
        undo_node_t*    node)   /*!< in: row undo node */
 
145
                                /* out: TRUE if found; NOTE the node->pcur
 
146
                                must be closed by the caller, regardless of
 
147
                                the return value */
 
148
        undo_node_t*    node)   /* in: row undo node */
165
149
{
166
150
        dict_index_t*   clust_index;
167
151
        ibool           found;
223
207
        return(ret);
224
208
}
225
209
 
226
 
/***********************************************************//**
 
210
/***************************************************************
227
211
Fetches an undo log record and does the undo for the recorded operation.
228
212
If none left, or a partial rollback completed, returns control to the
229
 
parent node, which is always a query thread node.
230
 
@return DB_SUCCESS if operation successfully completed, else error code */
 
213
parent node, which is always a query thread node. */
231
214
static
232
215
ulint
233
216
row_undo(
234
217
/*=====*/
235
 
        undo_node_t*    node,   /*!< in: row undo node */
236
 
        que_thr_t*      thr)    /*!< in: query thread */
 
218
                                /* out: DB_SUCCESS if operation successfully
 
219
                                completed, else error code */
 
220
        undo_node_t*    node,   /* in: row undo node */
 
221
        que_thr_t*      thr)    /* in: query thread */
237
222
{
238
 
        ulint           err;
239
 
        trx_t*          trx;
240
 
        roll_ptr_t      roll_ptr;
241
 
        ibool           locked_data_dict;
 
223
        ulint   err;
 
224
        trx_t*  trx;
 
225
        dulint  roll_ptr;
 
226
        ibool   locked_data_dict;
242
227
 
243
228
        ut_ad(node && thr);
244
229
 
325
310
        return(err);
326
311
}
327
312
 
328
 
/***********************************************************//**
 
313
/***************************************************************
329
314
Undoes a row operation in a table. This is a high-level function used
330
 
in SQL execution graphs.
331
 
@return query thread to run next or NULL */
 
315
in SQL execution graphs. */
332
316
UNIV_INTERN
333
317
que_thr_t*
334
318
row_undo_step(
335
319
/*==========*/
336
 
        que_thr_t*      thr)    /*!< in: query thread */
 
320
                                /* out: query thread to run next or NULL */
 
321
        que_thr_t*      thr)    /* in: query thread */
337
322
{
338
323
        ulint           err;
339
324
        undo_node_t*    node;