drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
trx0rseg.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (C) 1996, 2011, Innobase Oy. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15St, Fifth Floor, Boston, MA 02110-1301 USA
16
17*****************************************************************************/
18
19/**************************************************/
25
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/******************************************************************/
37UNIV_INLINE
40/*==========*/
41 ulint space,
42 ulint zip_size,
44 ulint page_no,
45 mtr_t* mtr);
46/******************************************************************/
49UNIV_INLINE
52/*==============*/
53 ulint space,
54 ulint zip_size,
56 ulint page_no,
57 mtr_t* mtr);
58/***************************************************************/
61UNIV_INLINE
62ulint
64/*===================*/
65 trx_rsegf_t* rsegf,
66 ulint n,
67 mtr_t* mtr);
68/***************************************************************/
70UNIV_INLINE
71void
73/*===================*/
74 trx_rsegf_t* rsegf,
75 ulint n,
76 ulint page_no,
77 mtr_t* mtr);
78/****************************************************************/
81UNIV_INLINE
82ulint
84/*=====================*/
85 trx_rsegf_t* rsegf,
86 mtr_t* mtr);
87/******************************************************************/
90UNIV_INTERN
93/*===============*/
94 ulint id);
95/****************************************************************/
99UNIV_INTERN
100ulint
102/*===================*/
103 ulint space,
104 ulint zip_size,
106 ulint max_size,
107 ulint rseg_slot_no,
108 mtr_t* mtr);
109/*********************************************************************/
112UNIV_INTERN
113void
115/*=========================*/
116 trx_sysf_t* sys_header,
117 ib_bh_t* ib_bh,
118 mtr_t* mtr);
119
120/***************************************************************************
121Free's an instance of the rollback segment in memory. */
122UNIV_INTERN
123void
125/*==============*/
126 trx_rseg_t* rseg); /* in, own: instance to free */
127
128/*********************************************************************
129Creates a rollback segment. */
130UNIV_INTERN
132trx_rseg_create(void);
133/*==================*/
134
135/* Number of undo log slots in a rollback segment file copy */
136#define TRX_RSEG_N_SLOTS (UNIV_PAGE_SIZE / 16)
137
138/* Maximum number of transactions supported by a single rollback segment */
139#define TRX_RSEG_MAX_N_TRXS (TRX_RSEG_N_SLOTS / 2)
140
141/* The rollback segment memory object */
143 /*--------------------------------------------------------*/
144 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 /*--------------------------------------------------------*/
180 /*--------------------------------------------------------*/
181 UT_LIST_NODE_T(trx_rseg_t) rseg_list;
182 /* the list of the rollback segment
183 memory objects */
184};
185
191
192typedef struct rseg_queue_struct rseg_queue_t;
193
194/* Undo log segment slot in a rollback segment header */
195/*-------------------------------------------------------------*/
196#define TRX_RSEG_SLOT_PAGE_NO 0 /* Page number of the header page of
197 an undo log segment */
198/*-------------------------------------------------------------*/
199/* Slot size */
200#define TRX_RSEG_SLOT_SIZE 4
201
202/* The offset of the rollback segment header on its page */
203#define TRX_RSEG FSEG_PAGE_DATA
204
205/* Transaction rollback segment header */
206/*-------------------------------------------------------------*/
207#define TRX_RSEG_MAX_SIZE 0 /* Maximum allowed size for rollback
208 segment in pages */
209#define TRX_RSEG_HISTORY_SIZE 4 /* Number of file pages occupied
210 by the logs in the history list */
211#define TRX_RSEG_HISTORY 8 /* The update undo logs for committed
212 transactions */
213#define TRX_RSEG_FSEG_HEADER (8 + FLST_BASE_NODE_SIZE)
214 /* Header for the file segment where
215 this page is placed */
216#define TRX_RSEG_UNDO_SLOTS (8 + FLST_BASE_NODE_SIZE + FSEG_HEADER_SIZE)
217 /* Undo log segment slots */
218/*-------------------------------------------------------------*/
219
220#ifndef UNIV_NONINL
221#include "trx0rseg.ic"
222#endif
223
224#endif
trx_id_t trx_no
Definition trx0rseg.h:188
trx_rseg_t * rseg
Definition trx0rseg.h:189
ibool last_del_marks
Definition trx0rseg.h:178
ulint last_offset
Definition trx0rseg.h:174
trx_id_t last_trx_no
Definition trx0rseg.h:176
mutex_t mutex
Definition trx0rseg.h:146
ulint last_page_no
Definition trx0rseg.h:171
#define mutex_t
Definition sync0types.h:31
UNIV_INLINE trx_rsegf_t * trx_rsegf_get_new(ulint space, ulint zip_size, ulint page_no, mtr_t *mtr)
UNIV_INLINE ulint trx_rsegf_undo_find_free(trx_rsegf_t *rsegf, mtr_t *mtr)
UNIV_INTERN trx_rseg_t * trx_rseg_get_on_id(ulint id)
Definition trx0rseg.cc:47
UNIV_INLINE void trx_rsegf_set_nth_undo(trx_rsegf_t *rsegf, ulint n, ulint page_no, mtr_t *mtr)
UNIV_INTERN ulint trx_rseg_header_create(ulint space, ulint zip_size, ulint max_size, ulint rseg_slot_no, mtr_t *mtr)
Definition trx0rseg.cc:68
UNIV_INLINE trx_rsegf_t * trx_rsegf_get(ulint space, ulint zip_size, ulint page_no, mtr_t *mtr)
UNIV_INLINE ulint trx_rsegf_get_nth_undo(trx_rsegf_t *rsegf, ulint n, mtr_t *mtr)
UNIV_INTERN void trx_rseg_list_and_array_init(trx_sysf_t *sys_header, ib_bh_t *ib_bh, mtr_t *mtr)
Definition trx0rseg.cc:365
UNIV_INTERN void trx_rseg_mem_free(trx_rseg_t *rseg)
Definition trx0rseg.cc:135
byte trx_rsegf_t
Definition trx0types.h:103
ib_id_t trx_id_t
Definition trx0types.h:85
struct trx_undo_struct trx_undo_t
Definition trx0types.h:52
byte trx_sysf_t
Definition trx0types.h:101
struct trx_rseg_struct trx_rseg_t
Definition trx0types.h:50
#define UT_LIST_NODE_T(TYPE)
Definition ut0lst.h:73
#define UT_LIST_BASE_NODE_T(TYPE)
Definition ut0lst.h:54