#include "univ.i"#include "trx0types.h"#include "row0types.h"#include "mtr0mtr.h"#include "trx0sys.h"#include "dict0types.h"#include "que0types.h"#include "data0data.h"#include "rem0types.h"Include dependency graph for trx0rec.h:

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

Go to the source code of this file.
| #define TRX_UNDO_CMPL_INFO_MULT 16 |
Definition at line 288 of file trx0rec.h.
Referenced by trx_undo_page_report_modify(), and trx_undo_rec_get_pars().
| #define TRX_UNDO_DEL_MARK_REC 14 |
Definition at line 286 of file trx0rec.h.
Referenced by row_purge(), row_undo_mod(), trx_purge_get_next_rec(), trx_undo_page_report_modify(), and trx_undo_update_rec_get_update().
| #define TRX_UNDO_INSERT_OP 1 |
Definition at line 296 of file trx0rec.h.
Referenced by btr_cur_ins_lock_and_undo(), and trx_undo_report_row_operation().
| #define TRX_UNDO_INSERT_REC 11 |
Definition at line 280 of file trx0rec.h.
Referenced by row_undo_ins_parse_undo_rec(), and trx_undo_page_report_insert().
| #define TRX_UNDO_MODIFY_OP 2 |
Definition at line 297 of file trx0rec.h.
Referenced by btr_cur_del_mark_set_clust_rec(), btr_cur_upd_lock_and_undo(), and trx_undo_report_row_operation().
| #define TRX_UNDO_UPD_DEL_REC 13 |
Definition at line 283 of file trx0rec.h.
Referenced by row_purge_parse_undo_rec(), row_purge_upd_exist_or_extern(), row_undo_mod(), row_undo_mod_clust(), row_undo_mod_remove_clust_low(), and trx_undo_page_report_modify().
| #define TRX_UNDO_UPD_EXIST_REC 12 |
Definition at line 281 of file trx0rec.h.
Referenced by row_purge(), row_purge_parse_undo_rec(), row_undo_mod(), trx_purge_get_next_rec(), and trx_undo_page_report_modify().
| #define TRX_UNDO_UPD_EXTERN 128 |
Definition at line 290 of file trx0rec.h.
Referenced by trx_undo_page_report_modify(), and trx_undo_rec_get_pars().
| ulint trx_undo_get_undo_rec | ( | dulint | roll_ptr, | |
| dulint | trx_id, | |||
| trx_undo_rec_t ** | undo_rec, | |||
| mem_heap_t * | heap | |||
| ) |
Definition at line 1206 of file trx0rec.c.
References DB_MISSING_HISTORY, DB_SUCCESS, trx_purge_struct::latch, purge_sys, RW_LOCK_SHARED, trx_purge_update_undo_must_exist(), trx_undo_get_undo_rec_low(), and ut_ad.
Referenced by trx_undo_prev_version_build().
01208 : DB_SUCCESS, or 01209 DB_MISSING_HISTORY if the undo log 01210 has been truncated and we cannot 01211 fetch the old version; NOTE: the 01212 caller must have latches on the 01213 clustered index page and purge_view */ 01214 dulint roll_ptr, /* in: roll pointer to record */ 01215 dulint trx_id, /* in: id of the trx that generated 01216 the roll pointer: it points to an 01217 undo log of this transaction */ 01218 trx_undo_rec_t** undo_rec, /* out, own: copy of the record */ 01219 mem_heap_t* heap) /* in: memory heap where copied */ 01220 { 01221 #ifdef UNIV_SYNC_DEBUG 01222 ut_ad(rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED)); 01223 #endif /* UNIV_SYNC_DEBUG */ 01224 01225 if (!trx_purge_update_undo_must_exist(trx_id)) { 01226 01227 /* It may be that the necessary undo log has already been 01228 deleted */ 01229 01230 return(DB_MISSING_HISTORY); 01231 } 01232 01233 *undo_rec = trx_undo_get_undo_rec_low(roll_ptr, heap); 01234 01235 return(DB_SUCCESS); 01236 }
Here is the call graph for this function:

Here is the caller graph for this function:

| trx_undo_rec_t* trx_undo_get_undo_rec_low | ( | dulint | roll_ptr, | |
| mem_heap_t * | heap | |||
| ) |
Definition at line 1172 of file trx0rec.c.
References mtr_commit(), mtr_start(), offset, page_t, trx_rseg_struct::space, trx_rseg_get_on_id(), trx_undo_decode_roll_ptr(), trx_undo_page_get_s_latched(), and trx_undo_rec_copy().
Referenced by row_undo(), row_undo_mod_undo_also_prev_vers(), row_vers_build_for_consistent_read(), and trx_undo_get_undo_rec().
01174 : copy of the record */ 01175 dulint roll_ptr, /* in: roll pointer to record */ 01176 mem_heap_t* heap) /* in: memory heap where copied */ 01177 { 01178 trx_undo_rec_t* undo_rec; 01179 ulint rseg_id; 01180 ulint page_no; 01181 ulint offset; 01182 page_t* undo_page; 01183 trx_rseg_t* rseg; 01184 ibool is_insert; 01185 mtr_t mtr; 01186 01187 trx_undo_decode_roll_ptr(roll_ptr, &is_insert, &rseg_id, &page_no, 01188 &offset); 01189 rseg = trx_rseg_get_on_id(rseg_id); 01190 01191 mtr_start(&mtr); 01192 01193 undo_page = trx_undo_page_get_s_latched(rseg->space, page_no, &mtr); 01194 01195 undo_rec = trx_undo_rec_copy(undo_page + offset, heap); 01196 01197 mtr_commit(&mtr); 01198 01199 return(undo_rec); 01200 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 73 of file trx0rec.c.
References mach_read_from_2(), mach_write_to_2(), NULL, TRX_UNDO_PAGE_FREE, TRX_UNDO_PAGE_HDR, and ut_memcpy().
Referenced by recv_parse_or_apply_log_rec_body().
00075 : end of log record or NULL */ 00076 byte* ptr, /* in: buffer */ 00077 byte* end_ptr,/* in: buffer end */ 00078 page_t* page) /* in: page or NULL */ 00079 { 00080 ulint len; 00081 byte* rec; 00082 ulint first_free; 00083 00084 if (end_ptr < ptr + 2) { 00085 00086 return(NULL); 00087 } 00088 00089 len = mach_read_from_2(ptr); 00090 ptr += 2; 00091 00092 if (end_ptr < ptr + len) { 00093 00094 return(NULL); 00095 } 00096 00097 if (page == NULL) { 00098 00099 return(ptr + len); 00100 } 00101 00102 first_free = mach_read_from_2(page + TRX_UNDO_PAGE_HDR 00103 + TRX_UNDO_PAGE_FREE); 00104 rec = page + first_free; 00105 00106 mach_write_to_2(rec, first_free + 4 + len); 00107 mach_write_to_2(rec + 2 + len, first_free); 00108 00109 mach_write_to_2(page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_FREE, 00110 first_free + 4 + len); 00111 ut_memcpy(rec + 2, ptr, len); 00112 00113 return(ptr + len); 00114 }
Here is the call graph for this function:

