MySQL 9.1.0
Source Code Documentation
log0constants.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/**************************************************/ /**
29 @file include/log0constants.h
30
31 Redo log constant values. This file should not be included
32 except the include in log0types.h.
33
34 Include log0types.h if you needed to use constants.
35
36 *******************************************************/
37
38#ifndef log0constants_h
39#define log0constants_h
40
41/* lsn_t, sn_t, Log_file_id */
42#include "log0types.h"
43
44/* os_offset_t, OS_FILE_LOG_BLOCK_SIZE */
45#include "os0file.h"
46
47/* UINT32_MAX */
48#include <cstdint>
49
50/** Align the log buffer (log_t::buf) to this size. This is to preserve the
51compatibility with older MySQL versions which also aligned the log buffer
52to OS_FILE_LOG_BLOCK_SIZE. Note, that each write from the log buffer starts
53at the beginning of one of the blocks in this buffer i.e. from address being
54a multiple of OS_FILE_LOG_BLOCK_SIZE. Therefore any bigger value for alignment
55here does not make sense. Please do not use this constant for other buffers. */
57
58/** Align the log write-ahead buffer (log_t::write_ahead_buf) to this size.
59This increases chance that the write-ahead buffer is spanned over smaller
60number of memory pages. Please do not use this constant for other buffers. */
63
64/**************************************************/ /**
65
66 @name Log constants related to the log file i-nodes.
67
68 *******************************************************/
69
70/** @{ */
71
72/** Name of subdirectory which contains redo log files. */
73constexpr const char *const LOG_DIRECTORY_NAME = "#innodb_redo";
74
75/** Prefix of log file name in the current redo format. */
76constexpr const char *const LOG_FILE_BASE_NAME = "#ib_redo";
77
78/** Maximum length of log file name, computed as: base name length(8)
79+ length for decimal digits(22). */
80constexpr uint32_t LOG_FILE_NAME_MAX_LENGTH = 8 + 22;
81
82/** Targeted number of log files. */
83constexpr size_t LOG_N_FILES = 32;
84
85/** Determines maximum downsize for maximum redo file size during resize.
86If maximum file size is 8G, then 1.0/8 means, that InnoDB needs to first
87achieve maximum file size equal to 1G before targeting even lower values. */
88constexpr double LOG_N_FILES_MAX_DOWNSIZE_RATIO = 1.0 / 8;
89
90/** Minimum size of single log file, expressed in bytes. */
91constexpr os_offset_t LOG_FILE_MIN_SIZE = 64 * 1024;
92
93/** Minimum allowed value for innodb_redo_log_capacity. */
94constexpr os_offset_t LOG_CAPACITY_MIN = 8 * 1024 * 1024; /* 8M */
95
96/** Maximum allowed value for innodb_redo_log_capacity. */
97constexpr os_offset_t LOG_CAPACITY_MAX = 512ull * 1024 * 1024 * 1024; /* 512G */
98
99static_assert(LOG_CAPACITY_MAX % LOG_N_FILES == 0,
100 "A valid log size can be created with LOG_N_FILES");
101
102/** Maximum size of a log file, expressed in bytes. */
104
105/** Id of the first redo log file (assigned to the first log file
106when new data directory is being initialized). */
108
109/** Maximum number of handles for opened redo log files (in parallel).
110The following handles for opened files have been identified during runtime:
111 - protected by the log_writer_mutex and the log_flusher_mutex:
112 - log_writer() and log_flusher() use log.m_current_file_handle
113 and this handle represents one file and can only be switched
114 to the next file if both mutexes are acquired,
115 - if redo log file is being rewritten, the read_handle for the old
116 file acts on behalf of m_current_file_handle which is closed before
117 the read_handle is opened.
118 - protected by the log_files_mutex:
119 - log_files_next_checkpoint() uses handle on stack,
120 - log_files_prepare_unused_file() uses handle on stack,
121 - log_encryption_write_low() uses handle on stack,
122 - if redo log file is being rewritten, the write_handle for the new
123 file uses this slot (protected by the files_mutex); it is opened
124 after log_files_prepare_unused_file() closed its handle.
125During startup - in main thread (recv functions):
126 - log_files_find_and_analyze() uses handle on stack,
127 - recv_log_recover_pre_8_0_30() uses handle on stack,
128 - recv_find_max_checkpoint() uses handle on stack,
129 - recv_read_log_seg() uses handle on stack,
130 - recv_recovery_from_checkpoint_start() uses handle on stack but
131 after the recv_find_max_checkpoint() is finished and before
132 the recv_read_log_seg() is started.
133Redo threads are started after the recv_recovery_from_checkpoint_start() is
134finished, so they don't use handle in parallel with these recv functions. */
135constexpr size_t LOG_MAX_OPEN_FILES = 2;
136
137/** @} */
138
139/**************************************************/ /**
140
141 @name Log constants related to the log file format.
142
143 *******************************************************/
144
145/** @{ */
146
147/* General constants describing the log file format. */
148
149/** Magic value to use instead of log checksums when they are disabled. */
150constexpr uint32_t LOG_NO_CHECKSUM_MAGIC = 0xDEADBEEFUL;
151
152/** The counting of lsn's starts from this value: this must be non-zero. */
154
155/** Maximum possible lsn value is slightly higher than the maximum sn value,
156because lsn sequence enumerates also bytes used for headers and footers of
157all log blocks. However, still 64-bits are enough to represent the maximum
158lsn value, because only 63 bits are used to represent sn value. */
159constexpr lsn_t LSN_MAX = (1ULL << 63) - 1;
160
161/** The sn bit to express locked state. */
162constexpr sn_t SN_LOCKED = 1ULL << 63;
163
164/** First checkpoint field in the log header. We write alternately to
165the checkpoint fields when we make new checkpoints. This field is only
166defined in the first log file. */
168
169/** Log Encryption information in redo log header. */
171
172/** Second checkpoint field in the header of the first log file. */
174
175/** Size of log file's header. */
177
178/* Offsets used in a log file header */
179
180/** Log file header format identifier (32-bit unsigned big-endian integer).
181This used to be called LOG_GROUP_ID and always written as 0,
182because InnoDB never supported more than one copy of the redo log. */
184
185/** Offset within the log file header, to the field which stores the log_uuid.
186The log_uuid is chosen after a new data directory is initialized, and allows
187to detect situation, in which some of log files came from other data directory
188(detection is performed on startup, before starting recovery). */
189constexpr uint32_t LOG_HEADER_LOG_UUID = 4;
190
191/** LSN of the start of data in this log file (with format version 1 and 2). */
193
194/** A null-terminated string which will contain either the string 'MEB'
195and the MySQL version if the log file was created by mysqlbackup,
196or 'MySQL' and the MySQL version that created the redo log file. */
198
199/** Maximum length of string with creator name (excludes \0). */
200constexpr size_t LOG_HEADER_CREATOR_MAX_LENGTH = 31;
201
202/** End of the log file creator field (we add 1 for \0). */
205
206/** Offset to encryption information in the log encryption header. */
209
210/** Contents of the LOG_HEADER_CREATOR field */
211#define LOG_HEADER_CREATOR_CURRENT "MySQL " INNODB_VERSION_STR
212
213/** Header is created during DB clone */
214#define LOG_HEADER_CREATOR_CLONE "MySQL Clone"
215
216/** 32 BITs flag */
218
219/** Flag at BIT-1 to indicate if redo logging is disabled or not. */
220constexpr uint32_t LOG_HEADER_FLAG_NO_LOGGING = 1;
221
222/** Flag at BIT-2 to indicate if server is not recoverable on crash. This
223is set only when redo logging is disabled and unset on slow shutdown after
224all pages are flushed to disk. */
225constexpr uint32_t LOG_HEADER_FLAG_CRASH_UNSAFE = 2;
226
227/** Flag at BIT-3 to indicate if server is not recoverable on crash because
228data directory still has not been fully initialized. */
229constexpr uint32_t LOG_HEADER_FLAG_NOT_INITIALIZED = 3;
230
231/** Flag at BIT-4 to mark the redo log file as completely full and closed
232for any future writes. */
233constexpr uint32_t LOG_HEADER_FLAG_FILE_FULL = 4;
234
235/** Maximum BIT position number. Should be set to the latest added. */
237
238/** Current total size of LOG header. */
240
241/* Offsets inside the checkpoint pages since 8.0.30 redo format. */
242
243/** Checkpoint lsn. Recovery starts from this lsn and searches for the first
244log record group that starts since then. */
246
247/* Offsets used in a log block header. */
248
249/** Offset to hdr_no, which is a log block number and must be > 0.
250It is allowed to wrap around at LOG_BLOCK_MAX_NO.
251In older versions of MySQL the highest bit (LOG_BLOCK_FLUSH_BIT_MASK) of hdr_no
252is set to 1, if this is the first block in a call to write. */
253constexpr uint32_t LOG_BLOCK_HDR_NO = 0;
254
255/** Mask used to get the highest bit in the hdr_no field.
256In the older MySQL versions this bit was used to mark first block in a write.*/
257constexpr uint32_t LOG_BLOCK_FLUSH_BIT_MASK = 0x80000000UL;
258
259/** Maximum allowed block's number (stored in hdr_no) increased by 1. */
260constexpr uint32_t LOG_BLOCK_MAX_NO = 0x3FFFFFFFUL + 1;
261
262/** Offset to number of bytes written to this block (also header bytes). */
263constexpr uint32_t LOG_BLOCK_HDR_DATA_LEN = 4;
264
265/** Mask used to get the highest bit in the data len field,
266this bit is to indicate if this block is encrypted or not. */
267constexpr uint32_t LOG_BLOCK_ENCRYPT_BIT_MASK = 0x8000UL;
268
269/** Offset to "first_rec_group offset" stored in the log block header.
270
271The first_rec_group offset is an offset of the first start of mtr log
272record group in this log block (0 if no mtr starts in that log block).
273
274If the value is the same as LOG_BLOCK_HDR_DATA_LEN, it means that the
275first rec group has not yet been concatenated to this log block, but if
276it was supposed to be appended, it would start at this offset.
277
278An archive recovery can start parsing the log records starting from this
279offset in this log block, if value is not 0. */
280constexpr uint32_t LOG_BLOCK_FIRST_REC_GROUP = 6;
281
282/** Offset to epoch_no stored in this log block. The epoch_no is computed
283as the number of epochs passed by the value of start_lsn of the log block.
284Single epoch is defined as range of lsn values containing LOG_BLOCK_MAX_NO
285log blocks, each of OS_FILE_LOG_BLOCK_SIZE bytes. Note, that hdr_no stored
286in header of log block at offset=LOG_BLOCK_HDR_NO, can address the block
287within a given epoch, whereas epoch_no stored at offset=LOG_BLOCK_EPOCH_NO
288is the number of full epochs that were before. The pair <epoch_no, hdr_no>
289would be the absolute block number, so the epoch_no helps in discovery of
290unexpected end of the log during recovery in similar way as hdr_no does.
291@remarks The epoch_no for block that starts at start_lsn is computed as
292the start_lsn divided by OS_FILE_LOG_BLOCK_SIZE, and then divided by the
293LOG_BLOCK_MAX_NO. */
294constexpr uint32_t LOG_BLOCK_EPOCH_NO = 8;
295
296/** Size of the log block's header in bytes. */
297constexpr uint32_t LOG_BLOCK_HDR_SIZE = 12;
298
299/* Offsets used in a log block's footer (refer to the end of the block). */
300
301/** 4 byte checksum of the log block contents. In InnoDB versions < 3.23.52
302this did not contain the checksum, but the same value as .._HDR_NO. */
303constexpr uint32_t LOG_BLOCK_CHECKSUM = 4;
304
305/** Size of the log block footer (trailer) in bytes. */
306constexpr uint32_t LOG_BLOCK_TRL_SIZE = 4;
307
309 "Header + footer cannot be larger than the whole log block.");
310
311/** Size of log block's data fragment (where actual data is stored). */
312constexpr uint32_t LOG_BLOCK_DATA_SIZE =
314
315/** Ensure, that 64 bits are enough to represent lsn values, when 63 bits
316are used to represent sn values. It is enough to ensure that lsn < 2*sn,
317and that is guaranteed if the overhead enumerated in lsn sequence is not
318bigger than number of actual data bytes. */
320 "Overhead in LSN sequence cannot be bigger than actual data.");
321
322/** @} */
323
324/**************************************************/ /**
325
326 @name Log constants related to the log margins.
327
328 *******************************************************/
329
330/** @{ */
331
332/** Extra safety margin in the redo capacity, never ever used ! */
334
335/** Margin which is used ahead of log.write_lsn to create unused files earlier
336than the log.write_lsn reaches the m_end_lsn of the log.m_current_file. This
337margin is expressed in percentage of the next file size. */
338constexpr double LOG_NEXT_FILE_EARLIER_MARGIN = 10;
339
340/** Extra margin, reserved in the redo capacity for the log writer thread.
341When checkpoint age exceeds its maximum limits and user threads are waiting
342in log_free_check() calls, the log writer thread still has "extra margin"
343space reserved in the log files (it is his private fragment of the redo log,
344not announced to users of the redo log). When that happens, all user threads
345are paused at log_free_check.
346This mechanism is supposed to help with getting out of possible deadlocks
347between mini-transactions holding latched pages and page cleaners trying to
348reclaim space in the redo log by flushing the oldest modified pages. It is
349supposed to help if the innodb_thread_concurrency is unlimited or we missed
350to do some log_free_check() calls. This margin is expressed in percentage of
351the total redo capacity available for the log writer thread (hard capacity). */
352constexpr double LOG_EXTRA_WRITER_MARGIN_PCT = 5; /* 5% */
353
354/** Extra margin, reserved in the redo capacity for the concurrency margin.
355Expressed in percentage of the total redo capacity available for user threads
356(soft capacity). Excluded from LOG_CONCCURENCY_MARGIN_MAX_PCT. */
357constexpr double LOG_EXTRA_CONC_MARGIN_PCT = 5; /* 5% */
358
359/** The maximum limit for concurrency_margin expressed as percentage of the
360redo capacity available for user threads (soft capacity).
361
362@remarks The concurrency margin is computed as the maximum number of concurrent
363threads multiplied by some fixed size. Therefore it could happen that it would
364be even bigger than the redo capacity. To avoid such problem, we need to limit
365the concurrency margin and warn if the limitation is hit. */
366constexpr double LOG_CONCCURENCY_MARGIN_MAX_PCT = 50; /* 50% */
367
368/** Maximum number of concurrent background threads, that could be using mini
369transactions which are not read-only (producing redo log records). These are
370threads, which also call log_free_check() to reserve space in the redo log,
371but which are not included in the innodb_thread_concurrency limitation. That's
372why this number is added to the innodb_thread_concurrency when computing the
373concurrency_margin, which is used in log_free_check() calls. */
375
376/** Per thread margin for the free space in the log, before a new query step
377which modifies the database, is started. It's multiplied by maximum number
378of threads, that can concurrently enter mini-transactions. Expressed in
379number of pages. */
380constexpr uint32_t LOG_CHECKPOINT_FREE_PER_THREAD = 4;
381
382/** Number of bytes that might be generated by log_files_governor thread
383to fill up the current log file faster. Note that before generating those
384bytes, the log_files_governor checks if log_free_check is required:
385- no: acts as automatic reservation of space for the records to generate,
386- yes: it skips the redo records generation in this round */
387constexpr uint32_t LOG_FILES_DUMMY_INTAKE_SIZE = 4 * 1024;
388
389/** Controls when the aggressive checkpointing should be started,
390with regards to the free space in the redo log.
391Should be bigger than LOG_FORCING_ADAPTIVE_FLUSH_RATIO_MAX. */
393
394/** Controls when the maximum speed of adaptive flushing of modified pages
395is reached (with regards to free space in the redo log). */
397
398/** Controls when the speed of adaptive flushing of modified pages starts to
399increase. Should be less than the LOG_FORCING_ADAPTIVE_FLUSH_RATIO_MAX. */
401
402/** @} */
403
404/**************************************************/ /**
405
406 @name Log constants related to the system variables.
407
408 *******************************************************/
409
410/** @{ */
411
412/** Default value of innodb_log_write_max_size (in bytes). */
414
415/** Default value of innodb_log_checkpointer_every (in milliseconds). */
416constexpr ulong INNODB_LOG_CHECKPOINT_EVERY_DEFAULT = 1000; // 1000ms = 1s
417
418/** Default value of innodb_log_writer_spin_delay (in spin rounds).
419We measured that 1000 spin round takes 4us. We decided to select 1ms
420as the maximum time for busy waiting. Therefore it corresponds to 250k
421spin rounds. Note that first wait on event takes 50us-100us (even if 10us
422is passed), so it is 5%-10% of the total time that we have already spent
423on busy waiting, when we fall back to wait on event. */
425
426/** Default value of innodb_log_writer_timeout (in microseconds).
427Note that it will anyway take at least 50us. */
429
430/** Default value of innodb_log_spin_cpu_abs_lwm.
431Expressed in percent (80 stands for 80%) of a single CPU core. */
433
434/** Default value of innodb_log_spin_cpu_pct_hwm.
435Expressed in percent (50 stands for 50%) of all CPU cores. */
437
438/** Default value of innodb_log_wait_for_write_spin_delay (in spin rounds).
439Read about INNODB_LOG_WRITER_SPIN_DELAY_DEFAULT.
440Number of spin rounds is calculated according to current usage of CPU cores.
441If the usage is smaller than lwm percents of single core, then max rounds = 0.
442If the usage is smaller than 50% of hwm percents of all cores, then max rounds
443is decreasing linearly from 10x innodb_log_writer_spin_delay to 1x (for 50%).
444Then in range from 50% of hwm to 100% of hwm, the max rounds stays equal to
445the innodb_log_writer_spin_delay, because it doesn't make sense to use too
446short waits. Hence this is minimum value for the max rounds when non-zero
447value is being used. */
449
450/** Default value of innodb_log_wait_for_write_timeout (in microseconds). */
452
453/** Default value of innodb_log_wait_for_flush_spin_delay (in spin rounds).
454Read about INNODB_LOG_WAIT_FOR_WRITE_SPIN_DELAY_DEFAULT. The same mechanism
455applies here (to compute max rounds). */
457
458/** Default value of innodb_log_wait_for_flush_spin_hwm (in microseconds). */
460
461/** Default value of innodb_log_wait_for_flush_timeout (in microseconds). */
463
464/** Default value of innodb_log_flusher_spin_delay (in spin rounds).
465Read about INNODB_LOG_WRITER_SPIN_DELAY_DEFAULT. */
467
468/** Default value of innodb_log_flusher_timeout (in microseconds).
469Note that it will anyway take at least 50us. */
471
472/** Default value of innodb_log_write_notifier_spin_delay (in spin rounds). */
474
475/** Default value of innodb_log_write_notifier_timeout (in microseconds). */
477
478/** Default value of innodb_log_flush_notifier_spin_delay (in spin rounds). */
480
481/** Default value of innodb_log_flush_notifier_timeout (in microseconds). */
483
484/** Default value of innodb_log_buffer_size (in bytes). */
485constexpr ulong INNODB_LOG_BUFFER_SIZE_DEFAULT = 64 * 1024 * 1024UL;
486
487/** Minimum allowed value of innodb_log_buffer_size. */
488constexpr ulong INNODB_LOG_BUFFER_SIZE_MIN = 256 * 1024UL;
489
490/** Maximum allowed value of innodb_log_buffer_size. */
492
493/** Default value of innodb_log_recent_written_size (in bytes). */
494constexpr ulong INNODB_LOG_RECENT_WRITTEN_SIZE_DEFAULT = 1024 * 1024;
495
496/** Minimum allowed value of innodb_log_recent_written_size. */
498
499/** Maximum allowed value of innodb_log_recent_written_size. */
500constexpr ulong INNODB_LOG_RECENT_WRITTEN_SIZE_MAX = 1024 * 1024 * 1024UL;
501
502/** Default value of innodb_buf_flush_list_added_size (in bytes). */
503constexpr ulong INNODB_BUF_FLUSH_LIST_ADDED_SIZE_DEFAULT = 2 * 1024 * 1024;
504
505/** Minimum allowed value of innodb_buf_flush_list_added_size. */
507
508/** Maximum allowed value of innodb_buf_flush_list_added_size. */
509constexpr ulong INNODB_BUF_FLUSH_LIST_ADDED_SIZE_MAX = 1024 * 1024 * 1024UL;
510
511/** Default value of innodb_log_events (number of events). */
512constexpr ulong INNODB_LOG_EVENTS_DEFAULT = 2048;
513
514/** Minimum allowed value of innodb_log_events. */
515constexpr ulong INNODB_LOG_EVENTS_MIN = 1;
516
517/** Maximum allowed value of innodb_log_events. */
518constexpr ulong INNODB_LOG_EVENTS_MAX = 1024 * 1024 * 1024UL;
519
520/** Default value of innodb_log_write_ahead_size (in bytes). */
522
523/** Minimum allowed value of innodb_log_write_ahead_size. */
525
526/** Maximum allowed value of innodb_log_write_ahead_size. */
528 UNIV_PAGE_SIZE_DEF; // 16kB...
529
530/** @} */
531
532/**************************************************/ /**
533
534 @name Log constants used in the tests of the redo log.
535
536 *******************************************************/
537
538/** @{ */
539
540/** Value to which MLOG_TEST records should sum up within a group. */
541constexpr int64_t MLOG_TEST_VALUE = 10000;
542
543/** Maximum size of single MLOG_TEST record (in bytes). */
544constexpr uint32_t MLOG_TEST_MAX_REC_LEN = 100;
545
546/** Maximum number of MLOG_TEST records in single group of log records. */
547constexpr uint32_t MLOG_TEST_GROUP_MAX_REC_N = 100;
548
549/** Bytes occupied by MLOG_TEST record with an empty payload. */
550constexpr uint32_t MLOG_TEST_REC_OVERHEAD = 37;
551
552/** @} */
553
554#endif /* !log0constants_h */
#define UINT32_MAX
Definition: lexyy.cc:86
constexpr os_offset_t LOG_CHECKPOINT_LSN
Checkpoint lsn.
Definition: log0constants.h:245
constexpr sn_t SN_LOCKED
The sn bit to express locked state.
Definition: log0constants.h:162
constexpr uint32_t LOG_HEADER_FLAG_MAX
Maximum BIT position number.
Definition: log0constants.h:236
constexpr ulong INNODB_LOG_FLUSH_NOTIFIER_TIMEOUT_DEFAULT
Default value of innodb_log_flush_notifier_timeout (in microseconds).
Definition: log0constants.h:482
constexpr uint32_t LOG_AGGRESSIVE_CHECKPOINT_RATIO_MIN
Controls when the aggressive checkpointing should be started, with regards to the free space in the r...
Definition: log0constants.h:392
constexpr lsn_t LOG_START_LSN
The counting of lsn's starts from this value: this must be non-zero.
Definition: log0constants.h:153
constexpr uint32_t MLOG_TEST_REC_OVERHEAD
Bytes occupied by MLOG_TEST record with an empty payload.
Definition: log0constants.h:550
constexpr os_offset_t LOG_CHECKPOINT_1
First checkpoint field in the log header.
Definition: log0constants.h:167
constexpr uint32_t LOG_FILE_NAME_MAX_LENGTH
Maximum length of log file name, computed as: base name length(8)
Definition: log0constants.h:80
constexpr uint32_t LOG_BLOCK_FLUSH_BIT_MASK
Mask used to get the highest bit in the hdr_no field.
Definition: log0constants.h:257
constexpr ulint INNODB_LOG_WRITE_MAX_SIZE_DEFAULT
Default value of innodb_log_write_max_size (in bytes).
Definition: log0constants.h:413
constexpr uint32_t LOG_BLOCK_HDR_SIZE
Size of the log block's header in bytes.
Definition: log0constants.h:297
constexpr ulong INNODB_LOG_WRITE_AHEAD_SIZE_MIN
Minimum allowed value of innodb_log_write_ahead_size.
Definition: log0constants.h:524
constexpr const char *const LOG_FILE_BASE_NAME
Prefix of log file name in the current redo format.
Definition: log0constants.h:76
constexpr os_offset_t LOG_HEADER_CREATOR
A null-terminated string which will contain either the string 'MEB' and the MySQL version if the log ...
Definition: log0constants.h:197
constexpr ulong INNODB_LOG_EVENTS_MAX
Maximum allowed value of innodb_log_events.
Definition: log0constants.h:518
constexpr uint32_t LOG_BLOCK_HDR_DATA_LEN
Offset to number of bytes written to this block (also header bytes).
Definition: log0constants.h:263
constexpr ulong INNODB_BUF_FLUSH_LIST_ADDED_SIZE_DEFAULT
Default value of innodb_buf_flush_list_added_size (in bytes).
Definition: log0constants.h:503
constexpr os_offset_t LOG_FILE_MIN_SIZE
Minimum size of single log file, expressed in bytes.
Definition: log0constants.h:91
constexpr ulong INNODB_LOG_WAIT_FOR_WRITE_TIMEOUT_DEFAULT
Default value of innodb_log_wait_for_write_timeout (in microseconds).
Definition: log0constants.h:451
constexpr ulong INNODB_BUF_FLUSH_LIST_ADDED_SIZE_MAX
Maximum allowed value of innodb_buf_flush_list_added_size.
Definition: log0constants.h:509
constexpr uint32_t LOG_BLOCK_DATA_SIZE
Size of log block's data fragment (where actual data is stored).
Definition: log0constants.h:312
constexpr double LOG_NEXT_FILE_EARLIER_MARGIN
Margin which is used ahead of log.write_lsn to create unused files earlier than the log....
Definition: log0constants.h:338
constexpr uint32_t LOG_HEADER_FLAG_NO_LOGGING
Flag at BIT-1 to indicate if redo logging is disabled or not.
Definition: log0constants.h:220
constexpr uint32_t LOG_HEADER_LOG_UUID
Offset within the log file header, to the field which stores the log_uuid.
Definition: log0constants.h:189
constexpr ulong INNODB_LOG_RECENT_WRITTEN_SIZE_DEFAULT
Default value of innodb_log_recent_written_size (in bytes).
Definition: log0constants.h:494
constexpr os_offset_t LOG_HEADER_ENCRYPTION_INFO_OFFSET
Offset to encryption information in the log encryption header.
Definition: log0constants.h:207
constexpr uint32_t MLOG_TEST_MAX_REC_LEN
Maximum size of single MLOG_TEST record (in bytes).
Definition: log0constants.h:544
constexpr ulong INNODB_BUF_FLUSH_LIST_ADDED_SIZE_MIN
Minimum allowed value of innodb_buf_flush_list_added_size.
Definition: log0constants.h:506
constexpr double LOG_CONCCURENCY_MARGIN_MAX_PCT
The maximum limit for concurrency_margin expressed as percentage of the redo capacity available for u...
Definition: log0constants.h:366
constexpr uint32_t LOG_BLOCK_FIRST_REC_GROUP
Offset to "first_rec_group offset" stored in the log block header.
Definition: log0constants.h:280
constexpr uint32_t LOG_HEADER_FLAG_NOT_INITIALIZED
Flag at BIT-3 to indicate if server is not recoverable on crash because data directory still has not ...
Definition: log0constants.h:229
constexpr os_offset_t LOG_CAPACITY_MAX
Maximum allowed value for innodb_redo_log_capacity.
Definition: log0constants.h:97
constexpr os_offset_t LOG_HEADER_CREATOR_END
End of the log file creator field (we add 1 for \0).
Definition: log0constants.h:203
constexpr os_offset_t LOG_FILE_MAX_SIZE
Maximum size of a log file, expressed in bytes.
Definition: log0constants.h:103
constexpr uint32_t LOG_BLOCK_HDR_NO
Offset to hdr_no, which is a log block number and must be > 0.
Definition: log0constants.h:253
constexpr lsn_t LSN_MAX
Maximum possible lsn value is slightly higher than the maximum sn value, because lsn sequence enumera...
Definition: log0constants.h:159
constexpr ulong INNODB_LOG_WRITE_AHEAD_SIZE_DEFAULT
Default value of innodb_log_write_ahead_size (in bytes).
Definition: log0constants.h:521
constexpr ulint INNODB_LOG_WRITE_AHEAD_SIZE_MAX
Maximum allowed value of innodb_log_write_ahead_size.
Definition: log0constants.h:527
constexpr ulong INNODB_LOG_RECENT_WRITTEN_SIZE_MIN
Minimum allowed value of innodb_log_recent_written_size.
Definition: log0constants.h:497
constexpr ulong INNODB_LOG_CHECKPOINT_EVERY_DEFAULT
Default value of innodb_log_checkpointer_every (in milliseconds).
Definition: log0constants.h:416
constexpr uint32_t LOG_BLOCK_EPOCH_NO
Offset to epoch_no stored in this log block.
Definition: log0constants.h:294
constexpr ulong INNODB_LOG_EVENTS_DEFAULT
Default value of innodb_log_events (number of events).
Definition: log0constants.h:512
constexpr os_offset_t LOG_FILE_HDR_SIZE
Size of log file's header.
Definition: log0constants.h:176
constexpr uint32_t LOG_FORCING_ADAPTIVE_FLUSH_RATIO_MIN
Controls when the speed of adaptive flushing of modified pages starts to increase.
Definition: log0constants.h:400
constexpr uint32_t LOG_NO_CHECKSUM_MAGIC
Magic value to use instead of log checksums when they are disabled.
Definition: log0constants.h:150
constexpr ulong INNODB_LOG_EVENTS_MIN
Minimum allowed value of innodb_log_events.
Definition: log0constants.h:515
constexpr ulong INNODB_LOG_WAIT_FOR_FLUSH_SPIN_DELAY_DEFAULT
Default value of innodb_log_wait_for_flush_spin_delay (in spin rounds).
Definition: log0constants.h:456
constexpr uint32_t LOG_HEADER_FLAG_FILE_FULL
Flag at BIT-4 to mark the redo log file as completely full and closed for any future writes.
Definition: log0constants.h:233
constexpr uint32_t LOG_BLOCK_ENCRYPT_BIT_MASK
Mask used to get the highest bit in the data len field, this bit is to indicate if this block is encr...
Definition: log0constants.h:267
constexpr os_offset_t LOG_CAPACITY_MIN
Minimum allowed value for innodb_redo_log_capacity.
Definition: log0constants.h:94
constexpr ulong INNODB_LOG_WRITE_NOTIFIER_TIMEOUT_DEFAULT
Default value of innodb_log_write_notifier_timeout (in microseconds).
Definition: log0constants.h:476
constexpr uint INNODB_LOG_SPIN_CPU_PCT_HWM_DEFAULT
Default value of innodb_log_spin_cpu_pct_hwm.
Definition: log0constants.h:436
constexpr ulong INNODB_LOG_FLUSH_NOTIFIER_SPIN_DELAY_DEFAULT
Default value of innodb_log_flush_notifier_spin_delay (in spin rounds).
Definition: log0constants.h:479
constexpr double LOG_EXTRA_CONC_MARGIN_PCT
Extra margin, reserved in the redo capacity for the concurrency margin.
Definition: log0constants.h:357
constexpr uint32_t LOG_FORCING_ADAPTIVE_FLUSH_RATIO_MAX
Controls when the maximum speed of adaptive flushing of modified pages is reached (with regards to fr...
Definition: log0constants.h:396
constexpr uint32_t LOG_FILES_DUMMY_INTAKE_SIZE
Number of bytes that might be generated by log_files_governor thread to fill up the current log file ...
Definition: log0constants.h:387
constexpr uint32_t LOG_BLOCK_TRL_SIZE
Size of the log block footer (trailer) in bytes.
Definition: log0constants.h:306
constexpr const char *const LOG_DIRECTORY_NAME
Name of subdirectory which contains redo log files.
Definition: log0constants.h:73
constexpr size_t LOG_N_FILES
Targeted number of log files.
Definition: log0constants.h:83
constexpr os_offset_t LOG_HEADER_SIZE
Current total size of LOG header.
Definition: log0constants.h:239
constexpr double LOG_N_FILES_MAX_DOWNSIZE_RATIO
Determines maximum downsize for maximum redo file size during resize.
Definition: log0constants.h:88
constexpr uint32_t LOG_BLOCK_MAX_NO
Maximum allowed block's number (stored in hdr_no) increased by 1.
Definition: log0constants.h:260
constexpr os_offset_t LOG_ENCRYPTION
Log Encryption information in redo log header.
Definition: log0constants.h:170
constexpr size_t LOG_BUFFER_ALIGNMENT
Align the log buffer (log_t::buf) to this size.
Definition: log0constants.h:56
constexpr uint32_t MLOG_TEST_GROUP_MAX_REC_N
Maximum number of MLOG_TEST records in single group of log records.
Definition: log0constants.h:547
constexpr uint32_t LOG_HEADER_FLAG_CRASH_UNSAFE
Flag at BIT-2 to indicate if server is not recoverable on crash.
Definition: log0constants.h:225
constexpr ulong INNODB_LOG_WAIT_FOR_FLUSH_SPIN_HWM_DEFAULT
Default value of innodb_log_wait_for_flush_spin_hwm (in microseconds).
Definition: log0constants.h:459
constexpr size_t LOG_HEADER_CREATOR_MAX_LENGTH
Maximum length of string with creator name (excludes \0).
Definition: log0constants.h:200
constexpr os_offset_t LOG_HEADER_FLAGS
32 BITs flag
Definition: log0constants.h:217
constexpr ulong INNODB_LOG_WRITER_SPIN_DELAY_DEFAULT
Default value of innodb_log_writer_spin_delay (in spin rounds).
Definition: log0constants.h:424
constexpr size_t LOG_WRITE_AHEAD_BUFFER_ALIGNMENT
Align the log write-ahead buffer (log_t::write_ahead_buf) to this size.
Definition: log0constants.h:61
constexpr int64_t MLOG_TEST_VALUE
Value to which MLOG_TEST records should sum up within a group.
Definition: log0constants.h:541
constexpr ulong INNODB_LOG_WAIT_FOR_FLUSH_TIMEOUT_DEFAULT
Default value of innodb_log_wait_for_flush_timeout (in microseconds).
Definition: log0constants.h:462
constexpr double LOG_EXTRA_WRITER_MARGIN_PCT
Extra margin, reserved in the redo capacity for the log writer thread.
Definition: log0constants.h:352
constexpr os_offset_t LOG_EXTRA_SAFETY_MARGIN
Extra safety margin in the redo capacity, never ever used !
Definition: log0constants.h:333
constexpr size_t LOG_BACKGROUND_THREADS_USING_RW_MTRS
Maximum number of concurrent background threads, that could be using mini transactions which are not ...
Definition: log0constants.h:374
constexpr ulong INNODB_LOG_WRITE_NOTIFIER_SPIN_DELAY_DEFAULT
Default value of innodb_log_write_notifier_spin_delay (in spin rounds).
Definition: log0constants.h:473
constexpr ulong INNODB_LOG_BUFFER_SIZE_MAX
Maximum allowed value of innodb_log_buffer_size.
Definition: log0constants.h:491
constexpr uint32_t LOG_BLOCK_CHECKSUM
4 byte checksum of the log block contents.
Definition: log0constants.h:303
constexpr os_offset_t LOG_HEADER_FORMAT
Log file header format identifier (32-bit unsigned big-endian integer).
Definition: log0constants.h:183
constexpr ulong INNODB_LOG_SPIN_CPU_ABS_LWM_DEFAULT
Default value of innodb_log_spin_cpu_abs_lwm.
Definition: log0constants.h:432
constexpr ulong INNODB_LOG_WAIT_FOR_WRITE_SPIN_DELAY_DEFAULT
Default value of innodb_log_wait_for_write_spin_delay (in spin rounds).
Definition: log0constants.h:448
constexpr ulong INNODB_LOG_BUFFER_SIZE_DEFAULT
Default value of innodb_log_buffer_size (in bytes).
Definition: log0constants.h:485
constexpr Log_file_id LOG_FIRST_FILE_ID
Id of the first redo log file (assigned to the first log file when new data directory is being initia...
Definition: log0constants.h:107
constexpr os_offset_t LOG_HEADER_START_LSN
LSN of the start of data in this log file (with format version 1 and 2).
Definition: log0constants.h:192
constexpr size_t LOG_MAX_OPEN_FILES
Maximum number of handles for opened redo log files (in parallel).
Definition: log0constants.h:135
constexpr ulong INNODB_LOG_FLUSHER_TIMEOUT_DEFAULT
Default value of innodb_log_flusher_timeout (in microseconds).
Definition: log0constants.h:470
constexpr uint32_t LOG_CHECKPOINT_FREE_PER_THREAD
Per thread margin for the free space in the log, before a new query step which modifies the database,...
Definition: log0constants.h:380
constexpr ulong INNODB_LOG_WRITER_TIMEOUT_DEFAULT
Default value of innodb_log_writer_timeout (in microseconds).
Definition: log0constants.h:428
constexpr os_offset_t LOG_CHECKPOINT_2
Second checkpoint field in the header of the first log file.
Definition: log0constants.h:173
constexpr ulong INNODB_LOG_FLUSHER_SPIN_DELAY_DEFAULT
Default value of innodb_log_flusher_spin_delay (in spin rounds).
Definition: log0constants.h:466
constexpr ulong INNODB_LOG_RECENT_WRITTEN_SIZE_MAX
Maximum allowed value of innodb_log_recent_written_size.
Definition: log0constants.h:500
constexpr ulong INNODB_LOG_BUFFER_SIZE_MIN
Minimum allowed value of innodb_log_buffer_size.
Definition: log0constants.h:488
Redo log basic types.
size_t Log_file_id
Log file id (0 for ib_redo0)
Definition: log0types.h:66
uint64_t sn_t
Type used for sn values, which enumerate bytes of data stored in the log.
Definition: log0types.h:86
uint64_t lsn_t
Type used for all log sequence number storage and arithmetic.
Definition: log0types.h:63
constexpr size_t INNODB_KERNEL_PAGE_SIZE_DEFAULT
Default kernel page size (not assuming huge pages support).
Definition: ut0cpu_cache.h:45
The interface to the operating system file io.
constexpr uint32_t OS_FILE_LOG_BLOCK_SIZE
The next value should be smaller or equal to the smallest sector size used on any disk.
Definition: os0file.h:192
uint64_t os_offset_t
File offset in bytes.
Definition: os0file.h:87
constexpr uint32_t UNIV_PAGE_SIZE_DEF
Default page size for InnoDB tablespaces.
Definition: univ.i:325
unsigned long int ulint
Definition: univ.i:406
constexpr size_t UNIV_PAGE_SIZE_MAX
Maximum page size InnoDB currently supports.
Definition: univ.i:323