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