Drizzled Public API Documentation

row0vers.h File Reference
#include "univ.i"
#include "data0data.h"
#include "dict0types.h"
#include "trx0types.h"
#include "que0types.h"
#include "rem0types.h"
#include "mtr0mtr.h"
#include "read0types.h"

Go to the source code of this file.

Functions

UNIV_INTERN trx_trow_vers_impl_x_locked_off_kernel (const rec_t *rec, dict_index_t *index, const ulint *offsets)
UNIV_INTERN ibool row_vers_must_preserve_del_marked (trx_id_t trx_id, mtr_t *mtr)
UNIV_INTERN ibool row_vers_old_has_index_entry (ibool also_curr, const rec_t *rec, mtr_t *mtr, dict_index_t *index, const dtuple_t *ientry)
UNIV_INTERN ulint row_vers_build_for_consistent_read (const rec_t *rec, mtr_t *mtr, dict_index_t *index, ulint **offsets, read_view_t *view, mem_heap_t **offset_heap, mem_heap_t *in_heap, rec_t **old_vers)
UNIV_INTERN ulint 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)

Detailed Description

Row versions

Created 2/6/1997 Heikki Tuuri

Definition in file row0vers.h.


Function Documentation

UNIV_INTERN ulint row_vers_build_for_consistent_read ( const rec_t *  rec,
mtr_t mtr,
dict_index_t index,
ulint **  offsets,
read_view_t view,
mem_heap_t **  offset_heap,
mem_heap_t in_heap,
rec_t **  old_vers 
)

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.

Returns:
DB_SUCCESS or DB_MISSING_HISTORY out, own: old version, or NULL if the record does not exist in the view, that is, it was freshly inserted afterwards

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.

Returns:
DB_SUCCESS or DB_MISSING_HISTORY
Parameters:
recin: record 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
mtrin: mtr holding the latch on rec
indexin: the clustered index
offsetsin/out: offsets returned by rec_get_offsets(rec, index)
viewin: the consistent read view
offset_heapin/out: memory heap from which the offsets are allocated
in_heapin: memory heap from which the memory for *old_vers is allocated; memory for possible intermediate versions is allocated and freed locally within the function
old_versout, own: old version, or NULL if the record does not exist in the view, that is, it was freshly inserted afterwards

Definition at line 484 of file row0vers.cc.

References read_view_struct::creator_trx_id, dict_index_is_clust(), trx_purge_struct::latch, mem_heap_alloc(), mem_heap_create, mem_heap_empty(), mem_heap_free, purge_sys, read_view_sees_trx_id(), rec_copy(), rec_offs_size(), rec_offs_validate(), row_get_rec_roll_ptr(), row_get_rec_trx_id(), row_vers_build_for_consistent_read(), rw_lock_s_lock, trx_undo_get_undo_rec_low(), trx_undo_prev_version_build(), trx_undo_rec_get_undo_no(), read_view_struct::type, read_view_struct::undo_no, ut_ad, and VIEW_HIGH_GRANULARITY.

Referenced by row_vers_build_for_consistent_read().

UNIV_INTERN ulint 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 
)

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

Returns:
DB_SUCCESS or DB_MISSING_HISTORY out: rec, old version, or NULL if the record does not exist in the view, that is, it was freshly inserted afterwards

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

Returns:
DB_SUCCESS or DB_MISSING_HISTORY
Parameters:
recin: record 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
mtrin: mtr holding the latch on rec
indexin: the clustered index
offsetsin/out: offsets returned by rec_get_offsets(rec, index)
offset_heapin/out: memory heap from which the offsets are allocated
in_heapin: memory heap from which the memory for *old_vers is allocated; memory for possible intermediate versions is allocated and freed locally within the function
old_versout: rec, old version, or NULL if the record does not exist in the view, that is, it was freshly inserted afterwards

Definition at line 616 of file row0vers.cc.

References trx_struct::conc_state, dict_index_is_clust(), trx_purge_struct::latch, mem_heap_alloc(), mem_heap_create, mem_heap_free, purge_sys, rec_copy(), rec_offs_size(), rec_offs_validate(), row_get_rec_trx_id(), row_vers_build_for_semi_consistent_read(), rw_lock_s_lock, trx_get_on_id(), trx_undo_prev_version_build(), and ut_ad.

Referenced by row_vers_build_for_semi_consistent_read().

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

Finds out if an active transaction has inserted or modified a secondary index record. NOTE: the kernel mutex is temporarily released in this function!

Returns:
NULL if committed, else the active transaction in: rec_get_offsets(rec, index)

Finds out if an active transaction has inserted or modified a secondary index record. NOTE: the kernel mutex is temporarily released in this function!

Returns:
NULL if committed, else the active transaction
Parameters:
recin: record in a secondary index
indexin: the secondary index
offsetsin: rec_get_offsets(rec, index)

Definition at line 56 of file row0vers.cc.

References BTR_SEARCH_LEAF, cmp_dtuple_rec(), dict_table_is_comp(), dtuple_get_n_fields(), dtuple_set_types_binary(), trx_purge_struct::latch, lock_check_trx_id_sanity(), mem_heap_create, mem_heap_free, mtr_commit(), mtr_s_lock, mtr_start(), page_rec_is_comp(), purge_sys, rec_get_deleted_flag(), row_build(), row_build_index_entry(), row_get_clust_rec(), row_get_rec_trx_id(), row_vers_impl_x_locked_off_kernel(), dict_index_struct::table, trx_get_on_id(), trx_is_active(), trx_undo_prev_version_build(), ut_a, and ut_ad.

Referenced by row_vers_impl_x_locked_off_kernel().

UNIV_INTERN ibool row_vers_must_preserve_del_marked ( trx_id_t  trx_id,
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.

Returns:
TRUE if earlier version should be preserved in: mtr holding the latch on the clustered index record; it will also hold the latch on purge_view

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

Returns:
TRUE if earlier version should be preserved
Parameters:
trx_idin: transaction id in the version
mtrin: mtr holding the latch on the clustered index record; it will also hold the latch on purge_view

Definition at line 311 of file row0vers.cc.

References trx_purge_struct::latch, mtr_s_lock, purge_sys, row_vers_must_preserve_del_marked(), trx_purge_update_undo_must_exist(), and ut_ad.

Referenced by row_vers_must_preserve_del_marked().

UNIV_INTERN ibool row_vers_old_has_index_entry ( ibool  also_curr,
const rec_t *  rec,
mtr_t mtr,
dict_index_t index,
const dtuple_t ientry 
)

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: the secondary index entry

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 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

Definition at line 344 of file row0vers.cc.

References dict_table_is_comp(), trx_purge_struct::latch, mem_heap_create, mem_heap_free, mtr_s_lock, page_rec_is_comp(), purge_sys, rec_get_deleted_flag(), row_build(), row_build_index_entry(), row_vers_old_has_index_entry(), dict_index_struct::table, trx_undo_prev_version_build(), and ut_ad.

Referenced by row_purge_poss_sec(), and row_vers_old_has_index_entry().