00001 /***************************************************************************** 00002 00003 Copyright (C) 1997, 2009, Innobase Oy. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it under 00006 the terms of the GNU General Public License as published by the Free Software 00007 Foundation; version 2 of the License. 00008 00009 This program is distributed in the hope that it will be useful, but WITHOUT 00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00011 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License along with 00014 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 00015 St, Fifth Floor, Boston, MA 02110-1301 USA 00016 00017 *****************************************************************************/ 00018 00019 /**************************************************/ 00026 #pragma once 00027 #ifndef row0undo_h 00028 #define row0undo_h 00029 00030 #include "univ.i" 00031 #include "mtr0mtr.h" 00032 #include "trx0sys.h" 00033 #include "btr0types.h" 00034 #include "btr0pcur.h" 00035 #include "dict0types.h" 00036 #include "trx0types.h" 00037 #include "que0types.h" 00038 #include "row0types.h" 00039 00040 /********************************************************************/ 00043 UNIV_INTERN 00044 undo_node_t* 00045 row_undo_node_create( 00046 /*=================*/ 00047 trx_t* trx, 00048 que_thr_t* parent, 00049 mem_heap_t* heap); 00050 /***********************************************************/ 00057 UNIV_INTERN 00058 ibool 00059 row_undo_search_clust_to_pcur( 00060 /*==========================*/ 00061 undo_node_t* node); 00062 /***********************************************************/ 00066 UNIV_INTERN 00067 que_thr_t* 00068 row_undo_step( 00069 /*==========*/ 00070 que_thr_t* thr); 00072 /* A single query thread will try to perform the undo for all successive 00073 versions of a clustered index record, if the transaction has modified it 00074 several times during the execution which is rolled back. It may happen 00075 that the task is transferred to another query thread, if the other thread 00076 is assigned to handle an undo log record in the chain of different versions 00077 of the record, and the other thread happens to get the x-latch to the 00078 clustered index record at the right time. 00079 If a query thread notices that the clustered index record it is looking 00080 for is missing, or the roll ptr field in the record doed not point to the 00081 undo log record the thread was assigned to handle, then it gives up the undo 00082 task for that undo log record, and fetches the next. This situation can occur 00083 just in the case where the transaction modified the same record several times 00084 and another thread is currently doing the undo for successive versions of 00085 that index record. */ 00086 00088 enum undo_exec { 00089 UNDO_NODE_FETCH_NEXT = 1, 00091 UNDO_NODE_PREV_VERS, 00095 UNDO_NODE_INSERT, 00097 UNDO_NODE_MODIFY 00100 }; 00101 00103 struct undo_node_struct{ 00104 que_common_t common; 00105 enum undo_exec state; 00106 trx_t* trx; 00107 roll_ptr_t roll_ptr; 00108 trx_undo_rec_t* undo_rec; 00109 undo_no_t undo_no; 00110 ulint rec_type; 00112 roll_ptr_t new_roll_ptr; 00115 trx_id_t new_trx_id; 00117 btr_pcur_t pcur; 00119 dict_table_t* table; 00120 ulint cmpl_info; 00121 upd_t* update; 00123 dtuple_t* ref; 00124 dtuple_t* row; 00126 row_ext_t* ext; 00128 dtuple_t* undo_row; 00129 row_ext_t* undo_ext; 00131 dict_index_t* index; 00133 mem_heap_t* heap; 00136 }; 00137 00138 00139 #ifndef UNIV_NONINL 00140 #include "row0undo.ic" 00141 #endif 00142 00143 #endif