MySQL 26.7.0
Source Code Documentation
mtr0types.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1995, 2026, 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 /** deprecated */
133 /* MLOG_LSN = 28, */
134
135 /** this means that a file page is taken into use and the prior
136 contents of the page should be ignored: in recovery we must not
137 trust the lsn values stored to the file page.
138 Note: it's deprecated because it causes crash recovery problem
139 in bulk create index, and actually we don't need to reset page
140 lsn in recv_recover_page_func() now. */
142
143 /** write a string to a page */
145
146 /** If a single mtr writes several log records, this log
147 record ends the sequence of these records */
149
150 /** dummy log record used to pad a log block full */
152
153 /** log record about creating an .ibd file, with format */
155
156 /** rename a tablespace file that starts with (space_id,page_no) */
158
159 /** delete a tablespace file that starts with (space_id,page_no) */
161
162 /** mark a compact index record as the predefined minimum record */
164
165 /** create a compact index page */
167
168 /** compact record insert */
170
171 /** mark compact clustered index record deleted */
173
174 /** mark compact secondary index record deleted; this log
175 record type is redundant, as MLOG_REC_SEC_DELETE_MARK is
176 independent of the record format. */
178
179 /** update of a compact record, preserves record field sizes */
181
182 /** delete a compact record from a page */
184
185 /** delete compact record list end on index page */
187
188 /*** delete compact record list start on index page */
190
191 /** copy compact record list end to a new created index page */
193
194 /** reorganize an index page */
196
197 /** write the node pointer of a record on a compressed
198 non-leaf B-tree page */
200
201 /** write the BLOB pointer of an externally stored column
202 on a compressed page */
204
205 /** write to compressed page header */
207
208 /** compress an index page */
210
211 /** compress an index page without logging it's image */
213
214 /** reorganize a compressed page */
216
217 /** Create a R-Tree index page */
219
220 /** create a R-tree compact page */
222
223 /** this means that a file page is taken into use.
224 We use it to replace MLOG_INIT_FILE_PAGE. */
226
227 /** Table is being truncated. (Marked only for file-per-table) */
228 /* MLOG_TRUNCATE = 60, Disabled for WL6378 */
229
230 /** notify that an index tree is being loaded without writing
231 redo log about individual pages */
233
234 /** log for some persistent dynamic metadata change */
236
237 /** create a SDI index page */
239
240 /** create a SDI compact page */
242
243 /** Extend the space */
245
246 /** Used in tests of redo log. It must never be used outside unit tests. */
248
249 /** Record insert */
251
252 /** Mark clustered index record deleted */
254
255 /** Delete a record from a page */
257
258 /** update of a record, preserves record field sizes */
260
261 /** Copy record list end to a new created index page */
263
264 /** Reorganize an index page in ROW_FORMAT=REDUNDANT */
266
267 /** reorganize a compressed page */
269
270 /** compress an index page without logging it's image */
272
273 /** Delete record list end on index page */
275
276 /** Delete record list start on index page */
278
279 /** biggest value (used in assertions) */
282
283/** @} */
284
285/** Types for the mlock objects to store in the mtr memo; NOTE that the
286first 3 values must be RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
289
291
293
295
296#ifdef UNIV_DEBUG
298#endif /* UNIV_DEBUG */
299
301
303
304 MTR_MEMO_SX_LOCK = 256
306
307inline const char *mtr_memo_type(const ulint type) {
308 switch (type) {
310 return "MTR_MEMO_PAGE_S_FIX";
312 return "MTR_MEMO_PAGE_X_FIX";
314 return "MTR_MEMO_PAGE_SX_FIX";
315 case MTR_MEMO_BUF_FIX:
316 return "MTR_MEMO_BUF_FIX";
317#ifdef UNIV_DEBUG
318 case MTR_MEMO_MODIFY:
319 return "MTR_MEMO_MODIFY";
320#endif /* UNIV_DEBUG */
321 case MTR_MEMO_S_LOCK:
322 return "MTR_MEMO_S_LOCK";
323 case MTR_MEMO_X_LOCK:
324 return "MTR_MEMO_X_LOCK";
325 case MTR_MEMO_SX_LOCK:
326 return "MTR_MEMO_SX_LOCK";
327 default:
328 ut_d(ut_error);
329 }
330 ut_o(return "MTR_MEMO_UNKNOWN");
331}
332
333#ifdef UNIV_DEBUG
334constexpr uint32_t MTR_MAGIC_N = 54551;
335#endif /* UNIV_DEBUG */
336
341 MTR_STATE_COMMITTED = 34676
343
344#endif /* mtr0types_h */
mlog_id_t
Definition: mtr0types.h:63
@ OBSOLETE_MLOG_ZIP_PAGE_COMPRESS_NO_DATA_8027
compress an index page without logging it's image
Definition: mtr0types.h:212
@ MLOG_BIGGEST_TYPE
biggest value (used in assertions)
Definition: mtr0types.h:280
@ MLOG_TABLE_DYNAMIC_META
log for some persistent dynamic metadata change
Definition: mtr0types.h:235
@ MLOG_PAGE_CREATE_RTREE
Create a R-Tree index page.
Definition: mtr0types.h:218
@ MLOG_COMP_PAGE_CREATE_RTREE
create a R-tree compact page
Definition: mtr0types.h:221
@ OBSOLETE_MLOG_COMP_REC_DELETE_8027
delete a compact record from a page
Definition: mtr0types.h:183
@ OBSOLETE_MLOG_COMP_REC_UPDATE_IN_PLACE_8027
update of a compact record, preserves record field sizes
Definition: mtr0types.h:180
@ MLOG_4BYTES
4 bytes ...
Definition: mtr0types.h:76
@ OBSOLETE_MLOG_ZIP_PAGE_REORGANIZE_8027
reorganize a compressed page
Definition: mtr0types.h:215
@ MLOG_ZIP_WRITE_BLOB_PTR
write the BLOB pointer of an externally stored column on a compressed page
Definition: mtr0types.h:203
@ MLOG_PAGE_CREATE_SDI
create a SDI index page
Definition: mtr0types.h:238
@ OBSOLETE_MLOG_LIST_START_DELETE_8027
Delete record list start on index page.
Definition: mtr0types.h:100
@ 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:166
@ MLOG_REC_INSERT
Record insert.
Definition: mtr0types.h:250
@ MLOG_COMP_REC_MIN_MARK
mark a compact index record as the predefined minimum record
Definition: mtr0types.h:163
@ MLOG_1BYTE
one byte is written
Definition: mtr0types.h:70
@ OBSOLETE_MLOG_LIST_END_COPY_CREATED_8027
Copy record list end to a new created index page.
Definition: mtr0types.h:103
@ MLOG_REC_UPDATE_IN_PLACE
update of a record, preserves record field sizes
Definition: mtr0types.h:259
@ MLOG_FILE_RENAME
rename a tablespace file that starts with (space_id,page_no)
Definition: mtr0types.h:157
@ MLOG_INIT_FILE_PAGE2
this means that a file page is taken into use.
Definition: mtr0types.h:225
@ OBSOLETE_MLOG_REC_CLUST_DELETE_MARK_8027
Mark clustered index record deleted.
Definition: mtr0types.h:85
@ OBSOLETE_MLOG_COMP_LIST_START_DELETE_8027
Definition: mtr0types.h:189
@ MLOG_MULTI_REC_END
If a single mtr writes several log records, this log record ends the sequence of these records.
Definition: mtr0types.h:148
@ MLOG_DUMMY_RECORD
dummy log record used to pad a log block full
Definition: mtr0types.h:151
@ 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:247
@ OBSOLETE_MLOG_COMP_REC_INSERT_8027
compact record insert
Definition: mtr0types.h:169
@ MLOG_FILE_DELETE
delete a tablespace file that starts with (space_id,page_no)
Definition: mtr0types.h:160
@ MLOG_UNDO_HDR_CREATE
create an undo log header
Definition: mtr0types.h:124
@ MLOG_LIST_END_DELETE
Delete record list end on index page.
Definition: mtr0types.h:274
@ MLOG_LIST_START_DELETE
Delete record list start on index page.
Definition: mtr0types.h:277
@ MLOG_REC_DELETE
Delete a record from a page.
Definition: mtr0types.h:256
@ OBSOLETE_MLOG_COMP_LIST_END_COPY_CREATED_8027
copy compact record list end to a new created index page
Definition: mtr0types.h:192
@ OBSOLETE_MLOG_COMP_PAGE_REORGANIZE_8027
reorganize an index page
Definition: mtr0types.h:195
@ OBSOLETE_MLOG_PAGE_REORGANIZE_8027
Reorganize an index page in ROW_FORMAT=REDUNDANT.
Definition: mtr0types.h:106
@ MLOG_ZIP_PAGE_REORGANIZE
reorganize a compressed page
Definition: mtr0types.h:268
@ MLOG_FILE_CREATE
log record about creating an .ibd file, with format
Definition: mtr0types.h:154
@ MLOG_UNDO_ERASE_END
erase an undo log page end
Definition: mtr0types.h:115
@ OBSOLETE_MLOG_REC_DELETE_8027
Delete a record from a page.
Definition: mtr0types.h:94
@ MLOG_ZIP_PAGE_COMPRESS
compress an index page
Definition: mtr0types.h:209
@ MLOG_ZIP_PAGE_COMPRESS_NO_DATA
compress an index page without logging it's image
Definition: mtr0types.h:271
@ MLOG_PAGE_CREATE
Create an index page.
Definition: mtr0types.h:109
@ MLOG_LIST_END_COPY_CREATED
Copy record list end to a new created index page.
Definition: mtr0types.h:262
@ MLOG_REC_CLUST_DELETE_MARK
Mark clustered index record deleted.
Definition: mtr0types.h:253
@ MLOG_REC_SEC_DELETE_MARK
Mark secondary index record deleted.
Definition: mtr0types.h:88
@ OBSOLETE_MLOG_COMP_LIST_END_DELETE_8027
delete compact record list end on index page
Definition: mtr0types.h:186
@ OBSOLETE_MLOG_COMP_REC_CLUST_DELETE_MARK_8027
mark compact clustered index record deleted
Definition: mtr0types.h:172
@ MLOG_WRITE_STRING
write a string to a page
Definition: mtr0types.h:144
@ MLOG_INIT_FILE_PAGE
deprecated
Definition: mtr0types.h:141
@ OBSOLETE_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:177
@ MLOG_COMP_PAGE_CREATE_SDI
create a SDI compact page
Definition: mtr0types.h:241
@ MLOG_ZIP_WRITE_HEADER
write to compressed page header
Definition: mtr0types.h:206
@ OBSOLETE_MLOG_LIST_END_DELETE_8027
Delete record list end on index page.
Definition: mtr0types.h:97
@ OBSOLETE_MLOG_REC_UPDATE_IN_PLACE_8027
update of a record, preserves record field sizes
Definition: mtr0types.h:91
@ 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:199
@ MLOG_PAGE_REORGANIZE
Reorganize an index page in ROW_FORMAT=REDUNDANT.
Definition: mtr0types.h:265
@ 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
@ OBSOLETE_MLOG_REC_INSERT_8027
Record insert.
Definition: mtr0types.h:82
@ MLOG_UNDO_INSERT
Insert entry in an undo log.
Definition: mtr0types.h:112
@ MLOG_8BYTES
8 bytes ...
Definition: mtr0types.h:79
@ MLOG_2BYTES
2 bytes ...
Definition: mtr0types.h:73
@ MLOG_FILE_EXTEND
Extend the space.
Definition: mtr0types.h:244
@ MLOG_INDEX_LOAD
Table is being truncated.
Definition: mtr0types.h:232
@ MLOG_UNDO_INIT
initialize a page in an undo log
Definition: mtr0types.h:118
constexpr uint32_t MTR_MAGIC_N
Definition: mtr0types.h:334
const char * mtr_memo_type(const ulint type)
Definition: mtr0types.h:307
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:337
@ MTR_STATE_COMMITTING
Definition: mtr0types.h:340
@ MTR_STATE_ACTIVE
Definition: mtr0types.h:339
@ MTR_STATE_INIT
Definition: mtr0types.h:338
@ MTR_STATE_COMMITTED
Definition: mtr0types.h:341
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:287
@ MTR_MEMO_X_LOCK
Definition: mtr0types.h:302
@ MTR_MEMO_PAGE_X_FIX
Definition: mtr0types.h:290
@ MTR_MEMO_S_LOCK
Definition: mtr0types.h:300
@ MTR_MEMO_SX_LOCK
Definition: mtr0types.h:304
@ MTR_MEMO_BUF_FIX
Definition: mtr0types.h:294
@ MTR_MEMO_PAGE_S_FIX
Definition: mtr0types.h:288
@ MTR_MEMO_PAGE_SX_FIX
Definition: mtr0types.h:292
@ MTR_MEMO_MODIFY
Definition: mtr0types.h:297
required string type
Definition: replication_group_member_actions.proto:34
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:174
The read-write lock (for threads, not for database transactions)
@ RW_SX_LATCH
Definition: sync0rw.h:99
@ RW_NO_LATCH
Definition: sync0rw.h:100
@ RW_X_LATCH
Definition: sync0rw.h:98
@ RW_S_LATCH
Definition: sync0rw.h:97
unsigned long int ulint
Definition: univ.i:403
#define ut_error
Abort execution.
Definition: ut0dbg.h:105
#define ut_o(EXPR)
Opposite of ut_d().
Definition: ut0dbg.h:113
#define ut_d(EXPR)
Debug statement.
Definition: ut0dbg.h:111