InnoDB Plugin  1.0
Macros | Functions | Variables
trx0rec.h File Reference
#include "univ.i"
#include "trx0types.h"
#include "row0types.h"
#include "mtr0mtr.h"
#include "dict0types.h"
#include "data0data.h"
#include "rem0types.h"
#include "que0types.h"
#include "trx0rec.ic"
Include dependency graph for trx0rec.h:

Go to the source code of this file.

Macros

#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_ttrx_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))
UNIV_INTERN byte * trx_undo_rec_get_pars (trx_undo_rec_t *undo_rec, ulint *type, ulint *cmpl_info, bool *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 dberr_t 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, const ulint *offsets, roll_ptr_t *roll_ptr)
UNIV_INTERN trx_undo_rec_ttrx_undo_get_undo_rec_low (roll_ptr_t roll_ptr, mem_heap_t *heap))
UNIV_INTERN bool 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)

Variables

UNIV_INTERN dberr_t warn_unused_result

Detailed Description

Transaction undo log record

Created 3/26/1996 Heikki Tuuri

Macro Definition Documentation

#define TRX_UNDO_CMPL_INFO_MULT
Value:
16 /* compilation info is multiplied by
this and ORed to the type above */
#define TRX_UNDO_DEL_MARK_REC
Value:
14 /* delete marking of a record; fields
do not change */
#define trx_undo_rec_get_ptr (   undo_rec,
  undo_no 
)    ((undo_rec) + trx_undo_rec_get_offset(undo_no))

Returns the start of the undo record data area.

#define TRX_UNDO_UPD_DEL_REC
Value:
13 /* update of a delete marked record to
a not delete marked record; also the
fields of the record can change */
#define TRX_UNDO_UPD_EXIST_REC
Value:
12 /* update of a non-delete-marked
record */
#define TRX_UNDO_UPD_EXTERN
Value:
128 /* This bit can be ORed to type_cmpl
to denote that we updated external
storage fields: used by purge to
free the external storage */

Function Documentation

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.

Returns
own: copy of the record
Parameters
roll_ptrin: roll pointer to record
heapin: memory heap where copied
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.

Returns
end of log record or NULL in: page or NULL
Parameters
ptrin: buffer
end_ptrin: buffer end
UNIV_INTERN byte* trx_undo_parse_erase_page_end ( byte *  ptr,
byte *  end_ptr,
page_t page,
mtr_t mtr 
)

Parses a redo log record of erasing of an undo page end.

Returns
end of log record or NULL in: mtr or NULL
Parameters
ptrin: buffer
end_ptrin: buffer end
pagein: page or NULL
UNIV_INTERN bool 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 
)

Build a previous version of a clustered index record. The caller must hold a latch on the index page of the clustered index record.

Return values
trueif previous version was built, or if it was an insert or the table has been rebuilt
falseif the previous version is earlier than purge_view, which means that it may have been removed
Parameters
index_recin: clustered index record in the index tree
index_mtrin: mtr which contains the latch to index_rec page and purge_view
recin: version of a clustered index record
indexin: clustered index
offsetsin/out: rec_get_offsets(rec, index)
heapin: memory heap from which the memory needed is allocated
old_versout, own: previous version, or NULL if rec is the first inserted version, or if history data has been deleted
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.

Returns
own: copy of undo log record in: heap where copied

Copies the undo record to the heap.

Returns
own: copy of undo log record
Parameters
undo_recin: undo log record
heapin: heap where copied
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.

Returns
compiler info in: undo log record

Reads from an undo log record the record compiler info.

Returns
compiler info
Parameters
undo_recin: undo log record
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.

Returns
TRUE if extern in: undo log record

Returns TRUE if an undo log record contains an extern storage field.

Returns
TRUE if extern
Parameters
undo_recin: undo log record
UNIV_INLINE ulint trx_undo_rec_get_offset ( undo_no_t  undo_no)

Returns the start of the undo record data area.

Returns
offset to the data area
Parameters
undo_noin: undo no read from node
UNIV_INTERN byte* trx_undo_rec_get_pars ( trx_undo_rec_t undo_rec,
ulint *  type,
ulint *  cmpl_info,
bool *  updated_extern,
undo_no_t undo_no,
table_id_t *  table_id 
)

Reads from an undo log record the general parameters.

Returns
remaining part of undo log record after reading these values
Parameters
undo_recin: undo log record
typeout: undo record type: TRX_UNDO_INSERT_REC, ...
cmpl_infoout: compiler info, relevant only for update type records
updated_externout: true if we updated an externally stored fild
undo_noout: undo log record number
table_idout: table id
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, for purge. It contains the columns which occur as ordering in any index of the table. Any missing columns are indicated by col->mtype == DATA_MISSING.

Returns
pointer to remaining part of undo record
Parameters
ptrin: 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!
indexin: clustered index
rowout, own: partial row
ignore_prefixin: flag to indicate if we expect blob prefixes in undo. Used only in the assertion.
heapin: memory heap from which the memory needed is allocated
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.

Returns
pointer to remaining part of undo record in: memory heap from which the memory needed is allocated
Parameters
ptrin: 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!
indexin: clustered index
refout, own: row reference
UNIV_INLINE ulint trx_undo_rec_get_type ( const trx_undo_rec_t undo_rec)

Reads the undo log record type.

Returns
record type in: undo log record

Reads from an undo log record the record type.

Returns
record type
Parameters
undo_recin: undo log record
UNIV_INLINE undo_no_t trx_undo_rec_get_undo_no ( const trx_undo_rec_t undo_rec)

Reads the undo log record number.

Returns
undo no in: undo log record

Reads the undo log record number.

Returns
undo no
Parameters
undo_recin: undo log record
UNIV_INTERN byte* trx_undo_rec_skip_row_ref ( byte *  ptr,
dict_index_t index 
)

Skips a row reference from an undo log record.

Returns
pointer to remaining part of undo record in: clustered index
Parameters
ptrin: remaining part in update undo log record, at the start of the row reference
UNIV_INTERN dberr_t 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,
const ulint *  offsets,
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.

Returns
DB_SUCCESS or error code
Parameters
flagsin: if BTR_NO_UNDO_LOG_FLAG bit is set, does nothing
op_typein: TRX_UNDO_INSERT_OP or TRX_UNDO_MODIFY_OP
thrin: query thread
indexin: clustered index
clust_entryin: in the case of an insert, index entry to insert into the clustered index, otherwise NULL
updatein: in the case of an update, the update vector, otherwise NULL
cmpl_infoin: compiler info on secondary index updates
recin: case of an update or delete marking, the record in the clustered index, otherwise NULL
offsetsin: rec_get_offsets(rec)
roll_ptrout: rollback pointer to the inserted undo log record, 0 if BTR_NO_UNDO_LOG flag was specified
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.

Returns
remaining part of undo log record after reading these values out: info bits state
Parameters
ptrin: remaining part of undo log record after reading general parameters
trx_idout: trx id
roll_ptrout: roll ptr
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.

Returns
remaining part of the record, NULL if an error detected, which means that the record is corrupted out, own: update vector
Parameters
ptrin: 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!
indexin: clustered index
typein: 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_idin: transaction id from this undorecord
roll_ptrin: roll pointer from this undo record
info_bitsin: info bits from this undo record
trxin: transaction
heapin: memory heap from which the memory needed is allocated