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