1
/******************************************************
6
Created 2/16/1997 Heikki Tuuri
7
*******************************************************/
18
#include "read0types.h"
20
/*************************************************************************
21
Opens a read view where exactly the transactions serialized before this
22
point in time are seen in the view. */
27
/* out, own: read view struct */
28
dulint cr_trx_id, /* in: trx_id of creating
29
transaction, or (0, 0) used in
31
mem_heap_t* heap); /* in: memory heap from which
33
/*************************************************************************
34
Makes a copy of the oldest existing read view, or opens a new. The view
35
must be closed with ..._close. */
38
read_view_oldest_copy_or_open_new(
39
/*==============================*/
40
/* out, own: read view struct */
41
dulint cr_trx_id, /* in: trx_id of creating
42
transaction, or (0, 0) used in
44
mem_heap_t* heap); /* in: memory heap from which
46
/*************************************************************************
47
Closes a read view. */
52
read_view_t* view); /* in: read view */
53
/*************************************************************************
54
Closes a consistent read view for MySQL. This function is called at an SQL
55
statement end if the trx isolation level is <= TRX_ISO_READ_COMMITTED. */
58
read_view_close_for_mysql(
59
/*======================*/
60
trx_t* trx); /* in: trx which has a read view */
61
/*************************************************************************
62
Checks if a read view sees the specified transaction. */
65
read_view_sees_trx_id(
66
/*==================*/
67
/* out: TRUE if sees */
68
read_view_t* view, /* in: read view */
69
dulint trx_id);/* in: trx id */
70
/*************************************************************************
71
Prints a read view to stderr. */
76
read_view_t* view); /* in: read view */
77
/*************************************************************************
78
Create a consistent cursor view for mysql to be used in cursors. In this
79
consistent read view modifications done by the creating transaction or future
80
transactions are not visible. */
83
read_cursor_view_create_for_mysql(
84
/*==============================*/
85
trx_t* cr_trx);/* in: trx where cursor view is created */
86
/*************************************************************************
87
Close a given consistent cursor view for mysql and restore global read view
88
back to a transaction read view. */
91
read_cursor_view_close_for_mysql(
92
/*=============================*/
93
trx_t* trx, /* in: trx */
94
cursor_view_t* curview); /* in: cursor view to be closed */
95
/*************************************************************************
96
This function sets a given consistent cursor view to a transaction
97
read view if given consistent cursor view is not NULL. Otherwise, function
98
restores a global read view to a transaction read view. */
101
read_cursor_set_for_mysql(
102
/*======================*/
103
trx_t* trx, /* in: transaction where cursor is set */
104
cursor_view_t* curview);/* in: consistent cursor view to be set */
106
/* Read view lists the trx ids of those transactions for which a consistent
107
read should not see the modifications to the database. */
109
struct read_view_struct{
110
ulint type; /* VIEW_NORMAL, VIEW_HIGH_GRANULARITY */
111
dulint undo_no; /* (0, 0) or if type is VIEW_HIGH_GRANULARITY
112
transaction undo_no when this high-granularity
113
consistent read view was created */
114
dulint low_limit_no; /* The view does not need to see the undo
115
logs for transactions whose transaction number
116
is strictly smaller (<) than this value: they
117
can be removed in purge if not needed by other
119
dulint low_limit_id; /* The read should not see any transaction
120
with trx id >= this value */
121
dulint up_limit_id; /* The read should see all trx ids which
122
are strictly smaller (<) than this value */
123
ulint n_trx_ids; /* Number of cells in the trx_ids array */
124
dulint* trx_ids; /* Additional trx ids which the read should
125
not see: typically, these are the active
126
transactions at the time when the read is
127
serialized, except the reading transaction
128
itself; the trx ids in this array are in a
130
dulint creator_trx_id; /* trx id of creating transaction, or
131
(0, 0) used in purge */
132
UT_LIST_NODE_T(read_view_t) view_list;
133
/* List of read views in trx_sys */
136
/* Read view types */
137
#define VIEW_NORMAL 1 /* Normal consistent read view
138
where transaction does not see changes
139
made by active transactions except
140
creating transaction. */
141
#define VIEW_HIGH_GRANULARITY 2 /* High-granularity read view where
142
transaction does not see changes
143
made by active transactions and own
144
changes after a point in time when this
145
read view was created. */
147
/* Implement InnoDB framework to support consistent read views in
148
cursors. This struct holds both heap where consistent read view
149
is allocated and pointer to a read view. */
151
struct cursor_view_struct{
153
/* Memory heap for the cursor view */
154
read_view_t* read_view;
155
/* Consistent read view of the cursor*/
156
ulint n_mysql_tables_in_use;
157
/* number of Innobase tables used in the
158
processing of this cursor */
162
#include "read0read.ic"