Here is the caller graph for this function:

| ulint trx_undo_prev_version_build | ( | rec_t * | index_rec, | |
| mtr_t * | index_mtr, | |||
| rec_t * | rec, | |||
| dict_index_t * | index, | |||
| ulint * | offsets, | |||
| mem_heap_t * | heap, | |||
| rec_t ** | old_vers | |||
| ) |
Referenced by row_vers_build_for_consistent_read(), row_vers_build_for_semi_consistent_read(), row_vers_impl_x_locked_off_kernel(), and row_vers_old_has_index_entry().
Here is the caller graph for this function:

| UNIV_INLINE trx_undo_rec_t* trx_undo_rec_copy | ( | trx_undo_rec_t * | undo_rec, | |
| mem_heap_t * | heap | |||
| ) |
Referenced by trx_purge_get_next_rec(), trx_roll_pop_top_rec_of_trx(), and trx_undo_get_undo_rec_low().
Here is the caller graph for this function:

| UNIV_INLINE ulint trx_undo_rec_get_cmpl_info | ( | trx_undo_rec_t * | undo_rec | ) |
| UNIV_INLINE ibool trx_undo_rec_get_extern_storage | ( | trx_undo_rec_t * | undo_rec | ) |
| byte* trx_undo_rec_get_pars | ( | trx_undo_rec_t * | undo_rec, | |
| ulint * | type, | |||
| ulint * | cmpl_info, | |||
| ibool * | updated_extern, | |||
| dulint * | undo_no, | |||
| dulint * | table_id | |||
| ) |
Definition at line 244 of file trx0rec.c.
References FALSE, mach_dulint_get_much_compressed_size(), mach_dulint_read_much_compressed(), mach_read_from_1(), TRUE, TRX_UNDO_CMPL_INFO_MULT, and TRX_UNDO_UPD_EXTERN.
Referenced by row_purge_parse_undo_rec(), row_undo_ins_parse_undo_rec(), row_undo_mod_parse_undo_rec(), and trx_undo_prev_version_build().
00246 : remaining part of undo log 00247 record after reading these values */ 00248 trx_undo_rec_t* undo_rec, /* in: undo log record */ 00249 ulint* type, /* out: undo record type: 00250 TRX_UNDO_INSERT_REC, ... */ 00251 ulint* cmpl_info, /* out: compiler info, relevant only 00252 for update type records */ 00253 ibool* updated_extern, /* out: TRUE if we updated an 00254 externally stored fild */ 00255 dulint* undo_no, /* out: undo log record number */ 00256 dulint* table_id) /* out: table id */ 00257 { 00258 byte* ptr; 00259 ulint len; 00260 ulint type_cmpl; 00261 00262 ptr = undo_rec + 2; 00263 00264 type_cmpl = mach_read_from_1(ptr); 00265 ptr++; 00266 00267 if (type_cmpl & TRX_UNDO_UPD_EXTERN) { 00268 *updated_extern = TRUE; 00269 type_cmpl -= TRX_UNDO_UPD_EXTERN; 00270 } else { 00271 *updated_extern = FALSE; 00272 } 00273 00274 *type = type_cmpl & (TRX_UNDO_CMPL_INFO_MULT - 1); 00275 *cmpl_info = type_cmpl / TRX_UNDO_CMPL_INFO_MULT; 00276 00277 *undo_no = mach_dulint_read_much_compressed(ptr); 00278 len = mach_dulint_get_much_compressed_size(*undo_no); 00279 ptr += len; 00280 00281 *table_id = mach_dulint_read_much_compressed(ptr); 00282 len = mach_dulint_get_much_compressed_size(*table_id); 00283 ptr += len; 00284 00285 return(ptr); 00286 }
Here is the call graph for this function:

