Drizzled Public API Documentation

trx0rseg.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (C) 1996, 2010, Innobase Oy. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
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
16 
17 *****************************************************************************/
18 
19 /**************************************************/
26 #pragma once
27 #ifndef trx0rseg_h
28 #define trx0rseg_h
29 
30 #include "univ.i"
31 #include "trx0types.h"
32 #include "trx0sys.h"
33 
34 /******************************************************************/
37 UNIV_INLINE
40 /*==========*/
41  ulint space,
42  ulint zip_size,
44  ulint page_no,
45  mtr_t* mtr);
46 /******************************************************************/
49 UNIV_INLINE
52 /*==============*/
53  ulint space,
54  ulint zip_size,
56  ulint page_no,
57  mtr_t* mtr);
58 /***************************************************************/
61 UNIV_INLINE
62 ulint
64 /*===================*/
65  trx_rsegf_t* rsegf,
66  ulint n,
67  mtr_t* mtr);
68 /***************************************************************/
70 UNIV_INLINE
71 void
73 /*===================*/
74  trx_rsegf_t* rsegf,
75  ulint n,
76  ulint page_no,
77  mtr_t* mtr);
78 /****************************************************************/
81 UNIV_INLINE
82 ulint
84 /*=====================*/
85  trx_rsegf_t* rsegf,
86  mtr_t* mtr);
87 /******************************************************************/
90 UNIV_INTERN
93 /*===============*/
94  ulint id);
95 /****************************************************************/
99 UNIV_INTERN
100 ulint
102 /*===================*/
103  ulint space,
104  ulint zip_size,
106  ulint max_size,
107  ulint rseg_slot_no,
108  mtr_t* mtr);
109 /*********************************************************************/
112 UNIV_INTERN
113 void
115 /*=========================*/
116  trx_sysf_t* sys_header,
117  mtr_t* mtr);
118 /***************************************************************************
119 Free's an instance of the rollback segment in memory. */
120 UNIV_INTERN
121 void
123 /*==============*/
124  trx_rseg_t* rseg); /* in, own: instance to free */
125 
126 /*********************************************************************
127 Creates a rollback segment. */
128 UNIV_INTERN
129 trx_rseg_t*
130 trx_rseg_create(void);
131 /*==================*/
132 
133 /* Number of undo log slots in a rollback segment file copy */
134 #define TRX_RSEG_N_SLOTS (UNIV_PAGE_SIZE / 16)
135 
136 /* Maximum number of transactions supported by a single rollback segment */
137 #define TRX_RSEG_MAX_N_TRXS (TRX_RSEG_N_SLOTS / 2)
138 
139 /* The rollback segment memory object */
141  /*--------------------------------------------------------*/
142  ulint id;
148  ulint space;
150  ulint zip_size;/* compressed page size of space
151  in bytes, or 0 for uncompressed spaces */
152  ulint page_no;/* page number of the rollback segment
153  header */
154  ulint max_size;/* maximum allowed size in pages */
155  ulint curr_size;/* current size in pages */
156  /*--------------------------------------------------------*/
157  /* Fields for update undo logs */
158  UT_LIST_BASE_NODE_T(trx_undo_t) update_undo_list;
159  /* List of update undo logs */
160  UT_LIST_BASE_NODE_T(trx_undo_t) update_undo_cached;
161  /* List of update undo log segments
162  cached for fast reuse */
163  /*--------------------------------------------------------*/
164  /* Fields for insert undo logs */
165  UT_LIST_BASE_NODE_T(trx_undo_t) insert_undo_list;
166  /* List of insert undo logs */
167  UT_LIST_BASE_NODE_T(trx_undo_t) insert_undo_cached;
168  /* List of insert undo log segments
169  cached for fast reuse */
170  /*--------------------------------------------------------*/
171  ulint last_page_no;
174  ulint last_offset;
180  /*--------------------------------------------------------*/
181  UT_LIST_NODE_T(trx_rseg_t) rseg_list;
182  /* the list of the rollback segment
183  memory objects */
184 };
185 
186 /* Undo log segment slot in a rollback segment header */
187 /*-------------------------------------------------------------*/
188 #define TRX_RSEG_SLOT_PAGE_NO 0 /* Page number of the header page of
189  an undo log segment */
190 /*-------------------------------------------------------------*/
191 /* Slot size */
192 #define TRX_RSEG_SLOT_SIZE 4
193 
194 /* The offset of the rollback segment header on its page */
195 #define TRX_RSEG FSEG_PAGE_DATA
196 
197 /* Transaction rollback segment header */
198 /*-------------------------------------------------------------*/
199 #define TRX_RSEG_MAX_SIZE 0 /* Maximum allowed size for rollback
200  segment in pages */
201 #define TRX_RSEG_HISTORY_SIZE 4 /* Number of file pages occupied
202  by the logs in the history list */
203 #define TRX_RSEG_HISTORY 8 /* The update undo logs for committed
204  transactions */
205 #define TRX_RSEG_FSEG_HEADER (8 + FLST_BASE_NODE_SIZE)
206  /* Header for the file segment where
207  this page is placed */
208 #define TRX_RSEG_UNDO_SLOTS (8 + FLST_BASE_NODE_SIZE + FSEG_HEADER_SIZE)
209  /* Undo log segment slots */
210 /*-------------------------------------------------------------*/
211 
212 #ifndef UNIV_NONINL
213 #include "trx0rseg.ic"
214 #endif
215 
216 #endif