~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/read0read.h

  • Committer: Jay Pipes
  • Date: 2009-04-10 17:06:58 UTC
  • mto: (971.1.47 mordred)
  • mto: This revision was merged to the branch mainline in revision 990.
  • Revision ID: jpipes@serialcoder-20090410170658-d3azdnas1fn8v68l
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator
plugin.  New transaction_services.cc class implementation of the API for
converting between internal formats and GPB Command Messages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 1997, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
13
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
 
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
19
 
/**************************************************//**
20
 
@file include/read0read.h
 
19
/******************************************************
21
20
Cursor read
22
21
 
23
22
Created 2/16/1997 Heikki Tuuri
34
33
#include "trx0trx.h"
35
34
#include "read0types.h"
36
35
 
37
 
/*********************************************************************//**
 
36
/*************************************************************************
38
37
Opens a read view where exactly the transactions serialized before this
39
 
point in time are seen in the view.
40
 
@return own: read view struct */
 
38
point in time are seen in the view. */
41
39
UNIV_INTERN
42
40
read_view_t*
43
41
read_view_open_now(
44
42
/*===============*/
45
 
        trx_id_t        cr_trx_id,      /*!< in: trx_id of creating
46
 
                                        transaction, or 0 used in purge */
47
 
        mem_heap_t*     heap);          /*!< in: memory heap from which
 
43
                                        /* out, own: read view struct */
 
44
        dulint          cr_trx_id,      /* in: trx_id of creating
 
45
                                        transaction, or (0, 0) used in
 
46
                                        purge */
 
47
        mem_heap_t*     heap);          /* in: memory heap from which
48
48
                                        allocated */
49
 
/*********************************************************************//**
 
49
/*************************************************************************
50
50
Makes a copy of the oldest existing read view, or opens a new. The view
51
 
must be closed with ..._close.
52
 
@return own: read view struct */
 
51
must be closed with ..._close. */
53
52
UNIV_INTERN
54
53
read_view_t*
55
54
read_view_oldest_copy_or_open_new(
56
55
/*==============================*/
57
 
        trx_id_t        cr_trx_id,      /*!< in: trx_id of creating
58
 
                                        transaction, or 0 used in purge */
59
 
        mem_heap_t*     heap);          /*!< in: memory heap from which
 
56
                                        /* out, own: read view struct */
 
57
        dulint          cr_trx_id,      /* in: trx_id of creating
 
58
                                        transaction, or (0, 0) used in
 
59
                                        purge */
 
60
        mem_heap_t*     heap);          /* in: memory heap from which
60
61
                                        allocated */
61
 
/*********************************************************************//**
 
62
/*************************************************************************
62
63
Closes a read view. */
63
64
UNIV_INTERN
64
65
void
65
66
read_view_close(
66
67
/*============*/
67
 
        read_view_t*    view);  /*!< in: read view */
68
 
/*********************************************************************//**
 
68
        read_view_t*    view);  /* in: read view */
 
69
/*************************************************************************
69
70
Closes a consistent read view for MySQL. This function is called at an SQL
70
71
statement end if the trx isolation level is <= TRX_ISO_READ_COMMITTED. */
71
72
UNIV_INTERN
72
73
void
73
74
read_view_close_for_mysql(
74
75
/*======================*/
75
 
        trx_t*  trx);   /*!< in: trx which has a read view */
76
 
/*********************************************************************//**
77
 
Checks if a read view sees the specified transaction.
78
 
@return TRUE if sees */
 
76
        trx_t*  trx);   /* in: trx which has a read view */
 
77
/*************************************************************************
 
78
Checks if a read view sees the specified transaction. */
79
79
UNIV_INLINE
80
80
ibool
81
81
read_view_sees_trx_id(
82
82
/*==================*/
83
 
        const read_view_t*      view,   /*!< in: read view */
84
 
        trx_id_t                trx_id);/*!< in: trx id */
85
 
/*********************************************************************//**
 
83
                                /* out: TRUE if sees */
 
84
        read_view_t*    view,   /* in: read view */
 
85
        dulint          trx_id);/* in: trx id */
 
86
/*************************************************************************
86
87
Prints a read view to stderr. */
87
88
UNIV_INTERN
88
89
void
89
90
read_view_print(
90
91
/*============*/
91
 
        const read_view_t*      view);  /*!< in: read view */
92
 
/*********************************************************************//**
 
92
        read_view_t*    view);  /* in: read view */
 
93
/*************************************************************************
93
94
Create a consistent cursor view for mysql to be used in cursors. In this
94
95
consistent read view modifications done by the creating transaction or future
95
96
transactions are not visible. */
97
98
cursor_view_t*
98
99
read_cursor_view_create_for_mysql(
99
100
/*==============================*/
100
 
        trx_t*          cr_trx);/*!< in: trx where cursor view is created */
101
 
/*********************************************************************//**
 
101
        trx_t*          cr_trx);/* in: trx where cursor view is created */
 
102
/*************************************************************************
102
103
Close a given consistent cursor view for mysql and restore global read view
103
104
back to a transaction read view. */
104
105
UNIV_INTERN
105
106
void
106
107
read_cursor_view_close_for_mysql(
107
108
/*=============================*/
108
 
        trx_t*          trx,            /*!< in: trx */
109
 
        cursor_view_t*  curview);       /*!< in: cursor view to be closed */
110
 