Here is the caller graph for this function:

| byte* trx_undo_rec_get_partial_row | ( | byte * | ptr, | |
| dict_index_t * | index, | |||
| dtuple_t ** | row, | |||
| mem_heap_t * | heap | |||
| ) |
Definition at line 879 of file trx0rec.c.
References dfield_set_data(), dict_index_get_nth_col_no(), dict_table_copy_types(), dict_table_get_n_cols(), dtuple_create(), dtuple_get_nth_field(), index(), mach_read_from_2(), trx_undo_rec_get_col_val(), trx_undo_update_rec_get_field_no(), and ut_ad.
Referenced by row_purge_parse_undo_rec().
00881 : pointer to remaining part of undo 00882 record */ 00883 byte* ptr, /* in: remaining part in update undo log 00884 record of a suitable type, at the start of 00885 the stored index columns; 00886 NOTE that this copy of the undo log record must 00887 be preserved as long as the partial row is 00888 used, as we do NOT copy the data in the 00889 record! */ 00890 dict_index_t* index, /* in: clustered index */ 00891 dtuple_t** row, /* out, own: partial row */ 00892 mem_heap_t* heap) /* in: memory heap from which the memory 00893 needed is allocated */ 00894 { 00895 dfield_t* dfield; 00896 byte* field; 00897 ulint len; 00898 ulint field_no; 00899 ulint col_no; 00900 ulint row_len; 00901 ulint total_len; 00902 byte* start_ptr; 00903 ulint i; 00904 00905 ut_ad(index && ptr && row && heap); 00906 00907 row_len = dict_table_get_n_cols(index->table); 00908 00909 *row = dtuple_create(heap, row_len); 00910 00911 dict_table_copy_types(*row, index->table); 00912 00913 start_ptr = ptr; 00914 00915 total_len = mach_read_from_2(ptr); 00916 ptr += 2; 00917 00918 for (i = 0;; i++) { 00919 00920 if (ptr == start_ptr + total_len) { 00921 00922 break; 00923 } 00924 00925 ptr = trx_undo_update_rec_get_field_no(ptr, &field_no); 00926 00927 col_no = dict_index_get_nth_col_no(index, field_no); 00928 00929 ptr = trx_undo_rec_get_col_val(ptr, &field, &len); 00930 00931 dfield = dtuple_get_nth_field(*row, col_no); 00932 00933 dfield_set_data(dfield, field, len); 00934 } 00935 00936 return(ptr); 00937 }
Here is the call graph for this function:

