MySQL 9.0.0
Source Code Documentation
row0vers.h File Reference

Row versions. More...

#include "data0data.h"
#include "dict0mem.h"
#include "dict0types.h"
#include "lob0undo.h"
#include "mtr0mtr.h"
#include "que0types.h"
#include "rem0types.h"
#include "trx0types.h"
#include "univ.i"
#include "row0vers.ic"

Go to the source code of this file.

Functions

trx_trow_vers_impl_x_locked (const rec_t *rec, const dict_index_t *index, const ulint *offsets)
 Finds out if an active transaction has inserted or modified a secondary index record. More...
 
bool row_vers_must_preserve_del_marked (trx_id_t trx_id, const table_name_t &name, mtr_t *mtr)
 Finds out if we must preserve a delete marked earlier version of a clustered index record, because it is >= the purge view. More...
 
bool row_vers_old_has_index_entry (bool also_curr, const rec_t *rec, mtr_t *mtr, dict_index_t *index, const dtuple_t *ientry, roll_ptr_t roll_ptr, trx_id_t trx_id)
 Finds out if a version of the record, where the version >= the current purge view, should have ientry as its secondary index entry. More...
 
dberr_t row_vers_build_for_consistent_read (const rec_t *rec, mtr_t *mtr, dict_index_t *index, ulint **offsets, ReadView *view, mem_heap_t **offset_heap, mem_heap_t *in_heap, rec_t **old_vers, const dtuple_t **vrow, lob::undo_vers_t *lob_undo)
 Constructs the version of a clustered index record which a consistent read should see. More...
 
void row_vers_build_for_semi_consistent_read (const rec_t *rec, mtr_t *mtr, dict_index_t *index, ulint **offsets, mem_heap_t **offset_heap, mem_heap_t *in_heap, const rec_t **old_vers, const dtuple_t **vrow)
 Constructs the last committed version of a clustered index record, which should be seen by a semi-consistent read. More...
 

Detailed Description

Row versions.

Created 2/6/1997 Heikki Tuuri

Function Documentation

◆ row_vers_build_for_consistent_read()

dberr_t row_vers_build_for_consistent_read ( const rec_t rec,
mtr_t mtr,
dict_index_t index,
ulint **  offsets,
ReadView view,
mem_heap_t **  offset_heap,
mem_heap_t in_heap,
rec_t **  old_vers,
const dtuple_t **  vrow,
lob::undo_vers_t lob_undo 
)

Constructs the version of a clustered index record which a consistent read should see.

We assume that the trx id stored in rec is such that the consistent read should not see rec in its present version.

Parameters
[in]recrecord in a clustered index; the caller must have a latch on the page; this latch locks the top of the stack of versions of this records
[in]mtrmtr holding the latch on rec; it will also hold the latch on purge_view
[in]indexthe clustered index
[in]offsetsoffsets returned by rec_get_offsets(rec, index)
[in]viewthe consistent read view
[in,out]offset_heapmemory heap from which the offsets are allocated
[in]in_heapmemory heap from which the memory for *old_vers is allocated; memory for possible intermediate versions is allocated and freed locally within the function
[out]old_versold version, or NULL if the history is missing or the record does not exist in the view, that is, it was freshly inserted afterwards.
[out]vrowreports virtual column info if any
[in]lob_undoundo log to be applied to blobs.
Returns
DB_SUCCESS or DB_MISSING_HISTORY

◆ row_vers_build_for_semi_consistent_read()

void row_vers_build_for_semi_consistent_read ( const rec_t rec,
mtr_t mtr,
dict_index_t index,
ulint **  offsets,
mem_heap_t **  offset_heap,
mem_heap_t in_heap,
const rec_t **  old_vers,
const dtuple_t **  vrow 
)

Constructs the last committed version of a clustered index record, which should be seen by a semi-consistent read.

Parameters
[in]recRecord in a clustered index; the caller must have a latch on the page; this latch locks the top of the stack of versions of this records
[in]mtrMini-transaction holding the latch on rec
[in]indexThe clustered index
[in,out]offsetsOffsets returned by rec_get_offsets(rec, index)
[in,out]offset_heapMemory heap from which the offsets are allocated
[in]in_heapMemory heap from which the memory for *old_vers is allocated; memory for possible intermediate versions is allocated and freed locally within the function
[out]old_versRec, old version, or null if the record does not exist in the view, that is, it was freshly inserted afterwards
[out]vrowVirtual row, old version, or null if it is not updated in the view

◆ row_vers_impl_x_locked()

trx_t * row_vers_impl_x_locked ( const rec_t rec,
const dict_index_t index,
const ulint offsets 
)

Finds out if an active transaction has inserted or modified a secondary index record.

Parameters
[in]recrecord in a secondary index
[in]indexthe secondary index
[in]offsetsrec_get_offsets(rec, index)
Returns
0 if committed, else the active transaction id; NOTE that this function can return false positives but never false negatives. The caller must confirm all positive results by checking if the trx is still active.

◆ row_vers_must_preserve_del_marked()

bool row_vers_must_preserve_del_marked ( trx_id_t  trx_id,
const table_name_t name,
mtr_t mtr 
)

Finds out if we must preserve a delete marked earlier version of a clustered index record, because it is >= the purge view.

Parameters
[in]trx_idTransaction id in the version
[in]nameTable name
[in,out]mtrMini-transaction holding the latch on the clustered index record; it will also hold the latch on purge_view
Returns
true if earlier version should be preserved

◆ row_vers_old_has_index_entry()

bool row_vers_old_has_index_entry ( bool  also_curr,
const rec_t rec,
mtr_t mtr,
dict_index_t index,
const dtuple_t ientry,
roll_ptr_t  roll_ptr,
trx_id_t  trx_id 
)

Finds out if a version of the record, where the version >= the current purge view, should have ientry as its secondary index entry.

We check if there is any not delete marked version of the record where the trx id >= purge view, and the secondary index entry == ientry; exactly in this case we return true.

Returns
true if earlier version should have in: transaction ID on the purging record

We check if there is any not delete marked version of the record where the trx id >= purge view, and the secondary index entry and ientry are identified in the alphabetical ordering; exactly in this case we return true.

Returns
true if earlier version should have
Parameters
also_currin: true if also rec is included in the versions to search; otherwise only versions prior to it are searched
recin: record in the clustered index; the caller must have a latch on the page
mtrin: mtr holding the latch on rec; it will also hold the latch on purge_view
indexin: the secondary index
ientryin: the secondary index entry
roll_ptrin: roll_ptr for the purge record
trx_idin: transaction ID on the purging record