Debian Codegraph @

storage/innobase/include/log0constants.h

raw
1 /*****************************************************************************
2
3 Copyright (c) 1995, 2026, Oracle and/or its affiliates.
4
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License, version 2.0, as published by the
7 Free Software Foundation.
8
9 This program is designed to work with certain software (including
10 but not limited to OpenSSL) that is licensed under separate terms,
11 as designated in a particular file or component or in included license
12 documentation. The authors of MySQL hereby grant you an additional
13 permission to link the program and your derivative works with the
14 separately licensed software that they have either included with
15 the program or referenced in the documentation.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20 for more details.
21
22 You should have received a copy of the GNU General Public License along with
23 this program; if not, write to the Free Software Foundation, Inc.,
24 51 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
51 compatibility with older MySQL versions which also aligned the log buffer
52 to OS_FILE_LOG_BLOCK_SIZE. Note, that each write from the log buffer starts
53 at the beginning of one of the blocks in this buffer i.e. from address being
54 a multiple of OS_FILE_LOG_BLOCK_SIZE. Therefore any bigger value for alignment
55 here does not make sense. Please do not use this constant for other buffers. */
56 constexpr size_t LOG_BUFFER_ALIGNMENT = OS_FILE_LOG_BLOCK_SIZE;
57
58 /** Align the log write-ahead buffer (log_t::write_ahead_buf) to this size.
59 This increases chance that the write-ahead buffer is spanned over smaller
60 number of memory pages. Please do not use this constant for other buffers. */
61 constexpr size_t LOG_WRITE_AHEAD_BUFFER_ALIGNMENT =
62 ut::INNODB_KERNEL_PAGE_SIZE_DEFAULT;
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. */
73 constexpr const char *const LOG_DIRECTORY_NAME = "#innodb_redo";
74
75 /** Prefix of log file name in the current redo format. */
76 constexpr 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). */
80 constexpr uint32_t LOG_FILE_NAME_MAX_LENGTH = 8 + 22;
81
82 /** Targeted number of log files. */
83 constexpr size_t LOG_N_FILES = 32;
84
85 /** Determines maximum downsize for maximum redo file size during resize.
86 If maximum file size is 8G, then 1.0/8 means, that InnoDB needs to first
87 achieve maximum file size equal to 1G before targeting even lower values. */
88 constexpr double LOG_N_FILES_MAX_DOWNSIZE_RATIO = 1.0 / 8;
89
90 /** Minimum size of single log file, expressed in bytes. */
91 constexpr os_offset_t LOG_FILE_MIN_SIZE = 64 * 1024;
92
93 /** Minimum allowed value for innodb_redo_log_capacity. */
94 constexpr os_offset_t LOG_CAPACITY_MIN = 8 * 1024 * 1024; /* 8M */
95
96 /** Maximum allowed value for innodb_redo_log_capacity. */
97 constexpr os_offset_t LOG_CAPACITY_MAX = 512ull * 1024 * 1024 * 1024; /* 512G */
98
99 static_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. */
103 constexpr os_offset_t LOG_FILE_MAX_SIZE = LOG_CAPACITY_MAX / LOG_N_FILES;
104
105 /** Id of the first redo log file (assigned to the first log file
106 when new data directory is being initialized). */
107 constexpr Log_file_id LOG_FIRST_FILE_ID = 0;
108
109 /** Maximum number of handles for opened redo log files (in parallel).
110 The 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.
125 During 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.
133 Redo threads are started after the recv_recovery_from_checkpoint_start() is
134 finished, so they don't use handle in parallel with these recv functions. */
135 constexpr 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. */
150 constexpr uint32_t LOG_NO_CHECKSUM_MAGIC = 0xDEADBEEFUL;
151
152 /** The counting of lsn's starts from this value: this must be non-zero. */
153 constexpr lsn_t LOG_START_LSN = 16 * OS_FILE_LOG_BLOCK_SIZE;
154
155 /** Maximum possible lsn value is slightly higher than the maximum sn value,
156 because lsn sequence enumerates also bytes used for headers and footers of
157 all log blocks. However, still 64-bits are enough to represent the maximum
158 lsn value, because only 63 bits are used to represent sn value. */
159 constexpr lsn_t LSN_MAX = (1ULL << 63) - 1;
160
161 /** The sn bit to express locked state. */
162 constexpr sn_t SN_LOCKED = 1ULL << 63;
163
164 /** First checkpoint field in the log header. We write alternately to
165 the checkpoint fields when we make new checkpoints. This field is only
166 defined in the first log file. */
167 constexpr os_offset_t LOG_CHECKPOINT_1 = OS_FILE_LOG_BLOCK_SIZE;
168
169 /** Log Encryption information in redo log header. */
170 constexpr os_offset_t LOG_ENCRYPTION = 2 * OS_FILE_LOG_BLOCK_SIZE;
171
172 /** Second checkpoint field in the header of the first log file. */
173 constexpr os_offset_t LOG_CHECKPOINT_2 = 3 * OS_FILE_LOG_BLOCK_SIZE;
174
175 /** Size of log file's header. */
176 constexpr os_offset_t LOG_FILE_HDR_SIZE = 4 * OS_FILE_LOG_BLOCK_SIZE;
177
178 /* Offsets used in a log file header */
179
180 /** Log file header format identifier (32-bit unsigned big-endian integer).
181 This used to be called LOG_GROUP_ID and always written as 0,
182 because InnoDB never supported more than one copy of the redo log. */
183 constexpr os_offset_t LOG_HEADER_FORMAT = 0;
184
185 /** Offset within the log file header, to the field which stores the log_uuid.
186 The log_uuid is chosen after a new data directory is initialized, and allows
187 to detect situation, in which some of log files came from other data directory
188 (detection is performed on startup, before starting recovery). */
189 constexpr 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). */
192 constexpr os_offset_t LOG_HEADER_START_LSN = 8;
193
194 /** A null-terminated string which will contain either the string 'MEB'
195 and the MySQL version if the log file was created by mysqlbackup,
196 or 'MySQL' and the MySQL version that created the redo log file. */
197 constexpr os_offset_t LOG_HEADER_CREATOR = 16;
198
199 /** Maximum length of string with creator name (excludes \0). */
200 constexpr size_t LOG_HEADER_CREATOR_MAX_LENGTH = 31;
201
202 /** End of the log file creator field (we add 1 for \0). */
203 constexpr os_offset_t LOG_HEADER_CREATOR_END =
204 LOG_HEADER_CREATOR + LOG_HEADER_CREATOR_MAX_LENGTH + 1;
205
206 /** Offset to encryption information in the log encryption header. */
207 constexpr os_offset_t LOG_HEADER_ENCRYPTION_INFO_OFFSET =
208 LOG_HEADER_CREATOR_END;
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 */
217 constexpr os_offset_t LOG_HEADER_FLAGS = LOG_HEADER_CREATOR_END;
218
219 /** Flag at BIT-1 to indicate if redo logging is disabled or not. */
220 constexpr uint32_t LOG_HEADER_FLAG_NO_LOGGING = 1;
221
222 /** Flag at BIT-2 to indicate if server is not recoverable on crash. This
223 is set only when redo logging is disabled and unset on slow shutdown after
224 all pages are flushed to disk. */
225 constexpr uint32_t LOG_HEADER_FLAG_CRASH_UNSAFE = 2;
226
227 /** Flag at BIT-3 to indicate if server is not recoverable on crash because
228 data directory still has not been fully initialized. */
229 constexpr 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
232 for any future writes. */
233 constexpr uint32_t LOG_HEADER_FLAG_FILE_FULL = 4;
234
235 /** Maximum BIT position number. Should be set to the latest added. */
236 constexpr uint32_t LOG_HEADER_FLAG_MAX = LOG_HEADER_FLAG_FILE_FULL;
237
238 /** Current total size of LOG header. */
239 constexpr os_offset_t LOG_HEADER_SIZE = LOG_HEADER_FLAGS + 4;
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
244 log record group that starts since then. */
245 constexpr os_offset_t LOG_CHECKPOINT_LSN = 8;
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.
250 It is allowed to wrap around at LOG_BLOCK_MAX_NO.
251 In older versions of MySQL the highest bit (LOG_BLOCK_FLUSH_BIT_MASK) of hdr_no
252 is set to 1, if this is the first block in a call to write. */
253 constexpr uint32_t LOG_BLOCK_HDR_NO = 0;
254
255 /** Mask used to get the highest bit in the hdr_no field.
256 In the older MySQL versions this bit was used to mark first block in a write.*/
257 constexpr uint32_t LOG_BLOCK_FLUSH_BIT_MASK = 0x80000000UL;
258
259 /** Maximum allowed block's number (stored in hdr_no) increased by 1. */
260 constexpr uint32_t LOG_BLOCK_MAX_NO = 0x3FFFFFFFUL + 1;
261
262 /** Offset to number of bytes written to this block (also header bytes). */
263 constexpr uint32_t LOG_BLOCK_HDR_DATA_LEN = 4;
264
265 /** Mask used to get the highest bit in the data len field,
266 this bit is to indicate if this block is encrypted or not. */
267 constexpr uint32_t LOG_BLOCK_ENCRYPT_BIT_MASK = 0x8000UL;
268
269 /** Offset to "first_rec_group offset" stored in the log block header.
270
271 The first_rec_group offset is an offset of the first start of mtr log
272 record group in this log block (0 if no mtr starts in that log block).
273
274 If the value is the same as LOG_BLOCK_HDR_DATA_LEN, it means that the
275 first rec group has not yet been concatenated to this log block, but if
276 it was supposed to be appended, it would start at this offset.
277
278 An archive recovery can start parsing the log records starting from this
279 offset in this log block, if value is not 0. */
280 constexpr uint32_t LOG_BLOCK_FIRST_REC_GROUP = 6;
281
282 /** Offset to epoch_no stored in this log block. The epoch_no is computed
283 as the number of epochs passed by the value of start_lsn of the log block.
284 Single epoch is defined as range of lsn values containing LOG_BLOCK_MAX_NO
285 log blocks, each of OS_FILE_LOG_BLOCK_SIZE bytes. Note, that hdr_no stored
286 in header of log block at offset=LOG_BLOCK_HDR_NO, can address the block
287 within a given epoch, whereas epoch_no stored at offset=LOG_BLOCK_EPOCH_NO
288 is the number of full epochs that were before. The pair <epoch_no, hdr_no>
289 would be the absolute block number, so the epoch_no helps in discovery of
290 unexpected 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
292 the start_lsn divided by OS_FILE_LOG_BLOCK_SIZE, and then divided by the
293 LOG_BLOCK_MAX_NO. */
294 constexpr uint32_t LOG_BLOCK_EPOCH_NO = 8;
295
296 /** Size of the log block's header in bytes. */
297 constexpr 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
302 this did not contain the checksum, but the same value as .._HDR_NO. */
303 constexpr uint32_t LOG_BLOCK_CHECKSUM = 4;
304
305 /** Size of the log block footer (trailer) in bytes. */
306 constexpr uint32_t LOG_BLOCK_TRL_SIZE = 4;
307
308 static_assert(LOG_BLOCK_HDR_SIZE + LOG_BLOCK_TRL_SIZE < OS_FILE_LOG_BLOCK_SIZE,
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). */
312 constexpr uint32_t LOG_BLOCK_DATA_SIZE =
313 OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE - LOG_BLOCK_TRL_SIZE;
314
315 /** Ensure, that 64 bits are enough to represent lsn values, when 63 bits
316 are used to represent sn values. It is enough to ensure that lsn < 2*sn,
317 and that is guaranteed if the overhead enumerated in lsn sequence is not
318 bigger than number of actual data bytes. */
319 static_assert(LOG_BLOCK_HDR_SIZE + LOG_BLOCK_TRL_SIZE < LOG_BLOCK_DATA_SIZE,
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 ! */
333 constexpr os_offset_t LOG_EXTRA_SAFETY_MARGIN = 2 * UNIV_PAGE_SIZE_MAX;
334
335 /** Margin which is used ahead of log.write_lsn to create unused files earlier
336 than the log.write_lsn reaches the m_end_lsn of the log.m_current_file. This
337 margin is expressed in percentage of the next file size. */
338 constexpr double LOG_NEXT_FILE_EARLIER_MARGIN = 10;
339
340 /** Extra margin, reserved in the redo capacity for the log writer thread.
341 When checkpoint age exceeds its maximum limits and user threads are waiting
342 in log_free_check() calls, the log writer thread still has "extra margin"
343 space reserved in the log files (it is his private fragment of the redo log,
344 not announced to users of the redo log). When that happens, all user threads
345 are paused at log_free_check.
346 This mechanism is supposed to help with getting out of possible deadlocks
347 between mini-transactions holding latched pages and page cleaners trying to
348 reclaim space in the redo log by flushing the oldest modified pages. It is
349 supposed to help if the innodb_thread_concurrency is unlimited or we missed
350 to do some log_free_check() calls. This margin is expressed in percentage of
351 the total redo capacity available for the log writer thread (hard capacity). */
352 constexpr double LOG_EXTRA_WRITER_MARGIN_PCT = 5; /* 5% */
353
354 /** Extra margin, reserved in the redo capacity for the concurrency margin.
355 Expressed in percentage of the total redo capacity available for user threads
356 (soft capacity). Excluded from LOG_CONCCURENCY_MARGIN_MAX_PCT. */
357 constexpr double LOG_EXTRA_CONC_MARGIN_PCT = 5; /* 5% */
358
359 /** The maximum limit for concurrency_margin expressed as percentage of the
360 redo capacity available for user threads (soft capacity).
361
362 @remarks The concurrency margin is computed as the maximum number of concurrent
363 threads multiplied by some fixed size. Therefore it could happen that it would
364 be even bigger than the redo capacity. To avoid such problem, we need to limit
365 the concurrency margin and warn if the limitation is hit. */
366 constexpr double LOG_CONCCURENCY_MARGIN_MAX_PCT = 50; /* 50% */
367
368 /** Maximum number of concurrent background threads, that could be using mini
369 transactions which are not read-only (producing redo log records). These are
370 threads, which also call log_free_check() to reserve space in the redo log,
371 but which are not included in the innodb_thread_concurrency limitation. That's
372 why this number is added to the innodb_thread_concurrency when computing the
373 concurrency_margin, which is used in log_free_check() calls. */
374 constexpr size_t LOG_BACKGROUND_THREADS_USING_RW_MTRS = 10;
375
376 /** Per thread margin for the free space in the log, before a new query step
377 which modifies the database, is started. It's multiplied by maximum number
378 of threads, that can concurrently enter mini-transactions. Expressed in
379 number of pages. */
380 constexpr uint32_t LOG_CHECKPOINT_FREE_PER_THREAD = 4;
381
382 /** Number of bytes that might be generated by log_files_governor thread
383 to fill up the current log file faster. Note that before generating those
384 bytes, 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 */
387 constexpr uint32_t LOG_FILES_DUMMY_INTAKE_SIZE = 4 * 1024;
388
389 /** Controls when the aggressive checkpointing should be started,
390 with regards to the free space in the redo log.
391 Should be bigger than LOG_FORCING_ADAPTIVE_FLUSH_RATIO_MAX. */
392 constexpr uint32_t LOG_AGGRESSIVE_CHECKPOINT_RATIO_MIN = 32;
393
394 /** Controls when the maximum speed of adaptive flushing of modified pages
395 is reached (with regards to free space in the redo log). */
396 constexpr uint32_t LOG_FORCING_ADAPTIVE_FLUSH_RATIO_MAX = 16;
397
398 /** Controls when the speed of adaptive flushing of modified pages starts to
399 increase. Should be less than the LOG_FORCING_ADAPTIVE_FLUSH_RATIO_MAX. */
400 constexpr uint32_t LOG_FORCING_ADAPTIVE_FLUSH_RATIO_MIN = 8;
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). */
413 constexpr ulint INNODB_LOG_WRITE_MAX_SIZE_DEFAULT = 4096;
414
415 /** Default value of innodb_log_checkpointer_every (in milliseconds). */
416 constexpr ulong INNODB_LOG_CHECKPOINT_EVERY_DEFAULT = 1000; // 1000ms = 1s
417
418 /** Default value of innodb_log_writer_spin_delay (in spin rounds).
419 We measured that 1000 spin round takes 4us. We decided to select 1ms
420 as the maximum time for busy waiting. Therefore it corresponds to 250k
421 spin rounds. Note that first wait on event takes 50us-100us (even if 10us
422 is passed), so it is 5%-10% of the total time that we have already spent
423 on busy waiting, when we fall back to wait on event. */
424 constexpr ulong INNODB_LOG_WRITER_SPIN_DELAY_DEFAULT = 250000;
425
426 /** Default value of innodb_log_writer_timeout (in microseconds).
427 Note that it will anyway take at least 50us. */
428 constexpr ulong INNODB_LOG_WRITER_TIMEOUT_DEFAULT = 10;
429
430 /** Default value of innodb_log_spin_cpu_abs_lwm.
431 Expressed in percent (80 stands for 80%) of a single CPU core. */
432 constexpr ulong INNODB_LOG_SPIN_CPU_ABS_LWM_DEFAULT = 80;
433
434 /** Default value of innodb_log_spin_cpu_pct_hwm.
435 Expressed in percent (50 stands for 50%) of all CPU cores. */
436 constexpr uint INNODB_LOG_SPIN_CPU_PCT_HWM_DEFAULT = 50;
437
438 /** Default value of innodb_log_wait_for_write_spin_delay (in spin rounds).
439 Read about INNODB_LOG_WRITER_SPIN_DELAY_DEFAULT.
440 Number of spin rounds is calculated according to current usage of CPU cores.
441 If the usage is smaller than lwm percents of single core, then max rounds = 0.
442 If the usage is smaller than 50% of hwm percents of all cores, then max rounds
443 is decreasing linearly from 10x innodb_log_writer_spin_delay to 1x (for 50%).
444 Then in range from 50% of hwm to 100% of hwm, the max rounds stays equal to
445 the innodb_log_writer_spin_delay, because it doesn't make sense to use too
446 short waits. Hence this is minimum value for the max rounds when non-zero
447 value is being used. */
448 constexpr ulong INNODB_LOG_WAIT_FOR_WRITE_SPIN_DELAY_DEFAULT = 25000;
449
450 /** Default value of innodb_log_wait_for_write_timeout (in microseconds). */
451 constexpr ulong INNODB_LOG_WAIT_FOR_WRITE_TIMEOUT_DEFAULT = 1000;
452
453 /** Default value of innodb_log_wait_for_flush_spin_delay (in spin rounds).
454 Read about INNODB_LOG_WAIT_FOR_WRITE_SPIN_DELAY_DEFAULT. The same mechanism
455 applies here (to compute max rounds). */
456 constexpr ulong INNODB_LOG_WAIT_FOR_FLUSH_SPIN_DELAY_DEFAULT = 25000;
457
458 /** Default value of innodb_log_wait_for_flush_spin_hwm (in microseconds). */
459 constexpr ulong INNODB_LOG_WAIT_FOR_FLUSH_SPIN_HWM_DEFAULT = 400;
460
461 /** Default value of innodb_log_wait_for_flush_timeout (in microseconds). */
462 constexpr ulong INNODB_LOG_WAIT_FOR_FLUSH_TIMEOUT_DEFAULT = 1000;
463
464 /** Default value of innodb_log_flusher_spin_delay (in spin rounds).
465 Read about INNODB_LOG_WRITER_SPIN_DELAY_DEFAULT. */
466 constexpr ulong INNODB_LOG_FLUSHER_SPIN_DELAY_DEFAULT = 250000;
467
468 /** Default value of innodb_log_flusher_timeout (in microseconds).
469 Note that it will anyway take at least 50us. */
470 constexpr ulong INNODB_LOG_FLUSHER_TIMEOUT_DEFAULT = 10;
471
472 /** Default value of innodb_log_write_notifier_spin_delay (in spin rounds). */
473 constexpr ulong INNODB_LOG_WRITE_NOTIFIER_SPIN_DELAY_DEFAULT = 0;
474
475 /** Default value of innodb_log_write_notifier_timeout (in microseconds). */
476 constexpr ulong INNODB_LOG_WRITE_NOTIFIER_TIMEOUT_DEFAULT = 10;
477
478 /** Default value of innodb_log_flush_notifier_spin_delay (in spin rounds). */
479 constexpr ulong INNODB_LOG_FLUSH_NOTIFIER_SPIN_DELAY_DEFAULT = 0;
480
481 /** Default value of innodb_log_flush_notifier_timeout (in microseconds). */
482 constexpr ulong INNODB_LOG_FLUSH_NOTIFIER_TIMEOUT_DEFAULT = 10;
483
484 /** Default value of innodb_log_buffer_size (in bytes). */
485 constexpr ulong INNODB_LOG_BUFFER_SIZE_DEFAULT = 16 * 1024 * 1024UL;
486
487 /** Minimum allowed value of innodb_log_buffer_size. */
488 constexpr ulong INNODB_LOG_BUFFER_SIZE_MIN = 256 * 1024UL;
489
490 /** Maximum allowed value of innodb_log_buffer_size. */
491 constexpr ulong INNODB_LOG_BUFFER_SIZE_MAX = UINT32_MAX;
492
493 /** Default value of innodb_log_recent_written_size (in bytes). */
494 constexpr ulong INNODB_LOG_RECENT_WRITTEN_SIZE_DEFAULT = 1024 * 1024;
495
496 /** Minimum allowed value of innodb_log_recent_written_size. */
497 constexpr ulong INNODB_LOG_RECENT_WRITTEN_SIZE_MIN = OS_FILE_LOG_BLOCK_SIZE;
498
499 /** Maximum allowed value of innodb_log_recent_written_size. */
500 constexpr ulong INNODB_LOG_RECENT_WRITTEN_SIZE_MAX = 1024 * 1024 * 1024UL;
501
502 /** Default value of innodb_log_recent_closed_size (in bytes). */
503 constexpr ulong INNODB_LOG_RECENT_CLOSED_SIZE_DEFAULT = 2 * 1024 * 1024;
504
505 /** Minimum allowed value of innodb_log_recent_closed_size. */
506 constexpr ulong INNODB_LOG_RECENT_CLOSED_SIZE_MIN = OS_FILE_LOG_BLOCK_SIZE;
507
508 /** Maximum allowed value of innodb_log_recent_closed_size. */
509 constexpr ulong INNODB_LOG_RECENT_CLOSED_SIZE_MAX = 1024 * 1024 * 1024UL;
510
511 /** Default value of innodb_log_events (number of events). */
512 constexpr ulong INNODB_LOG_EVENTS_DEFAULT = 2048;
513
514 /** Minimum allowed value of innodb_log_events. */
515 constexpr ulong INNODB_LOG_EVENTS_MIN = 1;
516
517 /** Maximum allowed value of innodb_log_events. */
518 constexpr ulong INNODB_LOG_EVENTS_MAX = 1024 * 1024 * 1024UL;
519
520 /** Default value of innodb_log_write_ahead_size (in bytes). */
521 constexpr ulong INNODB_LOG_WRITE_AHEAD_SIZE_DEFAULT = 8192;
522
523 /** Minimum allowed value of innodb_log_write_ahead_size. */
524 constexpr ulong INNODB_LOG_WRITE_AHEAD_SIZE_MIN = OS_FILE_LOG_BLOCK_SIZE;
525
526 /** Maximum allowed value of innodb_log_write_ahead_size. */
527 constexpr ulint INNODB_LOG_WRITE_AHEAD_SIZE_MAX =
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. */
541 constexpr int64_t MLOG_TEST_VALUE = 10000;
542
543 /** Maximum size of single MLOG_TEST record (in bytes). */
544 constexpr uint32_t MLOG_TEST_MAX_REC_LEN = 100;
545
546 /** Maximum number of MLOG_TEST records in single group of log records. */
547 constexpr uint32_t MLOG_TEST_GROUP_MAX_REC_N = 100;
548
549 /** Bytes occupied by MLOG_TEST record with an empty payload. */
550 constexpr uint32_t MLOG_TEST_REC_OVERHEAD = 37;
551
552 /** @} */
553
554 #endif /* !log0constants_h */