Here is the caller graph for this function:

| byte* trx_undo_rec_get_row_ref | ( | byte * | ptr, | |
| dict_index_t * | index, | |||
| dtuple_t ** | ref, | |||
| mem_heap_t * | heap | |||
| ) |
Definition at line 320 of file trx0rec.c.
References dfield_set_data(), DICT_CLUSTERED, dict_index_copy_types(), dict_index_get_n_unique(), dtuple_create(), dtuple_get_nth_field(), index(), trx_undo_rec_get_col_val(), ut_a, and ut_ad.
Referenced by row_purge_parse_undo_rec(), row_undo_ins_parse_undo_rec(), and row_undo_mod_parse_undo_rec().
00322 : pointer to remaining part of undo 00323 record */ 00324 byte* ptr, /* in: remaining part of a copy of an undo log 00325 record, at the start of the row reference; 00326 NOTE that this copy of the undo log record must 00327 be preserved as long as the row reference is 00328 used, as we do NOT copy the data in the 00329 record! */ 00330 dict_index_t* index, /* in: clustered index */ 00331 dtuple_t** ref, /* out, own: row reference */ 00332 mem_heap_t* heap) /* in: memory heap from which the memory 00333 needed is allocated */ 00334 { 00335 dfield_t* dfield; 00336 byte* field; 00337 ulint len; 00338 ulint ref_len; 00339 ulint i; 00340 00341 ut_ad(index && ptr && ref && heap); 00342 ut_a(index->type & DICT_CLUSTERED); 00343 00344 ref_len = dict_index_get_n_unique(index); 00345 00346 *ref = dtuple_create(heap, ref_len); 00347 00348 dict_index_copy_types(*ref, index, ref_len); 00349 00350 for (i = 0; i < ref_len; i++) { 00351 dfield = dtuple_get_nth_field(*ref, i); 00352 00353 ptr = trx_undo_rec_get_col_val(ptr, &field, &len); 00354 00355 dfield_set_data(dfield, field, len); 00356 } 00357 00358 return(ptr); 00359 }
Here is the call graph for this function:

Here is the caller graph for this function:

| UNIV_INLINE ulint trx_undo_rec_get_type | ( | trx_undo_rec_t * | undo_rec | ) |
| UNIV_INLINE dulint trx_undo_rec_get_undo_no | ( | trx_undo_rec_t * | undo_rec | ) |
Referenced by row_undo(), row_undo_mod_undo_also_prev_vers(), row_vers_build_for_consistent_read(), trx_purge_choose_next_log(), trx_purge_get_next_rec(), trx_roll_pop_top_rec(), trx_roll_pop_top_rec_of_trx(), trx_undo_mem_create_at_db_start(), trx_undo_truncate_end(), and trx_undo_truncate_start().
Here is the caller graph for this function:

