MySQL 8.0.39
Source Code Documentation
mtr0types.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1995, 2024, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is designed to work with certain software (including
10but not limited to OpenSSL) that is licensed under separate terms,
11as designated in a particular file or component or in included license
12documentation. The authors of MySQL hereby grant you an additional
13permission to link the program and your derivative works with the
14separately licensed software that they have either included with
15the program or referenced in the documentation.
16
17This program is distributed in the hope that it will be useful, but WITHOUT
18ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20for more details.
21
22You should have received a copy of the GNU General Public License along with
23this program; if not, write to the Free Software Foundation, Inc.,
2451 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26*****************************************************************************/
27
28/** @file include/mtr0types.h
29 Mini-transaction buffer global types
30
31 Created 11/26/1995 Heikki Tuuri
32 *******************************************************/
33
34#ifndef mtr0types_h
35#define mtr0types_h
36
37#include "sync0rw.h"
38
39struct mtr_t;
40
41/** Logging modes for a mini-transaction */
43 /** Default mode: log all operations modifying disk-based data */
45
46 /** Log no operations and dirty pages are not added to the flush list */
48
49 /** Don't generate REDO log but add dirty pages to flush list */
51
52 /** Inserts are logged in a shorter form */
54
55 /** Last element */
57};
58
59/** @name Log item types
60The log items are declared 'byte' so that the compiler can warn if val
61and type parameters are switched in a call to mlog_write_ulint. NOTE!
62For 1 - 8 bytes, the flag value must give the length also! @{ */
64 /** if the mtr contains only one log record for one page,
65 i.e., write_initial_log_record has been called only once,
66 this flag is ORed to the type of that first log record */
68
69 /** one byte is written */
71
72 /** 2 bytes ... */
74
75 /** 4 bytes ... */
77
78 /** 8 bytes ... */
80
81 /** Record insert */
83
84 /** Mark clustered index record deleted */
86
87 /** Mark secondary index record deleted */
89
90 /** update of a record, preserves record field sizes */
92
93 /*!< Delete a record from a page */
95
96 /** Delete record list end on index page */
98
99 /** Delete record list start on index page */
101
102 /** Copy record list end to a new created index page */
104
105 /** Reorganize an index page in ROW_FORMAT=REDUNDANT */
107
108 /** Create an index page */
110
111 /** Insert entry in an undo log */
113
114 /** erase an undo log page end */
116
117 /** initialize a page in an undo log */
119
120 /** reuse an insert undo log header */
122
123 /** create an undo log header */
125
126 /** mark an index record as the predefined minimum record */
128
129 /** initialize an ibuf bitmap page */
131
132#ifdef UNIV_LOG_LSN_DEBUG
133 /** Current LSN */
134 MLOG_LSN = 28,
135#endif /* UNIV_LOG_LSN_DEBUG */
136
137 /** this means that a file page is taken into use and the prior
138 contents of the page should be ignored: in recovery we must not
139 trust the lsn values stored to the file page.
140 Note: it's deprecated because it causes crash recovery problem
141 in bulk create index, and actually we don't need to reset page
142 lsn in recv_recover_page_func() now. */
144
145 /** write a string to a page */
147
148 /** If a single mtr writes several log records, this log
149 record ends the sequence of these records */
151
152 /** dummy log record used to pad a log block full */
154
155 /** log record about creating an .ibd file, with format */
157
158 /** rename a tablespace file that starts with (space_id,page_no) */
160
161 /** delete a tablespace file that starts with (space_id,page_no) */
163
164 /** mark a compact index record as the predefined minimum record */
166
167 /** create a compact index page */
169
170 /** compact record insert */
172
173 /** mark compact clustered index record deleted */
175
176 /** mark compact secondary index record deleted; this log
177 record type is redundant, as MLOG_REC_SEC_DELETE_MARK is
178 independent of the record format. */
180
181 /** update of a compact record, preserves record field sizes */
183
184 /** delete a compact record from a page */
186
187 /** delete compact record list end on index page */
189
190 /*** delete compact record list start on index page */
192
193 /** copy compact record list end to a new created index page */
195
196 /** reorganize an index page */
198
199 /** write the node pointer of a record on a compressed
200 non-leaf B-tree page */
202
203 /** write the BLOB pointer of an externally stored column
204 on a compressed page */
206
207 /** write to compressed page header */
209
210 /** compress an index page */
212
213 /** compress an index page without logging it's image */
215
216 /** reorganize a compressed page */
218
219 /** Create a R-Tree index page */
221
222 /** create a R-tree compact page */
224
225 /** this means that a file page is taken into use.
226 We use it to replace MLOG_INIT_FILE_PAGE. */
228
229 /** Table is being truncated. (Marked only for file-per-table) */
230 /* MLOG_TRUNCATE = 60, Disabled for WL6378 */
231
232 /** notify that an index tree is being loaded without writing
233 redo log about individual pages */
235
236 /** log for some persistent dynamic metadata change */
238
239 /** create a SDI index page */
241
242 /** create a SDI compact page */
244
245 /** Extend the space */
247
248 /** Used in tests of redo log. It must never be used outside unit tests. */
250
261
262 /** biggest value (used in assertions) */
265
266/** @} */
267
268/** Types for the mlock objects to store in the mtr memo; NOTE that the
269first 3 values must be RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
272
274
276
278
279#ifdef UNIV_DEBUG
281#endif /* UNIV_DEBUG */
282
284
286
287 MTR_MEMO_SX_LOCK = 256
289
290inline const char *mtr_memo_type(const ulint type) {
291 switch (type) {
293 return "MTR_MEMO_PAGE_S_FIX";
295 return "MTR_MEMO_PAGE_X_FIX";
297 return "MTR_MEMO_PAGE_SX_FIX";
298 case MTR_MEMO_BUF_FIX:
299 return "MTR_MEMO_BUF_FIX";
300#ifdef UNIV_DEBUG
301 case MTR_MEMO_MODIFY:
302 return "MTR_MEMO_MODIFY";
303#endif /* UNIV_DEBUG */
304 case MTR_MEMO_S_LOCK:
305 return "MTR_MEMO_S_LOCK";
306 case MTR_MEMO_X_LOCK:
307 return "MTR_MEMO_X_LOCK";
308 case MTR_MEMO_SX_LOCK:
309 return "MTR_MEMO_SX_LOCK";
310 default:
311 ut_d(ut_error);
312 }
313 ut_o(return "MTR_MEMO_UNKNOWN");
314}
315
316#ifdef UNIV_DEBUG
317constexpr uint32_t MTR_MAGIC_N = 54551;
318#endif /* UNIV_DEBUG */
319
324 MTR_STATE_COMMITTED = 34676
326
327#endif /* mtr0types_h */
mlog_id_t
Definition: mtr0types.h:63
@ MLOG_BIGGEST_TYPE
biggest value (used in assertions)
Definition: mtr0types.h:263
@ MLOG_TABLE_DYNAMIC_META
log for some persistent dynamic metadata change
Definition: mtr0types.h:237
@ MLOG_PAGE_CREATE_RTREE
Create a R-Tree index page.
Definition: mtr0types.h:220
@ MLOG_ZIP_PAGE_REORGANIZE_8027
reorganize a compressed page
Definition: mtr0types.h:217
@ MLOG_COMP_PAGE_CREATE_RTREE
create a R-tree compact page
Definition: mtr0types.h:223
@ MLOG_4BYTES
4 bytes ...
Definition: mtr0types.h:76
@ MLOG_ZIP_WRITE_BLOB_PTR
write the BLOB pointer of an externally stored column on a compressed page
Definition: mtr0types.h:205
@ MLOG_PAGE_CREATE_SDI
create a SDI index page
Definition: mtr0types.h:240
@ MLOG_IBUF_BITMAP_INIT
initialize an ibuf bitmap page
Definition: mtr0types.h:130
@ MLOG_COMP_PAGE_CREATE
create a compact index page
Definition: mtr0types.h:168
@ MLOG_REC_INSERT
Definition: mtr0types.h:251
@ MLOG_COMP_REC_MIN_MARK
mark a compact index record as the predefined minimum record
Definition: mtr0types.h:165
@ MLOG_1BYTE
one byte is written
Definition: mtr0types.h:70
@ MLOG_REC_UPDATE_IN_PLACE
Definition: mtr0types.h:254
@ MLOG_FILE_RENAME
rename a tablespace file that starts with (space_id,page_no)
Definition: mtr0types.h:159
@ MLOG_INIT_FILE_PAGE2
this means that a file page is taken into use.
Definition: mtr0types.h:227
@ MLOG_MULTI_REC_END
If a single mtr writes several log records, this log record ends the sequence of these records.
Definition: mtr0types.h:150
@ MLOG_DUMMY_RECORD
dummy log record used to pad a log block full
Definition: mtr0types.h:153
@ MLOG_REC_MIN_MARK
mark an index record as the predefined minimum record
Definition: mtr0types.h:127
@ MLOG_TEST
Used in tests of redo log.
Definition: mtr0types.h:249
@ MLOG_FILE_DELETE
delete a tablespace file that starts with (space_id,page_no)
Definition: mtr0types.h:162
@ MLOG_REC_UPDATE_IN_PLACE_8027
update of a record, preserves record field sizes
Definition: mtr0types.h:91
@ MLOG_UNDO_HDR_CREATE
create an undo log header
Definition: mtr0types.h:124
@ MLOG_LIST_END_DELETE
Definition: mtr0types.h:259
@ MLOG_COMP_REC_UPDATE_IN_PLACE_8027
update of a compact record, preserves record field sizes
Definition: mtr0types.h:182
@ MLOG_LIST_START_DELETE
Definition: mtr0types.h:260
@ MLOG_REC_DELETE
Definition: mtr0types.h:253
@ MLOG_COMP_REC_DELETE_8027
delete a compact record from a page
Definition: mtr0types.h:185
@ MLOG_REC_INSERT_8027
Record insert.
Definition: mtr0types.h:82
@ MLOG_ZIP_PAGE_REORGANIZE
Definition: mtr0types.h:257
@ MLOG_FILE_CREATE
log record about creating an .ibd file, with format
Definition: mtr0types.h:156
@ MLOG_UNDO_ERASE_END
erase an undo log page end
Definition: mtr0types.h:115
@ MLOG_LIST_END_COPY_CREATED_8027
Copy record list end to a new created index page.
Definition: mtr0types.h:103
@ MLOG_PAGE_REORGANIZE_8027
Reorganize an index page in ROW_FORMAT=REDUNDANT.
Definition: mtr0types.h:106
@ MLOG_ZIP_PAGE_COMPRESS
compress an index page
Definition: mtr0types.h:211
@ MLOG_ZIP_PAGE_COMPRESS_NO_DATA
Definition: mtr0types.h:258
@ MLOG_PAGE_CREATE
Create an index page.
Definition: mtr0types.h:109
@ MLOG_COMP_REC_SEC_DELETE_MARK
mark compact secondary index record deleted; this log record type is redundant, as MLOG_REC_SEC_DELET...
Definition: mtr0types.h:179
@ MLOG_LIST_END_COPY_CREATED
Definition: mtr0types.h:255
@ MLOG_REC_CLUST_DELETE_MARK
Definition: mtr0types.h:252
@ MLOG_COMP_REC_CLUST_DELETE_MARK_8027
mark compact clustered index record deleted
Definition: mtr0types.h:174
@ MLOG_REC_SEC_DELETE_MARK
Mark secondary index record deleted.
Definition: mtr0types.h:88
@ MLOG_REC_CLUST_DELETE_MARK_8027
Mark clustered index record deleted.
Definition: mtr0types.h:85
@ MLOG_WRITE_STRING
write a string to a page
Definition: mtr0types.h:146
@ MLOG_ZIP_PAGE_COMPRESS_NO_DATA_8027
compress an index page without logging it's image
Definition: mtr0types.h:214
@ MLOG_INIT_FILE_PAGE
this means that a file page is taken into use and the prior contents of the page should be ignored: i...
Definition: mtr0types.h:143
@ MLOG_COMP_PAGE_CREATE_SDI
create a SDI compact page
Definition: mtr0types.h:243
@ MLOG_ZIP_WRITE_HEADER
write to compressed page header
Definition: mtr0types.h:208
@ MLOG_UNDO_HDR_REUSE
reuse an insert undo log header
Definition: mtr0types.h:121
@ MLOG_ZIP_WRITE_NODE_PTR
write the node pointer of a record on a compressed non-leaf B-tree page
Definition: mtr0types.h:201
@ MLOG_COMP_LIST_START_DELETE_8027
Definition: mtr0types.h:191
@ MLOG_PAGE_REORGANIZE
Definition: mtr0types.h:256
@ MLOG_COMP_LIST_END_DELETE_8027
delete compact record list end on index page
Definition: mtr0types.h:188
@ MLOG_SINGLE_REC_FLAG
if the mtr contains only one log record for one page, i.e., write_initial_log_record has been called ...
Definition: mtr0types.h:67
@ MLOG_REC_DELETE_8027
Definition: mtr0types.h:94
@ MLOG_UNDO_INSERT
Insert entry in an undo log.
Definition: mtr0types.h:112
@ MLOG_COMP_LIST_END_COPY_CREATED_8027
copy compact record list end to a new created index page
Definition: mtr0types.h:194
@ MLOG_LIST_START_DELETE_8027
Delete record list start on index page.
Definition: mtr0types.h:100
@ MLOG_8BYTES
8 bytes ...
Definition: mtr0types.h:79
@ MLOG_LIST_END_DELETE_8027
Delete record list end on index page.
Definition: mtr0types.h:97
@ MLOG_2BYTES
2 bytes ...
Definition: mtr0types.h:73
@ MLOG_FILE_EXTEND
Extend the space.
Definition: mtr0types.h:246
@ MLOG_INDEX_LOAD
Table is being truncated.
Definition: mtr0types.h:234
@ MLOG_COMP_REC_INSERT_8027
compact record insert
Definition: mtr0types.h:171
@ MLOG_COMP_PAGE_REORGANIZE_8027
reorganize an index page
Definition: mtr0types.h:197
@ MLOG_UNDO_INIT
initialize a page in an undo log
Definition: mtr0types.h:118
constexpr uint32_t MTR_MAGIC_N
Definition: mtr0types.h:317
const char * mtr_memo_type(const ulint type)
Definition: mtr0types.h:290
mtr_log_t
Logging modes for a mini-transaction.
Definition: mtr0types.h:42
@ MTR_LOG_NONE
Log no operations and dirty pages are not added to the flush list.
Definition: mtr0types.h:47
@ MTR_LOG_ALL
Default mode: log all operations modifying disk-based data.
Definition: mtr0types.h:44
@ MTR_LOG_SHORT_INSERTS
Inserts are logged in a shorter form.
Definition: mtr0types.h:53
@ MTR_LOG_NO_REDO
Don't generate REDO log but add dirty pages to flush list.
Definition: mtr0types.h:50
@ MTR_LOG_MODE_MAX
Last element.
Definition: mtr0types.h:56
mtr_state_t
Definition: mtr0types.h:320
@ MTR_STATE_COMMITTING
Definition: mtr0types.h:323
@ MTR_STATE_ACTIVE
Definition: mtr0types.h:322
@ MTR_STATE_INIT
Definition: mtr0types.h:321
@ MTR_STATE_COMMITTED
Definition: mtr0types.h:324
mtr_memo_type_t
Types for the mlock objects to store in the mtr memo; NOTE that the first 3 values must be RW_S_LATCH...
Definition: mtr0types.h:270
@ MTR_MEMO_X_LOCK
Definition: mtr0types.h:285
@ MTR_MEMO_PAGE_X_FIX
Definition: mtr0types.h:273
@ MTR_MEMO_S_LOCK
Definition: mtr0types.h:283
@ MTR_MEMO_SX_LOCK
Definition: mtr0types.h:287
@ MTR_MEMO_BUF_FIX
Definition: mtr0types.h:277
@ MTR_MEMO_PAGE_S_FIX
Definition: mtr0types.h:271
@ MTR_MEMO_PAGE_SX_FIX
Definition: mtr0types.h:275
@ MTR_MEMO_MODIFY
Definition: mtr0types.h:280
required string type
Definition: replication_group_member_actions.proto:34
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:177
The read-write lock (for threads, not for database transactions)
@ RW_SX_LATCH
Definition: sync0rw.h:97
@ RW_NO_LATCH
Definition: sync0rw.h:98
@ RW_X_LATCH
Definition: sync0rw.h:96
@ RW_S_LATCH
Definition: sync0rw.h:95
unsigned long int ulint
Definition: univ.i:406
#define ut_error
Abort execution.
Definition: ut0dbg.h:65
#define ut_o(EXPR)
Opposite of ut_d().
Definition: ut0dbg.h:73
#define ut_d(EXPR)
Debug statement.
Definition: ut0dbg.h:71