/*********************************************************************//**
 
109
        trx_t*          trx,            /* in: trx */
 
110
        cursor_view_t*  curview);       /* in: cursor view to be closed */
 
111
/*************************************************************************
111
112
This function sets a given consistent cursor view to a transaction
112
113
read view if given consistent cursor view is not NULL. Otherwise, function
113
114
restores a global read view to a transaction read view. */
115
116
void
116
117
read_cursor_set_for_mysql(
117
118
/*======================*/
118
 
        trx_t*          trx,    /*!< in: transaction where cursor is set */
119
 
        cursor_view_t*  curview);/*!< in: consistent cursor view to be set */
 
119
        trx_t*          trx,    /* in: transaction where cursor is set */
 
120
        cursor_view_t*  curview);/* in: consistent cursor view to be set */
120
121
 
121
 
/** Read view lists the trx ids of those transactions for which a consistent
 
122
/* Read view lists the trx ids of those transactions for which a consistent
122
123
read should not see the modifications to the database. */
123
124
 
124
125
struct read_view_struct{
125
 
        ulint           type;   /*!< VIEW_NORMAL, VIEW_HIGH_GRANULARITY */
126
 
        undo_no_t       undo_no;/*!< 0 or if type is
127
 
                                VIEW_HIGH_GRANULARITY
 
126
        ulint   type;           /* VIEW_NORMAL, VIEW_HIGH_GRANULARITY */
 
127
        dulint  undo_no;        /* (0, 0) or if type is VIEW_HIGH_GRANULARITY
128
128
                                transaction undo_no when this high-granularity
129
129
                                consistent read view was created */
130
 
        trx_id_t        low_limit_no;
131
 
                                /*!< The view does not need to see the undo
 
130
        dulint  low_limit_no;   /* The view does not need to see the undo
132
131
                                logs for transactions whose transaction number
133
132
                                is strictly smaller (<) than this value: they
134
133
                                can be removed in purge if not needed by other
135
134
                                views */
136
 
        trx_id_t        low_limit_id;
137
 
                                /*!< The read should not see any transaction
138
 
                                with trx id >= this value. In other words,
139
 
                                this is the "high water mark". */
140
 
        trx_id_t        up_limit_id;
141
 
                                /*!< The read should see all trx ids which
142
 
                                are strictly smaller (<) than this value.
143
 
                                In other words,
144
 
                                this is the "low water mark". */
145
 
        ulint           n_trx_ids;
146
 
                                /*!< Number of cells in the trx_ids array */
147
 
        trx_id_t*       trx_ids;/*!< Additional trx ids which the read should
 
135
        dulint  low_limit_id;   /* The read should not see any transaction
 
136
                                with trx id >= this value */
 
137
        dulint  up_limit_id;    /* The read should see all trx ids which
 
138
                                are strictly smaller (<) than this value */
 
139
        ulint   n_trx_ids;      /* Number of cells in the trx_ids array */
 
140
        dulint* trx_ids;        /* Additional trx ids which the read should
148
141
                                not see: typically, these are the active
149
142
                                transactions at the time when the read is
150
143
                                serialized, except the reading transaction
151
144
                                itself; the trx ids in this array are in a
152
 
                                descending order. These trx_ids should be
153
 
                                between the "low" and "high" water marks,
154
 
                                that is, up_limit_id and low_limit_id. */
155
 
        trx_id_t        creator_trx_id;
156
 
                                /*!< trx id of creating transaction, or
157
 
                                0 used in purge */
 
145
                                descending order */
 
146
        dulint  creator_trx_id; /* trx id of creating transaction, or
 
147
                                (0, 0) used in purge */
158
148
        UT_LIST_NODE_T(read_view_t) view_list;
159
 
                                /*!< List of read views in trx_sys */
 
149
                                /* List of read views in trx_sys */
160
150
};
161
151
 
162
 
/** Read view types @{ */
163
 
#define VIEW_NORMAL             1       /*!< Normal consistent read view
 
152
/* Read view types */
 
153
#define VIEW_NORMAL             1       /* Normal consistent read view
164
154
                                        where transaction does not see changes
165
155
                                        made by active transactions except
166
156
                                        creating transaction. */
167
 
#define VIEW_HIGH_GRANULARITY   2       /*!< High-granularity read view where
 
157
#define VIEW_HIGH_GRANULARITY   2       /* High-granularity read view where
168
158
                                        transaction does not see changes
169
159
                                        made by active transactions and own
170
160
                                        changes after a point in time when this
171
161
                                        read view was created. */
172
 
/* @} */
173
162
 
174
 
/** Implement InnoDB framework to support consistent read views in
 
163
/* Implement InnoDB framework to support consistent read views in
175
164
cursors. This struct holds both heap where consistent read view
176
165
is allocated and pointer to a read view. */
177
166
 
178
167
struct cursor_view_struct{
179
168
        mem_heap_t*     heap;
180
 
                                /*!< Memory heap for the cursor view */
 
169
                                /* Memory heap for the cursor view */
181
170
        read_view_t*    read_view;
182
 
                                /*!< Consistent read view of the cursor*/
 
171
                                /* Consistent read view of the cursor*/
 
172
        ulint           n_mysql_tables_in_use;
 
173
                                /* number of Innobase tables used in the
 
174
                                processing of this cursor */
183
175
};
184
176
 
185
177
#ifndef UNIV_NONINL