35
18
#include "mtr0mtr.h"
36
19
#include "read0types.h"
38
/*****************************************************************//**
21
/*********************************************************************
39
22
Finds out if an active transaction has inserted or modified a secondary
40
23
index record. NOTE: the kernel mutex is temporarily released in this
42
@return NULL if committed, else the active transaction */
45
27
row_vers_impl_x_locked_off_kernel(
46
28
/*==============================*/
47
const rec_t* rec, /*!< in: record in a secondary index */
48
dict_index_t* index, /*!< in: the secondary index */
49
const ulint* offsets);/*!< in: rec_get_offsets(rec, index) */
50
/*****************************************************************//**
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
/*********************************************************************
51
36
Finds out if we must preserve a delete marked earlier version of a clustered
52
index record, because it is >= the purge view.
53
@return TRUE if earlier version should be preserved */
37
index record, because it is >= the purge view. */
56
40
row_vers_must_preserve_del_marked(
57
41
/*==============================*/
58
trx_id_t trx_id, /*!< in: transaction id in the version */
59
mtr_t* mtr); /*!< in: mtr holding the latch on the
60
clustered index record; it will also
61
hold the latch on purge_view */
62
/*****************************************************************//**
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
/*********************************************************************
63
47
Finds out if a version of the record, where the version >= the current
64
48
purge view, should have ientry as its secondary index entry. We check
65
49
if there is any not delete marked version of the record where the trx
66
50
id >= purge view, and the secondary index entry == ientry; exactly in
67
this case we return TRUE.
68
@return TRUE if earlier version should have */
51
this case we return TRUE. */
71
54
row_vers_old_has_index_entry(
72
55
/*=========================*/
73
ibool also_curr,/*!< in: TRUE if also rec is included in the
56
/* out: TRUE if earlier version should have */
57
ibool also_curr,/* in: TRUE if also rec is included in the
74
58
versions to search; otherwise only versions
75
59
prior to it are searched */
76
const rec_t* rec, /*!< in: record in the clustered index; the
60
const rec_t* rec, /* in: record in the clustered index; the
77
61
caller must have a latch on the page */
78
mtr_t* mtr, /*!< in: mtr holding the latch on rec; it will
62
mtr_t* mtr, /* in: mtr holding the latch on rec; it will
79
63
also hold the latch on purge_view */
80
dict_index_t* index, /*!< in: the secondary index */
81
const dtuple_t* ientry);/*!< in: the secondary index entry */
82
/*****************************************************************//**
64
dict_index_t* index, /* in: the secondary index */
65
const dtuple_t* ientry);/* in: the secondary index entry */
66
/*********************************************************************
83
67
Constructs the version of a clustered index record which a consistent
84
68
read should see. We assume that the trx id stored in rec is such that
85
the consistent read should not see rec in its present version.
86
@return DB_SUCCESS or DB_MISSING_HISTORY */
69
the consistent read should not see rec in its present version. */
89
72
row_vers_build_for_consistent_read(
90
73
/*===============================*/
91
const rec_t* rec, /*!< in: record in a clustered index; the
74
/* out: DB_SUCCESS or DB_MISSING_HISTORY */
75
const rec_t* rec, /* in: record in a clustered index; the
92
76
caller must have a latch on the page; this
93
77
latch locks the top of the stack of versions
95
mtr_t* mtr, /*!< in: mtr holding the latch on rec; it will
79
mtr_t* mtr, /* in: mtr holding the latch on rec; it will
96
80
also hold the latch on purge_view */
97
dict_index_t* index, /*!< in: the clustered index */
98
ulint** offsets,/*!< in/out: offsets returned by
81
dict_index_t* index, /* in: the clustered index */
82
ulint** offsets,/* in/out: offsets returned by
99
83
rec_get_offsets(rec, index) */
100
read_view_t* view, /*!< in: the consistent read view */
101
mem_heap_t** offset_heap,/*!< in/out: memory heap from which
84
read_view_t* view, /* in: the consistent read view */
85
mem_heap_t** offset_heap,/* in/out: memory heap from which
102
86
the offsets are allocated */
103
mem_heap_t* in_heap,/*!< in: memory heap from which the memory for
87
mem_heap_t* in_heap,/* in: memory heap from which the memory for
104
88
*old_vers is allocated; memory for possible
105
89
intermediate versions is allocated and freed
106
90
locally within the function */
107
rec_t** old_vers);/*!< out, own: old version, or NULL if the
91
rec_t** old_vers);/* out, own: old version, or NULL if the
108
92
record does not exist in the view, that is,
109
93
it was freshly inserted afterwards */
111
/*****************************************************************//**
95
/*********************************************************************
112
96
Constructs the last committed version of a clustered index record,
113
which should be seen by a semi-consistent read.
114
@return DB_SUCCESS or DB_MISSING_HISTORY */
97
which should be seen by a semi-consistent read. */
117
100
row_vers_build_for_semi_consistent_read(
118
101
/*====================================*/
119
const rec_t* rec, /*!< in: record in a clustered index; the
102
/* out: DB_SUCCESS or DB_MISSING_HISTORY */
103
const rec_t* rec, /* in: record in a clustered index; the
120
104
caller must have a latch on the page; this
121
105
latch locks the top of the stack of versions
122
106
of this records */
123
mtr_t* mtr, /*!< in: mtr holding the latch on rec */
124
dict_index_t* index, /*!< in: the clustered index */
125
ulint** offsets,/*!< in/out: offsets returned by
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
126
110
rec_get_offsets(rec, index) */
127
mem_heap_t** offset_heap,/*!< in/out: memory heap from which
111
mem_heap_t** offset_heap,/* in/out: memory heap from which
128
112
the offsets are allocated */
129
mem_heap_t* in_heap,/*!< in: memory heap from which the memory for
113
mem_heap_t* in_heap,/* in: memory heap from which the memory for
130
114
*old_vers is allocated; memory for possible
131
115
intermediate versions is allocated and freed
132
116
locally within the function */
133
const rec_t** old_vers);/*!< out: rec, old version, or NULL if the
117
const rec_t** old_vers);/* out: rec, old version, or NULL if the
134
118
record does not exist in the view, that is,
135
119
it was freshly inserted afterwards */