mariadb/include/row0vers.h
marko e9a3aa18c8 branches/zip: Introduce the logical type names trx_id_t, roll_ptr_t,
and undo_no_t. Each type is still defined as dulint.

This is an initial step towards replacing dulint with a 64-bit data type.
Because modern compilers have no trouble supporting 64-bit arithmetics
even on 32-bit targets, the dulint struct is a relic that should go.

The last remaining major use of dulint is dictionary IDs
(table, index, and row ids).

rb://114 approved by Sunny Bains
2009-04-23 05:32:36 +00:00

144 lines
5.7 KiB
C

/*****************************************************************************
Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/******************************************************
Row versions
Created 2/6/1997 Heikki Tuuri
*******************************************************/
#ifndef row0vers_h
#define row0vers_h
#include "univ.i"
#include "data0data.h"
#include "dict0types.h"
#include "trx0types.h"
#include "que0types.h"
#include "rem0types.h"
#include "mtr0mtr.h"
#include "read0types.h"
/*********************************************************************
Finds out if an active transaction has inserted or modified a secondary
index record. NOTE: the kernel mutex is temporarily released in this
function! */
UNIV_INTERN
trx_t*
row_vers_impl_x_locked_off_kernel(
/*==============================*/
/* out: NULL if committed, else the active
transaction; NOTE that the kernel mutex is
temporarily released! */
const rec_t* rec, /* in: record in a secondary index */
dict_index_t* index, /* in: the secondary index */
const ulint* offsets);/* in: rec_get_offsets(rec, index) */
/*********************************************************************
Finds out if we must preserve a delete marked earlier version of a clustered
index record, because it is >= the purge view. */
UNIV_INTERN
ibool
row_vers_must_preserve_del_marked(
/*==============================*/
/* out: TRUE if earlier version should
be preserved */
trx_id_t trx_id, /* in: transaction id in the version */
mtr_t* mtr); /* in: mtr holding the latch on the
clustered index record; it will also
hold the latch on purge_view */
/*********************************************************************
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. */
UNIV_INTERN
ibool
row_vers_old_has_index_entry(
/*=========================*/
/* out: TRUE if earlier version should have */
ibool also_curr,/* in: TRUE if also rec is included in the
versions to search; otherwise only versions
prior to it are searched */
const rec_t* rec, /* in: record in the clustered index; the
caller must have a latch on the page */
mtr_t* mtr, /* in: mtr holding the latch on rec; it will
also hold the latch on purge_view */
dict_index_t* index, /* in: the secondary index */
const dtuple_t* ientry);/* in: the secondary index entry */
/*********************************************************************
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. */
UNIV_INTERN
ulint
row_vers_build_for_consistent_read(
/*===============================*/
/* out: DB_SUCCESS or DB_MISSING_HISTORY */
const rec_t* rec, /* in: 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 */
mtr_t* mtr, /* in: mtr holding the latch on rec; it will
also hold the latch on purge_view */
dict_index_t* index, /* in: the clustered index */
ulint** offsets,/* in/out: offsets returned by
rec_get_offsets(rec, index) */
read_view_t* view, /* in: the consistent read view */
mem_heap_t** offset_heap,/* in/out: memory heap from which
the offsets are allocated */
mem_heap_t* in_heap,/* in: memory heap from which the memory for
*old_vers is allocated; memory for possible
intermediate versions is allocated and freed
locally within the function */
rec_t** old_vers);/* out, own: 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. */
UNIV_INTERN
ulint
row_vers_build_for_semi_consistent_read(
/*====================================*/
/* out: DB_SUCCESS or DB_MISSING_HISTORY */
const rec_t* rec, /* in: 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 */
mtr_t* mtr, /* in: mtr holding the latch on rec */
dict_index_t* index, /* in: the clustered index */
ulint** offsets,/* in/out: offsets returned by
rec_get_offsets(rec, index) */
mem_heap_t** offset_heap,/* in/out: memory heap from which
the offsets are allocated */
mem_heap_t* in_heap,/* in: memory heap from which the memory for
*old_vers is allocated; memory for possible
intermediate versions is allocated and freed
locally within the function */
const rec_t** old_vers);/* out: rec, old version, or NULL if the
record does not exist in the view, that is,
it was freshly inserted afterwards */
#ifndef UNIV_NONINL
#include "row0vers.ic"
#endif
#endif