#include "univ.i"#include "mtr0mtr.h"#include "trx0sys.h"#include "btr0types.h"#include "btr0pcur.h"#include "dict0types.h"#include "trx0types.h"#include "que0types.h"#include "row0types.h"Include dependency graph for row0undo.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Classes | |
| struct | undo_node_struct |
Defines | |
| #define | UNDO_NODE_FETCH_NEXT 1 |
| #define | UNDO_NODE_PREV_VERS 2 |
| #define | UNDO_NODE_INSERT 3 |
| #define | UNDO_NODE_MODIFY 4 |
Functions | |
| undo_node_t * | row_undo_node_create (trx_t *trx, que_thr_t *parent, mem_heap_t *heap) |
| ibool | row_undo_search_clust_to_pcur (undo_node_t *node) |
| que_thr_t * | row_undo_step (que_thr_t *thr) |
| #define UNDO_NODE_FETCH_NEXT 1 |
Definition at line 101 of file row0undo.h.
Referenced by row_undo(), row_undo_mod(), row_undo_mod_clust(), and row_undo_node_create().
| #define UNDO_NODE_INSERT 3 |
| #define UNDO_NODE_MODIFY 4 |
| #define UNDO_NODE_PREV_VERS 2 |
| undo_node_t* row_undo_node_create | ( | trx_t * | trx, | |
| que_thr_t * | parent, | |||
| mem_heap_t * | heap | |||
| ) |
Definition at line 109 of file row0undo.c.
References btr_pcur_init(), undo_node_struct::common, undo_node_struct::heap, mem_heap_alloc(), mem_heap_create, que_common_struct::parent, undo_node_struct::pcur, QUE_NODE_UNDO, undo_node_struct::state, undo_node_struct::trx, que_common_struct::type, UNDO_NODE_FETCH_NEXT, and ut_ad.
Referenced by trx_roll_graph_build().
00111 : undo node */ 00112 trx_t* trx, /* in: transaction */ 00113 que_thr_t* parent, /* in: parent node, i.e., a thr node */ 00114 mem_heap_t* heap) /* in: memory heap where created */ 00115 { 00116 undo_node_t* undo; 00117 00118 ut_ad(trx && parent && heap); 00119 00120 undo = mem_heap_alloc(heap, sizeof(undo_node_t)); 00121 00122 undo->common.type = QUE_NODE_UNDO; 00123 undo->common.parent = parent; 00124 00125 undo->state = UNDO_NODE_FETCH_NEXT; 00126 undo->trx = trx; 00127 00128 btr_pcur_init(&(undo->pcur)); 00129 00130 undo->heap = mem_heap_create(256); 00131 00132 return(undo); 00133 }
Here is the call graph for this function:

Here is the caller graph for this function:

| ibool row_undo_search_clust_to_pcur | ( | undo_node_t * | node | ) |
Definition at line 142 of file row0undo.c.
References BTR_MODIFY_LEAF, btr_pcur_commit_specify_mtr(), btr_pcur_get_rec(), btr_pcur_store_position(), dict_table_get_first_index(), FALSE, undo_node_struct::heap, mem_heap_free, mtr_start(), NULL, undo_node_struct::pcur, rec_get_offsets, REC_OFFS_NORMAL_SIZE, undo_node_struct::ref, undo_node_struct::roll_ptr, undo_node_struct::row, row_build(), ROW_COPY_DATA, row_get_rec_roll_ptr(), row_search_on_row_ref(), undo_node_struct::table, TRUE, and ut_dulint_cmp().
Referenced by row_undo_ins(), and row_undo_mod().
00144 : TRUE if found; NOTE the node->pcur 00145 must be closed by the caller, regardless of 00146 the return value */ 00147 undo_node_t* node) /* in: row undo node */ 00148 { 00149 dict_index_t* clust_index; 00150 ibool found; 00151 mtr_t mtr; 00152 ibool ret; 00153 rec_t* rec; 00154 mem_heap_t* heap = NULL; 00155 ulint offsets_[REC_OFFS_NORMAL_SIZE]; 00156 ulint* offsets = offsets_; 00157 *offsets_ = (sizeof offsets_) / sizeof *offsets_; 00158 00159 mtr_start(&mtr); 00160 00161 clust_index = dict_table_get_first_index(node->table); 00162 00163 found = row_search_on_row_ref(&(node->pcur), BTR_MODIFY_LEAF, 00164 node->table, node->ref, &mtr); 00165 00166 rec = btr_pcur_get_rec(&(node->pcur)); 00167 00168 offsets = rec_get_offsets(rec, clust_index, offsets, 00169 ULINT_UNDEFINED, &heap); 00170 00171 if (!found || 0 != ut_dulint_cmp(node->roll_ptr, 00172 row_get_rec_roll_ptr(rec, clust_index, offsets))) { 00173 00174 /* We must remove the reservation on the undo log record 00175 BEFORE releasing the latch on the clustered index page: this 00176 is to make sure that some thread will eventually undo the 00177 modification corresponding to node->roll_ptr. */ 00178 00179 /* fputs("--------------------undoing a previous version\n", 00180 stderr); */ 00181 00182 ret = FALSE; 00183 } else { 00184 node->row = row_build(ROW_COPY_DATA, clust_index, rec, 00185 offsets, node->heap); 00186 btr_pcur_store_position(&(node->pcur), &mtr); 00187 00188 ret = TRUE; 00189 } 00190 00191 btr_pcur_commit_specify_mtr(&(node->pcur), &mtr); 00192 00193 if (UNIV_LIKELY_NULL(heap)) { 00194 mem_heap_free(heap); 00195 } 00196 return(ret); 00197 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 307 of file row0undo.c.
References DB_OUT_OF_FILE_SPACE, DB_SUCCESS, err, trx_struct::error_state, exit, NULL, que_node_get_type(), QUE_NODE_UNDO, row_undo(), que_thr_struct::run_node, srv_activity_count, thr_get_trx(), ut_ad, and ut_error.
Referenced by que_thr_step().
00309 : query thread to run next or NULL */ 00310 que_thr_t* thr) /* in: query thread */ 00311 { 00312 ulint err; 00313 undo_node_t* node; 00314 trx_t* trx; 00315 00316 ut_ad(thr); 00317 00318 srv_activity_count++; 00319 00320 trx = thr_get_trx(thr); 00321 00322 node = thr->run_node; 00323 00324 ut_ad(que_node_get_type(node) == QUE_NODE_UNDO); 00325 00326 err = row_undo(node, thr); 00327 00328 trx->error_state = err; 00329 00330 if (err != DB_SUCCESS) { 00331 /* SQL error detected */ 00332 00333 fprintf(stderr, "InnoDB: Fatal error %lu in rollback.\n", 00334 (ulong) err); 00335 00336 if (err == DB_OUT_OF_FILE_SPACE) { 00337 fprintf(stderr, 00338 "InnoDB: Error 13 means out of tablespace.\n" 00339 "InnoDB: Consider increasing your tablespace.\n"); 00340 00341 exit(1); 00342 } 00343 00344 ut_error; 00345 00346 return(NULL); 00347 } 00348 00349 return(thr); 00350 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.4.7

