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