#include "univ.i"
#include "trx0types.h"
#include "row0types.h"
#include "mtr0mtr.h"
#include "dict0types.h"
#include "data0data.h"
#include "rem0types.h"
#include "que0types.h"
Go to the source code of this file.
Defines | |
#define | trx_undo_rec_get_ptr(undo_rec, undo_no) ((undo_rec) + trx_undo_rec_get_offset(undo_no)) |
#define | TRX_UNDO_INSERT_REC 11 /* fresh insert into clustered index */ |
#define | TRX_UNDO_UPD_EXIST_REC |
#define | TRX_UNDO_UPD_DEL_REC |
#define | TRX_UNDO_DEL_MARK_REC |
#define | TRX_UNDO_CMPL_INFO_MULT |
#define | TRX_UNDO_UPD_EXTERN |
#define | TRX_UNDO_INSERT_OP 1 |
#define | TRX_UNDO_MODIFY_OP 2 |
Functions | |
UNIV_INLINE trx_undo_rec_t * | trx_undo_rec_copy (const trx_undo_rec_t *undo_rec, mem_heap_t *heap) |
UNIV_INLINE ulint | trx_undo_rec_get_type (const trx_undo_rec_t *undo_rec) |
UNIV_INLINE ulint | trx_undo_rec_get_cmpl_info (const trx_undo_rec_t *undo_rec) |
UNIV_INLINE ibool | trx_undo_rec_get_extern_storage (const trx_undo_rec_t *undo_rec) |
UNIV_INLINE undo_no_t | trx_undo_rec_get_undo_no (const trx_undo_rec_t *undo_rec) |
UNIV_INLINE ulint | trx_undo_rec_get_offset (undo_no_t undo_no) __attribute__((const )) |
UNIV_INTERN byte * | trx_undo_rec_get_pars (trx_undo_rec_t *undo_rec, ulint *type, ulint *cmpl_info, ibool *updated_extern, undo_no_t *undo_no, table_id_t *table_id) |
UNIV_INTERN byte * | trx_undo_rec_get_row_ref (byte *ptr, dict_index_t *index, dtuple_t **ref, mem_heap_t *heap) |
UNIV_INTERN byte * | trx_undo_rec_skip_row_ref (byte *ptr, dict_index_t *index) |
UNIV_INTERN byte * | trx_undo_update_rec_get_sys_cols (byte *ptr, trx_id_t *trx_id, roll_ptr_t *roll_ptr, ulint *info_bits) |
UNIV_INTERN byte * | trx_undo_update_rec_get_update (byte *ptr, dict_index_t *index, ulint type, trx_id_t trx_id, roll_ptr_t roll_ptr, ulint info_bits, trx_t *trx, mem_heap_t *heap, upd_t **upd) |
UNIV_INTERN byte * | trx_undo_rec_get_partial_row (byte *ptr, dict_index_t *index, dtuple_t **row, ibool ignore_prefix, mem_heap_t *heap) |
UNIV_INTERN ulint | trx_undo_report_row_operation (ulint flags, ulint op_type, que_thr_t *thr, dict_index_t *index, const dtuple_t *clust_entry, const upd_t *update, ulint cmpl_info, const rec_t *rec, roll_ptr_t *roll_ptr) |
UNIV_INTERN trx_undo_rec_t * | trx_undo_get_undo_rec_low (roll_ptr_t roll_ptr, mem_heap_t *heap) |
UNIV_INTERN ulint | trx_undo_get_undo_rec (roll_ptr_t roll_ptr, trx_id_t trx_id, trx_undo_rec_t **undo_rec, mem_heap_t *heap) |
UNIV_INTERN ulint | trx_undo_prev_version_build (const rec_t *index_rec, mtr_t *index_mtr, const rec_t *rec, dict_index_t *index, ulint *offsets, mem_heap_t *heap, rec_t **old_vers) |
UNIV_INTERN byte * | trx_undo_parse_add_undo_rec (byte *ptr, byte *end_ptr, page_t *page) |
UNIV_INTERN byte * | trx_undo_parse_erase_page_end (byte *ptr, byte *end_ptr, page_t *page, mtr_t *mtr) |
#define TRX_UNDO_CMPL_INFO_MULT |
#define TRX_UNDO_DEL_MARK_REC |
#define trx_undo_rec_get_ptr | ( | undo_rec, | |
undo_no | |||
) | ((undo_rec) + trx_undo_rec_get_offset(undo_no)) |
#define TRX_UNDO_UPD_DEL_REC |
#define TRX_UNDO_UPD_EXIST_REC |
#define TRX_UNDO_UPD_EXTERN |
UNIV_INTERN ulint trx_undo_get_undo_rec | ( | roll_ptr_t | roll_ptr, |
trx_id_t | trx_id, | ||
trx_undo_rec_t ** | undo_rec, | ||
mem_heap_t * | heap | ||
) |
Copies an undo record to heap.
NOTE: the caller must have latches on the clustered index page and purge_view.
Copies an undo record to heap.
NOTE: the caller must have latches on the clustered index page and purge_view.
roll_ptr | in: roll pointer to record |
trx_id | in: id of the trx that generated the roll pointer: it points to an undo log of this transaction |
undo_rec | out, own: copy of the record |
heap | in: memory heap where copied |
Definition at line 1377 of file trx0rec.cc.
References trx_purge_struct::latch, purge_sys, trx_purge_update_undo_must_exist(), trx_undo_get_undo_rec(), trx_undo_get_undo_rec_low(), and ut_ad.
Referenced by trx_undo_get_undo_rec(), and trx_undo_prev_version_build().
UNIV_INTERN trx_undo_rec_t* trx_undo_get_undo_rec_low | ( | roll_ptr_t | roll_ptr, |
mem_heap_t * | heap | ||
) |
Copies an undo record to heap. This function can be called if we know that the undo log record exists.
Copies an undo record to heap. This function can be called if we know that the undo log record exists.
roll_ptr | in: roll pointer to record |
heap | in: memory heap where copied |
Definition at line 1337 of file trx0rec.cc.
References mtr_commit(), mtr_start(), trx_rseg_struct::space, trx_rseg_get_on_id(), trx_undo_decode_roll_ptr(), trx_undo_get_undo_rec_low(), trx_undo_page_get_s_latched(), and trx_undo_rec_copy().
Referenced by row_vers_build_for_consistent_read(), trx_undo_get_undo_rec(), and trx_undo_get_undo_rec_low().
UNIV_INTERN byte* trx_undo_parse_add_undo_rec | ( | byte * | ptr, |
byte * | end_ptr, | ||
page_t * | page | ||
) |
Parses a redo log record of adding an undo log record.
Parses a redo log record of adding an undo log record.
ptr | in: buffer |
end_ptr | in: buffer end |
page | in: page or NULL |
Definition at line 94 of file trx0rec.cc.
References mach_read_from_2(), mach_write_to_2(), TRX_UNDO_PAGE_FREE, TRX_UNDO_PAGE_HDR, trx_undo_parse_add_undo_rec(), and ut_memcpy().
Referenced by trx_undo_parse_add_undo_rec().
UNIV_INTERN byte* trx_undo_parse_erase_page_end | ( | byte * | ptr, |
byte * | , | ||
page_t * | page, | ||
mtr_t * | mtr | ||
) |
Parses a redo log record of erasing of an undo page end.
Parses a redo log record of erasing of an undo page end.
ptr | in: buffer |
page | in: page or NULL |
mtr | in: mtr or NULL |
Definition at line 1123 of file trx0rec.cc.
References trx_undo_parse_erase_page_end(), and ut_ad.
Referenced by trx_undo_parse_erase_page_end().
UNIV_INTERN ulint trx_undo_prev_version_build | ( | const rec_t * | index_rec, |
mtr_t * | , | ||
const rec_t * | rec, | ||
dict_index_t * | index, | ||
ulint * | offsets, | ||
mem_heap_t * | heap, | ||
rec_t ** | old_vers | ||
) |
Build a previous version of a clustered index record. This function checks that the caller has a latch on the index page of the clustered index record and an s-latch on the purge_view. This guarantees that the stack of versions is locked.
Build a previous version of a clustered index record. This function checks that the caller has a latch on the index page of the clustered index record and an s-latch on the purge_view. This guarantees that the stack of versions is locked all the way down to the purge_view.
index_rec | in: clustered index record in the index tree |
rec | in: version of a clustered index record |
index | in: clustered index |
offsets | in: rec_get_offsets(rec, index) |
heap | in: memory heap from which the memory needed is allocated |
old_vers | out, own: previous version, or NULL if rec is the first inserted version, or if history data has been deleted (an error), or if the purge COULD have removed the version though it has not yet done so |
Definition at line 1413 of file trx0rec.cc.
References dict_index_get_n_unique(), dict_index_is_clust(), dict_table_struct::id, trx_purge_struct::latch, mem_heap_alloc(), dict_index_struct::name, purge_sys, rec_convert_dtuple_to_rec(), rec_copy(), rec_get_converted_size(), rec_offs_size(), rec_offs_validate(), rec_print(), rec_print_new(), row_get_rec_roll_ptr(), row_get_rec_trx_id(), row_rec_to_index_entry(), row_upd_changes_field_size_or_external(), row_upd_index_replace_new_col_vals(), row_upd_rec_in_place(), dict_index_struct::table, dict_index_struct::table_name, TRX_ID_FMT, trx_purge_sys_print(), trx_undo_get_undo_rec(), trx_undo_prev_version_build(), trx_undo_rec_get_pars(), trx_undo_rec_skip_row_ref(), trx_undo_roll_ptr_is_insert(), trx_undo_update_rec_get_sys_cols(), trx_undo_update_rec_get_update(), ut_ad, and ut_print_buf().
Referenced by row_vers_build_for_consistent_read(), row_vers_build_for_semi_consistent_read(), row_vers_impl_x_locked_off_kernel(), row_vers_old_has_index_entry(), and trx_undo_prev_version_build().
UNIV_INLINE trx_undo_rec_t* trx_undo_rec_copy | ( | const trx_undo_rec_t * | undo_rec, |
mem_heap_t * | heap | ||
) |
Copies the undo record to the heap.
undo_rec | in: undo log record |
Referenced by trx_roll_pop_top_rec_of_trx(), and trx_undo_get_undo_rec_low().
UNIV_INLINE ulint trx_undo_rec_get_cmpl_info | ( | const trx_undo_rec_t * | undo_rec | ) |
Reads from an undo log record the record compiler info.
UNIV_INLINE ibool trx_undo_rec_get_extern_storage | ( | const trx_undo_rec_t * | undo_rec | ) |
Returns TRUE if an undo log record contains an extern storage field.
UNIV_INLINE ulint trx_undo_rec_get_offset | ( | undo_no_t | undo_no | ) | const |
Returns the start of the undo record data area.
undo_no | in: undo no read from node |
UNIV_INTERN byte* trx_undo_rec_get_pars | ( | trx_undo_rec_t * | undo_rec, |
ulint * | type, | ||
ulint * | cmpl_info, | ||
ibool * | updated_extern, | ||
undo_no_t * | undo_no, | ||
table_id_t * | table_id | ||
) |
Reads from an undo log record the general parameters.
Reads from an undo log record the general parameters.
undo_rec | in: undo log record |
type | out: undo record type: TRX_UNDO_INSERT_REC, ... |
cmpl_info | out: compiler info, relevant only for update type records |
updated_extern | out: TRUE if we updated an externally stored fild |
undo_no | out: undo log record number |
table_id | out: table id |
Definition at line 282 of file trx0rec.cc.
References mach_read_from_1(), mach_ull_get_much_compressed_size(), mach_ull_read_much_compressed(), and trx_undo_rec_get_pars().
Referenced by trx_undo_prev_version_build(), and trx_undo_rec_get_pars().
UNIV_INTERN byte* trx_undo_rec_get_partial_row | ( | byte * | ptr, |
dict_index_t * | index, | ||
dtuple_t ** | row, | ||
ibool | ignore_prefix, | ||
mem_heap_t * | heap | ||
) |
Builds a partial row from an update undo log record. It contains the columns which occur as ordering in any index of the table.
Builds a partial row from an update undo log record. It contains the columns which occur as ordering in any index of the table.
ptr | in: remaining part in update undo log record of a suitable type, at the start of the stored index columns; NOTE that this copy of the undo log record must be preserved as long as the partial row is used, as we do NOT copy the data in the record! |
index | in: clustered index |
row | out, own: partial row |
ignore_prefix | in: flag to indicate if we expect blob prefixes in undo. Used only in the assertion. |
heap | in: memory heap from which the memory needed is allocated |
Definition at line 1020 of file trx0rec.cc.
References dfield_get_len(), dfield_set_data(), dfield_set_ext(), dfield_set_len(), dict_col_get_no(), dict_index_get_nth_col(), dict_index_is_clust(), dict_table_get_format(), dict_table_get_n_cols(), DICT_TF_FORMAT_ZIP, dtuple_create(), mach_read_from_2(), dict_col_struct::ord_part, dict_index_struct::table, trx_undo_rec_get_partial_row(), ut_a, and ut_ad.
Referenced by trx_undo_rec_get_partial_row().
UNIV_INTERN byte* trx_undo_rec_get_row_ref | ( | byte * | ptr, |
dict_index_t * | index, | ||
dtuple_t ** | ref, | ||
mem_heap_t * | heap | ||
) |
Builds a row reference from an undo log record.
Builds a row reference from an undo log record.
ptr | in: remaining part of a copy of an undo log record, at the start of the row reference; NOTE that this copy of the undo log record must be preserved as long as the row reference is used, as we do NOT copy the data in the record! |
index | in: clustered index |
ref | out, own: row reference |
heap | in: memory heap from which the memory needed is allocated |
Definition at line 380 of file trx0rec.cc.
References dfield_set_data(), dict_index_get_n_unique(), dict_index_is_clust(), dtuple_create(), trx_undo_rec_get_row_ref(), ut_a, and ut_ad.
Referenced by trx_undo_rec_get_row_ref().
UNIV_INLINE ulint trx_undo_rec_get_type | ( | const trx_undo_rec_t * | undo_rec | ) |
Reads the undo log record type.
UNIV_INLINE undo_no_t trx_undo_rec_get_undo_no | ( | const trx_undo_rec_t * | undo_rec | ) |
Reads the undo log record number.
Referenced by row_vers_build_for_consistent_read(), trx_roll_pop_top_rec_of_trx(), trx_undo_truncate_end(), and trx_undo_truncate_start().
UNIV_INTERN byte* trx_undo_rec_skip_row_ref | ( | byte * | ptr, |
dict_index_t * | index | ||
) |
Skips a row reference from an undo log record.
Skips a row reference from an undo log record.
ptr | in: remaining part in update undo log record, at the start of the row reference |
index | in: clustered index |
Definition at line 426 of file trx0rec.cc.
References dict_index_get_n_unique(), dict_index_is_clust(), trx_undo_rec_skip_row_ref(), ut_a, and ut_ad.
Referenced by trx_undo_prev_version_build(), and trx_undo_rec_skip_row_ref().
UNIV_INTERN ulint trx_undo_report_row_operation | ( | ulint | flags, |
ulint | op_type, | ||
que_thr_t * | thr, | ||
dict_index_t * | index, | ||
const dtuple_t * | clust_entry, | ||
const upd_t * | update, | ||
ulint | cmpl_info, | ||
const rec_t * | rec, | ||
roll_ptr_t * | roll_ptr | ||
) |
Writes information to an undo log about an insert, update, or a delete marking of a clustered index record. This information is used in a rollback of the transaction and in consistent reads that must look to the history of this transaction.
Writes information to an undo log about an insert, update, or a delete marking of a clustered index record. This information is used in a rollback of the transaction and in consistent reads that must look to the history of this transaction.
flags | in: if BTR_NO_UNDO_LOG_FLAG bit is set, does nothing |
op_type | in: TRX_UNDO_INSERT_OP or TRX_UNDO_MODIFY_OP |
thr | in: query thread |
index | in: clustered index |
clust_entry | in: in the case of an insert, index entry to insert into the clustered index, otherwise NULL |
update | in: in the case of an update, the update vector, otherwise NULL |
cmpl_info | in: compiler info on secondary index updates |
rec | in: in case of an update or delete marking, the record in the clustered index, otherwise NULL |
roll_ptr | out: rollback pointer to the inserted undo log record, 0 if BTR_NO_UNDO_LOG flag was specified |
Definition at line 1151 of file trx0rec.cc.
References BUF_GET, dict_index_is_clust(), trx_undo_struct::empty, FIL_NULL, trx_undo_struct::guess_block, trx_rseg_struct::id, trx_struct::insert_undo, trx_undo_struct::last_page_no, mem_heap_free, mtr_commit(), mtr_start(), trx_rseg_struct::mutex, trx_struct::rseg, trx_undo_struct::space, thr_get_trx(), trx_undo_struct::top_offset, trx_undo_struct::top_page_no, trx_undo_struct::top_undo_no, trx_undo_add_page(), trx_undo_assign_undo(), trx_undo_build_roll_ptr(), trx_undo_report_row_operation(), trx_struct::undo_mutex, trx_struct::undo_no, trx_struct::update_undo, ut_a, ut_ad, and trx_undo_struct::zip_size.
Referenced by btr_cur_del_mark_set_clust_rec(), and trx_undo_report_row_operation().
UNIV_INTERN byte* trx_undo_update_rec_get_sys_cols | ( | byte * | ptr, |
trx_id_t * | trx_id, | ||
roll_ptr_t * | roll_ptr, | ||
ulint * | info_bits | ||
) |
Reads from an undo log update record the system field values of the old version.
Reads from an undo log update record the system field values of the old version.
ptr | in: remaining part of undo log record after reading general parameters |
trx_id | out: trx id |
roll_ptr | out: roll ptr |
info_bits | out: info bits state |
Definition at line 836 of file trx0rec.cc.
References mach_read_from_1(), mach_ull_get_compressed_size(), mach_ull_read_compressed(), and trx_undo_update_rec_get_sys_cols().
Referenced by trx_undo_prev_version_build(), and trx_undo_update_rec_get_sys_cols().
UNIV_INTERN byte* trx_undo_update_rec_get_update | ( | byte * | ptr, |
dict_index_t * | index, | ||
ulint | type, | ||
trx_id_t | trx_id, | ||
roll_ptr_t | roll_ptr, | ||
ulint | info_bits, | ||
trx_t * | trx, | ||
mem_heap_t * | heap, | ||
upd_t ** | upd | ||
) |
Builds an update vector based on a remaining part of an undo log record.
Builds an update vector based on a remaining part of an undo log record.
ptr | in: remaining part in update undo log record, after reading the row reference NOTE that this copy of the undo log record must be preserved as long as the update vector is used, as we do NOT copy the data in the record! |
index | in: clustered index |
type | in: TRX_UNDO_UPD_EXIST_REC, TRX_UNDO_UPD_DEL_REC, or TRX_UNDO_DEL_MARK_REC; in the last case, only trx id and roll ptr fields are added to the update vector |
trx_id | in: transaction id from this undo record |
roll_ptr | in: roll pointer from this undo record |
info_bits | in: info bits from this undo record |
trx | in: transaction |
heap | in: memory heap from which the memory needed is allocated |
upd | out, own: update vector |
Definition at line 898 of file trx0rec.cc.
References dfield_set_data(), dfield_set_ext(), dfield_set_null(), dict_index_get_n_fields(), dict_index_get_sys_col_pos(), dict_index_is_clust(), upd_struct::info_bits, mem_heap_alloc(), upd_field_struct::new_val, upd_field_struct::orig_len, dict_index_struct::table_name, trx_undo_update_rec_get_update(), trx_write_roll_ptr(), trx_write_trx_id(), upd_create(), upd_field_set_field_no(), ut_a, and ut_print_name().
Referenced by trx_undo_prev_version_build(), and trx_undo_update_rec_get_update().