| byte* trx_undo_rec_skip_row_ref | ( | byte * | ptr, | |
| dict_index_t * | index | |||
| ) |
Definition at line 365 of file trx0rec.c.
References DICT_CLUSTERED, dict_index_get_n_unique(), index(), trx_undo_rec_get_col_val(), ut_a, and ut_ad.
Referenced by trx_undo_prev_version_build().
00367 : pointer to remaining part of undo 00368 record */ 00369 byte* ptr, /* in: remaining part in update undo log 00370 record, at the start of the row reference */ 00371 dict_index_t* index) /* in: clustered index */ 00372 { 00373 byte* field; 00374 ulint len; 00375 ulint ref_len; 00376 ulint i; 00377 00378 ut_ad(index && ptr); 00379 ut_a(index->type & DICT_CLUSTERED); 00380 00381 ref_len = dict_index_get_n_unique(index); 00382 00383 for (i = 0; i < ref_len; i++) { 00384 ptr = trx_undo_rec_get_col_val(ptr, &field, &len); 00385 } 00386 00387 return(ptr); 00388 }
Here is the call graph for this function:

Here is the caller graph for this function:

| ulint trx_undo_report_row_operation | ( | ulint | flags, | |
| ulint | op_type, | |||
| que_thr_t * | thr, | |||
| dict_index_t * | index, | |||
| dtuple_t * | clust_entry, | |||
| upd_t * | update, | |||
| ulint | cmpl_info, | |||
| rec_t * | rec, | |||
| dulint * | roll_ptr | |||
| ) |
Definition at line 989 of file trx0rec.c.
References BTR_NO_UNDO_LOG_FLAG, BUF_GET, buf_page_get_gen(), DB_OUT_OF_FILE_SPACE, DB_SUCCESS, DICT_CLUSTERED, trx_undo_struct::empty, FALSE, FIL_NULL, trx_undo_struct::guess_page, trx_rseg_struct::id, index(), trx_struct::insert_undo, trx_undo_struct::last_page_no, mem_heap_free, mtr_commit(), mtr_start(), trx_rseg_struct::mutex, mutex_enter, mutex_exit(), NULL, offset, page_t, rec_get_offsets, REC_OFFS_NORMAL_SIZE, trx_struct::rseg, RW_X_LATCH, trx_undo_struct::space, SYNC_TRX_UNDO_PAGE, thr_get_trx(), trx_undo_struct::top_offset, trx_undo_struct::top_page_no, trx_undo_struct::top_undo_no, TRUE, trx_undo_add_page(), trx_undo_assign_undo(), trx_undo_build_roll_ptr(), trx_undo_erase_page_end(), TRX_UNDO_INSERT, TRX_UNDO_INSERT_OP, TRX_UNDO_MODIFY_OP, trx_undo_page_report_insert(), trx_undo_page_report_modify(), TRX_UNDO_UPDATE, trx_struct::undo_mutex, trx_struct::undo_no, update, trx_struct::update_undo, ut_a, ut_ad, UT_DULINT_INC, and ut_dulint_zero.
Referenced by btr_cur_del_mark_set_clust_rec(), btr_cur_ins_lock_and_undo(), and btr_cur_upd_lock_and_undo().
00991 : DB_SUCCESS or error code */ 00992 ulint flags, /* in: if BTR_NO_UNDO_LOG_FLAG bit is 00993 set, does nothing */ 00994 ulint op_type, /* in: TRX_UNDO_INSERT_OP or 00995 TRX_UNDO_MODIFY_OP */ 00996 que_thr_t* thr, /* in: query thread */ 00997 dict_index_t* index, /* in: clustered index */ 00998 dtuple_t* clust_entry, /* in: in the case of an insert, 00999 index entry to insert into the 01000 clustered index, otherwise NULL */ 01001 upd_t* update, /* in: in the case of an update, 01002 the update vector, otherwise NULL */ 01003 ulint cmpl_info, /* in: compiler info on secondary 01004 index updates */ 01005 rec_t* rec, /* in: in case of an update or delete 01006 marking, the record in the clustered 01007 index, otherwise NULL */ 01008 dulint* roll_ptr) /* out: rollback pointer to the 01009 inserted undo log record, 01010 ut_dulint_zero if BTR_NO_UNDO_LOG 01011 flag was specified */ 01012 { 01013 trx_t* trx; 01014 trx_undo_t* undo; 01015 page_t* undo_page; 01016 ulint offset; 01017 ulint page_no; 01018 ibool is_insert; 01019 trx_rseg_t* rseg; 01020 mtr_t mtr; 01021 mem_heap_t* heap = NULL; 01022 ulint offsets_[REC_OFFS_NORMAL_SIZE]; 01023 ulint* offsets = offsets_; 01024 *offsets_ = (sizeof offsets_) / sizeof *offsets_; 01025 01026 ut_a(index->type & DICT_CLUSTERED); 01027 01028 if (flags & BTR_NO_UNDO_LOG_FLAG) { 01029 01030 *roll_ptr = ut_dulint_zero; 01031 01032 return(DB_SUCCESS); 01033 } 01034 01035 ut_ad(thr); 01036 ut_ad((op_type != TRX_UNDO_INSERT_OP) 01037 || (clust_entry && !update && !rec)); 01038 01039 trx = thr_get_trx(thr); 01040 rseg = trx->rseg; 01041 01042 mutex_enter(&(trx->undo_mutex)); 01043 01044 /* If the undo log is not assigned yet, assign one */ 01045 01046 if (op_type == TRX_UNDO_INSERT_OP) { 01047 01048 if (trx->insert_undo == NULL) { 01049 01050 trx_undo_assign_undo(trx, TRX_UNDO_INSERT); 01051 } 01052 01053 undo = trx->insert_undo; 01054 is_insert = TRUE; 01055 } else { 01056 ut_ad(op_type == TRX_UNDO_MODIFY_OP); 01057 01058 if (trx->update_undo == NULL) { 01059 01060 trx_undo_assign_undo(trx, TRX_UNDO_UPDATE); 01061 01062 } 01063 01064 undo = trx->update_undo; 01065 is_insert = FALSE; 01066 } 01067 01068 if (undo == NULL) { 01069 /* Did not succeed: out of space */ 01070 mutex_exit(&(trx->undo_mutex)); 01071 01072 return(DB_OUT_OF_FILE_SPACE); 01073 } 01074 01075 page_no = undo->last_page_no; 01076 01077 mtr_start(&mtr); 01078 01079 for (;;) { 01080 undo_page = buf_page_get_gen(undo->space, page_no, 01081 RW_X_LATCH, undo->guess_page, 01082 BUF_GET, 01083 __FILE__, __LINE__, 01084 &mtr); 01085 01086 #ifdef UNIV_SYNC_DEBUG 01087 buf_page_dbg_add_level(undo_page, SYNC_TRX_UNDO_PAGE); 01088 #endif /* UNIV_SYNC_DEBUG */ 01089 01090 if (op_type == TRX_UNDO_INSERT_OP) { 01091 offset = trx_undo_page_report_insert(undo_page, trx, 01092 index, clust_entry, 01093 &mtr); 01094 } else { 01095 offsets = rec_get_offsets(rec, index, offsets, 01096 ULINT_UNDEFINED, &heap); 01097 offset = trx_undo_page_report_modify(undo_page, trx, 01098 index, rec, offsets, update, cmpl_info, &mtr); 01099 } 01100 01101 if (offset == 0) { 01102 /* The record did not fit on the page. We erase the 01103 end segment of the undo log page and write a log 01104 record of it: this is to ensure that in the debug 01105 version the replicate page constructed using the log 01106 records stays identical to the original page */ 01107 01108 trx_undo_erase_page_end(undo_page, &mtr); 01109 } 01110 01111 mtr_commit(&mtr); 01112 01113 if (offset != 0) { 01114 /* Success */ 01115 01116 break; 01117 } 01118 01119 ut_ad(page_no == undo->last_page_no); 01120 01121 /* We have to extend the undo log by one page */ 01122 01123 mtr_start(&mtr); 01124 01125 /* When we add a page to an undo log, this is analogous to 01126 a pessimistic insert in a B-tree, and we must reserve the 01127 counterpart of the tree latch, which is the rseg mutex. */ 01128 01129 mutex_enter(&(rseg->mutex)); 01130 01131 page_no = trx_undo_add_page(trx, undo, &mtr); 01132 01133 mutex_exit(&(rseg->mutex)); 01134 01135 if (page_no == FIL_NULL) { 01136 /* Did not succeed: out of space */ 01137 01138 mutex_exit(&(trx->undo_mutex)); 01139 mtr_commit(&mtr); 01140 if (UNIV_LIKELY_NULL(heap)) { 01141 mem_heap_free(heap); 01142 } 01143 return(DB_OUT_OF_FILE_SPACE); 01144 } 01145 } 01146 01147 undo->empty = FALSE; 01148 undo->top_page_no = page_no; 01149 undo->top_offset = offset; 01150 undo->top_undo_no = trx->undo_no; 01151 undo->guess_page = undo_page; 01152 01153 UT_DULINT_INC(trx->undo_no); 01154 01155 mutex_exit(&(trx->undo_mutex)); 01156 01157 *roll_ptr = trx_undo_build_roll_ptr(is_insert, rseg->id, page_no, 01158 offset); 01159 if (UNIV_LIKELY_NULL(heap)) { 01160 mem_heap_free(heap); 01161 } 01162 return(DB_SUCCESS); 01163 }
Here is the call graph for this function:

Here is the caller graph for this function:

| byte* trx_undo_update_rec_get_sys_cols | ( | byte * | ptr, | |
| dulint * | trx_id, | |||
| dulint * | roll_ptr, | |||
| ulint * | info_bits | |||
| ) |
Definition at line 697 of file trx0rec.c.
References mach_dulint_get_compressed_size(), mach_dulint_read_compressed(), and mach_read_from_1().
Referenced by row_purge_parse_undo_rec(), row_undo_mod_parse_undo_rec(), and trx_undo_prev_version_build().
00699 : remaining part of undo log 00700 record after reading these values */ 00701 byte* ptr, /* in: remaining part of undo log 00702 record after reading general 00703 parameters */ 00704 dulint* trx_id, /* out: trx id */ 00705 dulint* roll_ptr, /* out: roll ptr */ 00706 ulint* info_bits) /* out: info bits state */ 00707 { 00708 ulint len; 00709 00710 /* Read the state of the info bits */ 00711 *info_bits = mach_read_from_1(ptr); 00712 ptr += 1; 00713 00714 /* Read the values of the system columns */ 00715 00716 *trx_id = mach_dulint_read_compressed(ptr); 00717 len = mach_dulint_get_compressed_size(*trx_id); 00718 ptr += len; 00719 00720 *roll_ptr = mach_dulint_read_compressed(ptr); 00721 len = mach_dulint_get_compressed_size(*roll_ptr); 00722 ptr += len; 00723 00724 return(ptr); 00725 }
Here is the call graph for this function:

Here is the caller graph for this function:

| byte* trx_undo_update_rec_get_update | ( | byte * | ptr, | |
| dict_index_t * | index, | |||
| ulint | type, | |||
| dulint | trx_id, | |||
| dulint | roll_ptr, | |||
| ulint | info_bits, | |||
| trx_t * | trx, | |||
| mem_heap_t * | heap, | |||
| upd_t ** | upd | |||
| ) |
Definition at line 765 of file trx0rec.c.
References buf, DATA_ROLL_PTR, DATA_ROLL_PTR_LEN, DATA_TRX_ID, DATA_TRX_ID_LEN, dfield_set_data(), DICT_CLUSTERED, dict_index_get_n_fields(), dict_index_get_sys_col_pos(), dict_index_name_print(), upd_field_struct::extern_storage, index(), mem_heap_alloc(), upd_field_struct::new_val, NULL, TRUE, TRX_UNDO_DEL_MARK_REC, trx_undo_rec_get_col_val(), trx_undo_update_rec_get_field_no(), trx_undo_update_rec_get_n_upd_fields(), trx_write_roll_ptr(), trx_write_trx_id(), upd_create(), upd_field_set_field_no(), upd_get_nth_field(), update, ut_a, and ut_print_name().
Referenced by row_purge_parse_undo_rec(), row_undo_mod_parse_undo_rec(), and trx_undo_prev_version_build().
00767 : remaining part of the record, 00768 NULL if an error detected, which means that 00769 the record is corrupted */ 00770 byte* ptr, /* in: remaining part in update undo log 00771 record, after reading the row reference 00772 NOTE that this copy of the undo log record must 00773 be preserved as long as the update vector is 00774 used, as we do NOT copy the data in the 00775 record! */ 00776 dict_index_t* index, /* in: clustered index */ 00777 ulint type, /* in: TRX_UNDO_UPD_EXIST_REC, 00778 TRX_UNDO_UPD_DEL_REC, or 00779 TRX_UNDO_DEL_MARK_REC; in the last case, 00780 only trx id and roll ptr fields are added to 00781 the update vector */ 00782 dulint trx_id, /* in: transaction id from this undo record */ 00783 dulint roll_ptr,/* in: roll pointer from this undo record */ 00784 ulint info_bits,/* in: info bits from this undo record */ 00785 trx_t* trx, /* in: transaction */ 00786 mem_heap_t* heap, /* in: memory heap from which the memory 00787 needed is allocated */ 00788 upd_t** upd) /* out, own: update vector */ 00789 { 00790 upd_field_t* upd_field; 00791 upd_t* update; 00792 ulint n_fields; 00793 byte* buf; 00794 byte* field; 00795 ulint len; 00796 ulint field_no; 00797 ulint i; 00798 00799 ut_a(index->type & DICT_CLUSTERED); 00800 00801 if (type != TRX_UNDO_DEL_MARK_REC) { 00802 ptr = trx_undo_update_rec_get_n_upd_fields(ptr, &n_fields); 00803 } else { 00804 n_fields = 0; 00805 } 00806 00807 update = upd_create(n_fields + 2, heap); 00808 00809 update->info_bits = info_bits; 00810 00811 /* Store first trx id and roll ptr to update vector */ 00812 00813 upd_field = upd_get_nth_field(update, n_fields); 00814 buf = mem_heap_alloc(heap, DATA_TRX_ID_LEN); 00815 trx_write_trx_id(buf, trx_id); 00816 00817 upd_field_set_field_no(upd_field, 00818 dict_index_get_sys_col_pos(index, DATA_TRX_ID), 00819 index, trx); 00820 dfield_set_data(&(upd_field->new_val), buf, DATA_TRX_ID_LEN); 00821 00822 upd_field = upd_get_nth_field(update, n_fields + 1); 00823 buf = mem_heap_alloc(heap, DATA_ROLL_PTR_LEN); 00824 trx_write_roll_ptr(buf, roll_ptr); 00825 00826 upd_field_set_field_no(upd_field, 00827 dict_index_get_sys_col_pos(index, DATA_ROLL_PTR), 00828 index, trx); 00829 dfield_set_data(&(upd_field->new_val), buf, DATA_ROLL_PTR_LEN); 00830 00831 /* Store then the updated ordinary columns to the update vector */ 00832 00833 for (i = 0; i < n_fields; i++) { 00834 00835 ptr = trx_undo_update_rec_get_field_no(ptr, &field_no); 00836 00837 if (field_no >= dict_index_get_n_fields(index)) { 00838 fprintf(stderr, 00839 "InnoDB: Error: trying to access update undo rec field %lu in ", (ulong) field_no); 00840 dict_index_name_print(stderr, trx, index); 00841 fprintf(stderr, "\n" 00842 "InnoDB: but index has only %lu fields\n" 00843 "InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n" 00844 "InnoDB: Run also CHECK TABLE ", 00845 (ulong) dict_index_get_n_fields(index)); 00846 ut_print_name(stderr, trx, TRUE, index->table_name); 00847 fprintf(stderr, "\n" 00848 "InnoDB: n_fields = %lu, i = %lu, ptr %p\n", 00849 (ulong) n_fields, (ulong) i, ptr); 00850 return(NULL); 00851 } 00852 00853 ptr = trx_undo_rec_get_col_val(ptr, &field, &len); 00854 00855 upd_field = upd_get_nth_field(update, i); 00856 00857 upd_field_set_field_no(upd_field, field_no, index, trx); 00858 00859 if (len != UNIV_SQL_NULL && len >= UNIV_EXTERN_STORAGE_FIELD) { 00860 00861 upd_field->extern_storage = TRUE; 00862 00863 len -= UNIV_EXTERN_STORAGE_FIELD; 00864 } 00865 00866 dfield_set_data(&(upd_field->new_val), field, len); 00867 } 00868 00869 *upd = update; 00870 00871 return(ptr); 00872 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.4.7

