~drizzle-trunk/drizzle/development

641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
1
/******************************************************
2
Row versions
3
4
(c) 1997 Innobase Oy
5
6
Created 2/6/1997 Heikki Tuuri
7
*******************************************************/
8
9
#ifndef row0vers_h
10
#define row0vers_h
11
12
#include "univ.i"
13
#include "data0data.h"
14
#include "dict0types.h"
15
#include "trx0types.h"
16
#include "que0types.h"
17
#include "rem0types.h"
18
#include "mtr0mtr.h"
19
#include "read0types.h"
20
21
/*********************************************************************
22
Finds out if an active transaction has inserted or modified a secondary
23
index record. NOTE: the kernel mutex is temporarily released in this
24
function! */
25
UNIV_INTERN
26
trx_t*
27
row_vers_impl_x_locked_off_kernel(
28
/*==============================*/
29
				/* out: NULL if committed, else the active
30
				transaction; NOTE that the kernel mutex is
31
				temporarily released! */
32
	const rec_t*	rec,	/* in: record in a secondary index */
33
	dict_index_t*	index,	/* in: the secondary index */
34
	const ulint*	offsets);/* in: rec_get_offsets(rec, index) */
35
/*********************************************************************
36
Finds out if we must preserve a delete marked earlier version of a clustered
37
index record, because it is >= the purge view. */
38
UNIV_INTERN
39
ibool
40
row_vers_must_preserve_del_marked(
41
/*==============================*/
42
			/* out: TRUE if earlier version should be preserved */
43
	dulint	trx_id,	/* in: transaction id in the version */
44
	mtr_t*	mtr);	/* in: mtr holding the latch on the clustered index
45
			record; it will also hold the latch on purge_view */
46
/*********************************************************************
47
Finds out if a version of the record, where the version >= the current
48
purge view, should have ientry as its secondary index entry. We check
49
if there is any not delete marked version of the record where the trx
50
id >= purge view, and the secondary index entry == ientry; exactly in
51
this case we return TRUE. */
52
UNIV_INTERN
53
ibool
54
row_vers_old_has_index_entry(
55
/*=========================*/
56
				/* out: TRUE if earlier version should have */
57
	ibool		also_curr,/* in: TRUE if also rec is included in the
58
				versions to search; otherwise only versions
59
				prior to it are searched */
60
	const rec_t*	rec,	/* in: record in the clustered index; the
61
				caller must have a latch on the page */
62
	mtr_t*		mtr,	/* in: mtr holding the latch on rec; it will
63
				also hold the latch on purge_view */
64
	dict_index_t*	index,	/* in: the secondary index */
65
	const dtuple_t*	ientry);/* in: the secondary index entry */
66
/*********************************************************************
67
Constructs the version of a clustered index record which a consistent
68
read should see. We assume that the trx id stored in rec is such that
69
the consistent read should not see rec in its present version. */
70
UNIV_INTERN
71
ulint
72
row_vers_build_for_consistent_read(
73
/*===============================*/
74
				/* out: DB_SUCCESS or DB_MISSING_HISTORY */
75
	const rec_t*	rec,	/* in: record in a clustered index; the
76
				caller must have a latch on the page; this
77
				latch locks the top of the stack of versions
78
				of this records */
79
	mtr_t*		mtr,	/* in: mtr holding the latch on rec; it will
80
				also hold the latch on purge_view */
81
	dict_index_t*	index,	/* in: the clustered index */
82
	ulint**		offsets,/* in/out: offsets returned by
83
				rec_get_offsets(rec, index) */
84
	read_view_t*	view,	/* in: the consistent read view */
85
	mem_heap_t**	offset_heap,/* in/out: memory heap from which
86
				the offsets are allocated */
87
	mem_heap_t*	in_heap,/* in: memory heap from which the memory for
88
				*old_vers is allocated; memory for possible
89
				intermediate versions is allocated and freed
90
				locally within the function */
91
	rec_t**		old_vers);/* out, own: old version, or NULL if the
92
				record does not exist in the view, that is,
93
				it was freshly inserted afterwards */
94
95
/*********************************************************************
96
Constructs the last committed version of a clustered index record,
97
which should be seen by a semi-consistent read. */
98
UNIV_INTERN
99
ulint
100
row_vers_build_for_semi_consistent_read(
101
/*====================================*/
102
				/* out: DB_SUCCESS or DB_MISSING_HISTORY */
103
	const rec_t*	rec,	/* in: record in a clustered index; the
104
				caller must have a latch on the page; this
105
				latch locks the top of the stack of versions
106
				of this records */
107
	mtr_t*		mtr,	/* in: mtr holding the latch on rec */
108
	dict_index_t*	index,	/* in: the clustered index */
109
	ulint**		offsets,/* in/out: offsets returned by
110
				rec_get_offsets(rec, index) */
111
	mem_heap_t**	offset_heap,/* in/out: memory heap from which
112
				the offsets are allocated */
113
	mem_heap_t*	in_heap,/* in: memory heap from which the memory for
114
				*old_vers is allocated; memory for possible
115
				intermediate versions is allocated and freed
116
				locally within the function */
117
	const rec_t**	old_vers);/* out: rec, old version, or NULL if the
118
				record does not exist in the view, that is,
119
				it was freshly inserted afterwards */
120
121
122
#ifndef UNIV_NONINL
123
#include "row0vers.ic"
124
#endif
125
126
#endif