MySQL 26.10.0
Source Code Documentation
log0recv.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1997, 2026, 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/** @file include/log0recv.h
29 Recovery
30
31 Created 9/20/1997 Heikki Tuuri
32 *******************************************************/
33
34#ifndef log0recv_h
35#define log0recv_h
36
37#include "buf0types.h"
38#include "dict0types.h"
39#include "hash0hash.h"
40#include "log0handler.h"
41#include "log0redo.h"
42#include "log0sys.h"
43#include "mtr0types.h"
44
45/* OS_FILE_LOG_BLOCK_SIZE */
46#include "os0file.h"
47
48#include "ut0byte.h"
49#include "ut0new.h"
50#include "ut0per_thread.h"
51#include "ut0todo_counter.h"
52
53#include <list>
54#include <unordered_map>
55#include <unordered_set>
56
57class MetadataRecover;
59
60namespace ib::redo {
61
62/** Registry of per-thread Redo_applier instances, which can be all
63freed by calling reset().
64
65This is used and owned by recv_sys.
66This wraps ut::Per_thread so recovery workers can reuse one Redo_applier per
67thread while keeping explicit recv_sys-controlled destruction instead of
68thread-exit destruction. */
70 public:
72
75 return ut::make_unique<ib::redo::Redo_applier>(
77 })) {}
78
81
82 /** Destroy all per-thread appliers owned by this registry.
83
84 Calling operator->() afterwards is a contract violation.
85 */
86 void reset() { m_storage.reset(); }
87
88 /** Return the Redo_applier associated with the calling thread.
89
90 The applier is created on first access for that thread.
91
92 @return Redo_applier owned by this registry for the calling thread.
93 */
95 ut_a(m_storage != nullptr);
96 return m_storage->operator->()->get();
97 }
98
99 private:
101};
102
103} // namespace ib::redo
104
105#ifdef UNIV_HOTBACKUP
106
107struct recv_addr_t;
108
109/** list of tablespaces, that experienced an inplace DDL during a backup op */
110extern std::list<std::pair<space_id_t, lsn_t>> index_load_list;
111
112/** Scans the log segment and n_bytes_scanned is set to the length of valid
113log scanned.
114@param[in] buf buffer containing log data
115@param[in] buf_len data length in that buffer
116@param[in,out] scanned_lsn lsn of buffer start, we return scanned
117lsn
118@param[in,out] scanned_checkpoint_no 4 lowest bytes of the highest scanned
119@param[out] block_no highest block no in scanned buffer.
120checkpoint number so far
121@param[out] n_bytes_scanned how much we were able to scan, smaller
122than buf_len if log data ended here
123@param[out] has_encrypted_log set true, if buffer contains encrypted
124redo log, set false otherwise */
125void meb_scan_log_seg(byte *buf, size_t buf_len, lsn_t *scanned_lsn,
126 uint32_t *scanned_checkpoint_no, uint32_t *block_no,
127 size_t *n_bytes_scanned, bool *has_encrypted_log);
128
129/** Applies the hashed log records to the page, if the page lsn is less than the
130lsn of a log record. This can be called when a buffer page has just been
131read in, or also for a page already in the buffer pool.
132
133
134@param[in,out] block buffer block */
136
137/** Wrapper for recv_recover_page_func().
138Applies the hashed log records to the page, if the page lsn is less than the
139lsn of a log record. This can be called when a buffer page has just been
140read in, or also for a page already in the buffer pool.
141@param jri in: true if just read in (the i/o handler calls this for
142a freshly read page)
143@param block in,out: the buffer block
144*/
145static inline void recv_recover_page(bool jri [[maybe_unused]],
146 buf_block_t *block) {
148}
149
150/** Applies log records in the hash table to a backup. */
151void meb_apply_log_recs(void);
152
153/** Applies log records in the hash table to a backup using a callback
154functions.
155@param[in] apply_log_record_function function for apply
156@param[in] wait_till_done_function function for wait */
157void meb_apply_log_recs_via_callback(
158 void (*apply_log_record_function)(recv_addr_t *),
159 void (*wait_till_done_function)());
160
161/** Applies a log record in the hash table to a backup.
162@param[in] recv_addr chain of log records
163@param[in,out] block buffer block to apply the records to */
164void meb_apply_log_record(recv_addr_t *recv_addr, buf_block_t *block);
165
166/** Process a file name passed as an input
167@param[in] name absolute path of tablespace file
168@param[in] space_id the tablespace ID
169@retval true if able to process file successfully.
170@retval false if unable to process the file */
171void meb_fil_name_process(const char *name, space_id_t space_id);
172
173/** Scans log from a buffer and stores new log data to the parsing buffer.
174Parses and hashes the log records if new data found.
175@param[in] buf buffer containing a log
176segment or garbage
177@param[in] len buffer length
178@param[in] start_lsn buffer start lsn
179@param[out] group_scanned_lsn scanning succeeded up to this lsn
180@retval true if limit_lsn has been reached, or not able to scan any
181more in this log group
182@retval false otherwise */
183[[nodiscard]] bool meb_scan_log_recs(const byte *buf, size_t len,
184 lsn_t start_lsn, lsn_t *group_scanned_lsn);
185#else /* UNIV_HOTBACKUP */
186
187/** Applies the hashed log records to the page, if the page lsn is less than the
188lsn of a log record. This can be called when a buffer page has just been
189read in, or also for a page already in the buffer pool.
190
191
192@param[in] just_read_in true if the IO handler calls this for a freshly
193 read page
194@param[in,out] block buffer block */
195void recv_recover_page_func(bool just_read_in, buf_block_t *block);
196
197/** Wrapper for recv_recover_page_func().
198Applies the hashed log records to the page, if the page lsn is less than the
199lsn of a log record. This can be called when a buffer page has just been
200read in, or also for a page already in the buffer pool.
201@param jri in: true if just read in (the i/o handler calls this for
202a freshly read page)
203@param[in,out] block buffer block */
204static inline void recv_recover_page(bool jri, buf_block_t *block) {
205 recv_recover_page_func(jri, block);
206}
207
208#endif /* UNIV_HOTBACKUP */
209
210/** Check the 4-byte checksum to the trailer checksum field of a log
211block.
212@param[in] block pointer to a log block
213@return whether the checksum matches */
214[[nodiscard]] bool log_block_checksum_is_ok(const byte *block);
215
216/** Frees the recovery system. */
217void recv_sys_free();
218
219/** Reset the state of the recovery system variables. */
220void recv_sys_var_init();
221
222#ifdef UNIV_HOTBACKUP
223/** Get the number of bytes used by all the heaps
224@return number of bytes used */
225size_t meb_heap_used();
226#endif /* UNIV_HOTBACKUP */
227
228/** Returns true if recovery is currently running.
229@return recv_recovery_on */
230[[nodiscard]] static inline bool recv_recovery_is_on();
231
232/** Returns true if the page is brand new (the next log record is init_file_page
233or no records to apply).
234@param[in] block buffer block
235@return true if brand new */
237
238/** Recovers all tablespaces from the redo log.
239@see recv_recovery_from_checkpoint_finish
240@param[in] flush_lsn lsn stored at offset FIL_PAGE_FILE_FLUSH_LSN
241 in the system tablespace header
242@return error code or DB_SUCCESS */
243[[nodiscard]] dberr_t recv_recovery_from_checkpoint_start(lsn_t flush_lsn);
244
245/** Determine if a redo log from a version before MySQL 8.0.30 is clean.
246@param[in,out] log redo log
247@return error code
248@retval DB_SUCCESS if the redo log is clean
249@retval DB_ERROR if the redo log is corrupted or dirty */
251
252/** Complete the recovery from the latest checkpoint.
253@param[in] aborting true if the server has to abort due to an error
254@return recovered persistent metadata or nullptr if aborting*/
256 bool aborting);
257
258#ifndef UNIV_HOTBACKUP
259/** Scans log from a stream and stores new log data to the parsing buffer.
260Parses and hashes the log records if new data found. Each time the hash
261table gets full (see max_mem), it will apply all the records from the
262hashmap to the pages ("a batch"), clearing the hashmap, and continuing
263this way till the end of stream.
264@param[in] checkpoint_lsn log sequence number found in checkpoint
265 header. May be inexact (in a middle of
266 an mtr which we can ignore, as it is
267 already applied to tablespace files)
268 until which all redo log has been
269 scanned */
270[[nodiscard]] dberr_t recv_recovery_begin(lsn_t checkpoint_lsn);
271#endif /* !UNIV_HOTBACKUP */
272
273/** Creates the recovery system. */
274void recv_sys_create();
275
276/** Release recovery system mutexes. */
277void recv_sys_close();
278
279/** Inits the recovery system for a recovery operation. */
280void recv_sys_init();
281
282/** Calculates the new value for lsn when more data is added to the log.
283@param[in] lsn Old LSN
284@param[in] len This many bytes of data is added, log block
285 headers not included
286@return LSN after data addition */
288
289#if defined(UNIV_DEBUG) || defined(UNIV_HOTBACKUP)
290/** Return string name of the redo log record type.
291@param[in] type record log record enum
292@return string name of record log record */
293const char *get_mlog_string(mlog_id_t type);
294#endif /* UNIV_DEBUG || UNIV_HOTBACKUP */
295
296/** Block of log record data */
298 /** pointer to the next block or NULL. The log record data
299 is stored physically immediately after this struct, max amount
300 RECV_DATA_BLOCK_SIZE bytes of it */
301
303};
304
305/** Stored log record struct */
306struct recv_t {
308
309 /** Log record type */
311
312 /** Log record body length in bytes */
314
315 /** Chain of blocks containing the log record body */
317
318 /** Start lsn of the log segment written by the mtr which generated
319 this log record: NOTE that this is not necessarily the start lsn of
320 this log record */
322
323 /** End lsn of the log segment written by the mtr which generated
324 this log record: NOTE that this is not necessarily the end LSN of
325 this log record */
327
328 /** List node, list anchored in recv_addr_t */
330};
331
332/** States of recv_addr_t */
334
335 /** not yet processed */
337
338 /** page is being read */
340
341 /** log records are being applied on the page */
343
344 /** log records have been applied on the page */
346
347 /** log records have been discarded because the tablespace
348 does not exist */
351
352/** Hashed page file address struct */
355
356 /** recovery state of the page */
358
359 /** Space ID */
361
362 /** Page number */
364
365 /** List of log records for this page */
367};
368
369// Forward declaration
370namespace dblwr {
371namespace recv {
372class DBLWR;
373}
374} // namespace dblwr
375
376/** Class to parse persistent dynamic metadata redo log, store and
377merge them and apply them to in-memory table objects finally */
380 table_id_t, PersistentTableMetadata *, std::less<table_id_t>,
382
383 public:
384 /** Default constructor */
386
387 /** Destructor */
389
390 /** Parse a dynamic metadata redo log of a table and store
391 the metadata locally
392 @param[in] id table id
393 @param[in] version table dynamic metadata version
394 @param[in] ptr redo log start
395 @param[in] end end of redo log
396 @retval ptr to next redo log record, nullptr if this log record
397 was truncated */
398 const byte *parseMetadataLog(table_id_t id, uint64_t version, const byte *ptr,
399 const byte *end);
400
401 /** Store the collected persistent dynamic metadata to
402 mysql.innodb_dynamic_metadata */
403 void store();
404
405 /** If there is any metadata to be applied
406 @return true if any metadata to be applied, otherwise false */
407 bool empty() const { return m_tables.empty(); }
408
409 private:
410 /** Get the dynamic metadata of a specified table,
411 create a new one if not exist
412 @param[in] id table id
413 @return the metadata of the specified table */
415
416 private:
417 /** Map used to store and merge persistent dynamic metadata */
419};
420
421/** Recovery system data structure */
423 using Pages =
424 std::unordered_map<page_no_t, recv_addr_t *, std::hash<page_no_t>,
425 std::equal_to<page_no_t>>;
426
427 /** Every space has its own heap and pages that belong to it. */
428 struct Space {
429 /** Constructor
430 @param[in,out] heap Heap to use for the log records. */
431 explicit Space(mem_heap_t *heap) : m_heap(heap), m_pages() {}
432
433 /** Default constructor */
434 Space() : m_heap(), m_pages() {}
435
436 /** Memory heap of log records and file addresses */
438
439 /** Pages that need to be recovered */
441 };
442
443 using Missing_Ids = std::unordered_set<space_id_t>;
444
445 using Spaces = std::unordered_map<space_id_t, Space, std::hash<space_id_t>,
446 std::equal_to<space_id_t>>;
447
448 /* Recovery encryption information */
450 /** Tablespace ID */
452
453 /** LSN of REDO log encryption entry */
455
456 /** Encryption key */
457 byte *ptr;
458
459 /** Encryption IV */
460 byte *iv;
461 };
462
463 using Encryption_Keys = std::vector<Encryption_Key>;
464
465#ifndef UNIV_HOTBACKUP
466
467 /** mutex protecting the fields apply_log_recs, decrements of
468 n_pages_to_recover, and the state field in each recv_addr struct */
469 ib_mutex_t mutex;
470
471 /** mutex coordinating flushing between recv_writer_thread and
472 the recovery thread. */
473 ib_mutex_t writer_mutex;
474
475 /** event to activate page cleaner threads */
477
478 /** event to signal that the page cleaner has finished the request */
480
481 /** type of the flush request. BUF_FLUSH_LRU: flush end of LRU,
482 keeping free blocks. BUF_FLUSH_LIST: flush all of blocks. */
484
485#else /* !UNIV_HOTBACKUP */
486 /** This is true when the space log record needs to be applied */
487 bool apply_file_operations;
488
489 /** This is true when an inconsistency with the file system contents
490 is detected during log scan or apply */
491 bool found_corrupt_fs;
492#endif /* !UNIV_HOTBACKUP */
493
494 /** This is true when log rec application to pages is allowed;
495 this flag tells the i/o-handler if it should do log record
496 application */
498
499 /** Buffer for parsing log records */
500 byte *buf;
501
502 /** Size of the parsing buffer */
503 size_t buf_len;
504
505 /** Amount of data in buf */
507
508 /** This is the lsn from which we were able to start parsing
509 log records and adding them to the hash table; zero if a suitable
510 start point not found yet */
512
513 /** Checkpoint lsn that was used during recovery (read from file). */
515
516 /** The log data has been scanned up to this lsn */
518
519 /** The log data has been scanned up to this epoch_no */
521
522 /** Start offset of non-parsed log records in buf */
524
525 /** The log records have been parsed up to this lsn */
527
528 /** The previous value of recovered_lsn - before we parsed the last mtr.
529 It is equal to recovered_lsn before we parsed any mtr. This is used to
530 find moments in which recovered_lsn moves to the next block in which case
531 we should update the last_block_first_mtr_boundary (described below). */
533
534 /** Tracks what should be the proper value of first_rec_group field in the
535 header of the block to which recovered_lsn belongs. It might be also zero,
536 in which case it means we do not know. */
538
539 /** Set when finding a corrupt log block or record, or there
540 is a log parsing buffer overflow */
542
543 /** Data directory has been recognized as cloned data directory. */
545
546 /** Data directory has been recognized as data directory from MEB. */
548
549 /** Doublewrite buffer state before MEB recovery starts. We restore to this
550 state after MEB recovery completes and disable the doublewrite buffer during
551 MEB recovery. */
553
554 /** Hash table of pages, indexed by SpaceID. */
556
557 /** Number of unique unprocessed page ids in the spaces nested hash table.
558 Increments are done only from the main recovery thread before apply starts.
559 Decrements are done from multiple threads during batch apply phase, and are
560 protected by the recv_sys_t::mutex. */
562
563 /** Doublewrite buffer pages, destroyed after recovery completes */
565
566 /** We store and merge all table persistent data here during
567 scanning redo logs */
569
570 /** Encryption Key information per tablespace ID */
572
573 /** Tablespace IDs that were ignored during redo log apply. */
575
576 /** Tablespace IDs that were explicitly deleted. */
578
579 /** Registry of Per-thread Redo_applier instances.
580 To access Redo_applier for this thread use -> operator.
581 Do not use after recv_sys_finish(). */
583};
584
585/** The recovery system */
586extern recv_sys_t *recv_sys;
587
588/** true when applying redo log records during crash recovery; false
589otherwise. Note that this is false while a background thread is
590rolling back incomplete transactions. */
591extern volatile bool recv_recovery_on;
592
593/** true when recv_init_crash_recovery() has been called. */
594extern bool recv_needed_recovery;
595
596/** true if buf_page_is_corrupted() should check if the log sequence
597number (FIL_PAGE_LSN) is in the future. Initially false, and set by
598recv_recovery_from_checkpoint_start(). */
599extern bool recv_lsn_checks_on;
600
601/** Size of the parsing buffer; it must accommodate RECV_SCAN_SIZE many
602times! */
603constexpr uint32_t RECV_PARSING_BUF_SIZE = 2 * 1024 * 1024;
604
605/** Size of block reads when the log groups are scanned forward to do a
606roll-forward */
607#define RECV_SCAN_SIZE (4 * UNIV_PAGE_SIZE)
608
610
611#ifdef UNIV_HOTBACKUP
612/* Following functions are defined in Redo Log Handler implementation but are
613exposed to MEB as it needs them and is not following Handler_interface.
614*/
615[[nodiscard]] dberr_t recv_parse_and_apply_log_recs(size_t max_mem);
617void recv_reset_buffer();
619#endif
620
621#include "log0recv.ic"
622
623#endif
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:49
uint32_t page_no_t
Page number.
Definition: api0api.h:47
The database buffer pool global types for the directory.
buf_flush_t
Flags for flush types.
Definition: buf0types.h:68
Definition: sql_list.h:494
Class to parse persistent dynamic metadata redo log, store and merge them and apply them to in-memory...
Definition: log0recv.h:378
MetadataRecover() 1=default
Default constructor.
const byte * parseMetadataLog(table_id_t id, uint64_t version, const byte *ptr, const byte *end)
Parse a dynamic metadata redo log of a table and store the metadata locally.
Definition: log0recv.cc:257
bool empty() const
If there is any metadata to be applied.
Definition: log0recv.h:407
void store()
Store the collected persistent dynamic metadata to mysql.innodb_dynamic_metadata.
Definition: log0recv.cc:582
PersistentTableMetadata * getMetadata(table_id_t id)
Get the dynamic metadata of a specified table, create a new one if not exist.
Definition: log0recv.cc:231
PersistentTables m_tables
Map used to store and merge persistent dynamic metadata.
Definition: log0recv.h:418
std::map< table_id_t, PersistentTableMetadata *, std::less< table_id_t >, ut::allocator< std::pair< const table_id_t, PersistentTableMetadata * > > > PersistentTables
Definition: log0recv.h:381
Persistent dynamic metadata for a table.
Definition: dict0mem.h:2811
Redo recovery configuration.
Definition: buf0dblwr.h:481
Registry of per-thread Redo_applier instances, which can be all freed by calling reset().
Definition: log0recv.h:69
ut::unique_ptr< Storage > m_storage
Definition: log0recv.h:100
Redo_applier_registry()
Definition: log0recv.h:73
Redo_applier_registry(const Redo_applier_registry &)=delete
Redo_applier_registry & operator=(const Redo_applier_registry &)=delete
ib::redo::Redo_applier * operator->()
Return the Redo_applier associated with the calling thread.
Definition: log0recv.h:94
void reset()
Destroy all per-thread appliers owned by this registry.
Definition: log0recv.h:86
This class allows to parse and apply redo records.
Definition: log0redo.h:341
Registry of per-thread values owned by one enclosing object.
Definition: ut0per_thread.h:42
A counter which tracks number of things left to do, which can be incremented or decremented,...
Definition: ut0todo_counter.h:41
Allocator that allows std containers to manage their memory through ut::malloc* and ut::free library ...
Definition: ut0new.h:2023
dberr_t
Definition: db0err.h:39
Data dictionary global types.
ib_id_t table_id_t
Table or partition identifier (unique within an InnoDB instance).
Definition: dict0types.h:216
mysql_service_status_t recv(const char *tag, const unsigned char *data, size_t data_length) noexcept
Definition: gr_message_service_example.cc:39
The simple hash table utility.
static void recv_reset_buffer()
Moves the parsing buffer data left to the buffer start.
Definition: log0recv.cc:2124
dberr_t recv_parse_and_apply_log_recs(size_t mem_limit)
Parse log records from a buffer and stores them to a hash table.
Definition: log0recv.cc:2081
bool recv_sys_resize_buf()
Resize the recovery parsing buffer up to log_buffer_size.
Definition: log0recv.cc:312
void recv_track_changes_of_recovered_lsn()
Definition: log0recv.cc:1801
dberr_t recv_recovery_begin(lsn_t checkpoint_lsn)
Scans log from a stream and stores new log data to the parsing buffer.
Definition: log0recv.cc:2134
MetadataRecover * recv_recovery_from_checkpoint_finish(bool aborting)
Complete the recovery from the latest checkpoint.
Definition: log0recv.cc:2465
void recv_sys_free()
Frees the recovery system.
Definition: log0recv.cc:667
void recv_sys_init()
Inits the recovery system for a recovery operation.
Definition: log0recv.cc:469
recv_addr_state
States of recv_addr_t.
Definition: log0recv.h:333
@ RECV_BEING_READ
page is being read
Definition: log0recv.h:339
@ RECV_DISCARDED
log records have been discarded because the tablespace does not exist
Definition: log0recv.h:349
@ RECV_BEING_PROCESSED
log records are being applied on the page
Definition: log0recv.h:342
@ RECV_NOT_PROCESSED
not yet processed
Definition: log0recv.h:336
@ RECV_PROCESSED
log records have been applied on the page
Definition: log0recv.h:345
bool log_block_checksum_is_ok(const byte *block)
Check the 4-byte checksum to the trailer checksum field of a log block.
Definition: log0handler.cc:1731
lsn_t recv_calc_lsn_on_data_add(lsn_t lsn, os_offset_t len)
Calculates the new value for lsn when more data is added to the log.
Definition: log0recv.cc:201
void recv_sys_close()
Release recovery system mutexes.
Definition: log0recv.cc:380
constexpr uint32_t RECV_PARSING_BUF_SIZE
Size of the parsing buffer; it must accommodate RECV_SCAN_SIZE many times!
Definition: log0recv.h:603
dberr_t recv_verify_log_is_clean_pre_8_0_30(log_t &log)
Determine if a redo log from a version before MySQL 8.0.30 is clean.
size_t recv_n_frames_for_pages_per_pool_instance
This many blocks must be left in each Buffer Pool instance to be managed by the LRU when we scan the ...
Definition: log0recv.cc:169
void recv_sys_var_init()
Reset the state of the recovery system variables.
Definition: log0recv.cc:413
bool recv_page_is_brand_new(buf_block_t *block)
Returns true if the page is brand new (the next log record is init_file_page or no records to apply).
Definition: log0recv.cc:1367
static void recv_recover_page(bool jri, buf_block_t *block)
Wrapper for recv_recover_page_func().
Definition: log0recv.h:204
dberr_t recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
Recovers all tablespaces from the redo log.
Definition: log0recv.cc:2387
const char * get_mlog_string(mlog_id_t type)
Return string name of the redo log record type.
Definition: log0recv.cc:2516
recv_sys_t * recv_sys
The recovery system.
Definition: log0recv.cc:104
bool recv_needed_recovery
true when recv_init_crash_recovery() has been called.
Definition: log0recv.cc:153
void recv_sys_create()
Creates the recovery system.
Definition: log0recv.cc:298
static bool recv_recovery_is_on()
Returns true if recovery is currently running.
volatile bool recv_recovery_on
true when applying redo log records during crash recovery; false otherwise.
Definition: log0recv.cc:109
bool recv_lsn_checks_on
true if buf_page_is_corrupted() should check if the log sequence number (FIL_PAGE_LSN) is in the futu...
Definition: log0recv.cc:158
void recv_recover_page_func(bool just_read_in, buf_block_t *block)
Applies the hashed log records to the page, if the page lsn is less than the lsn of a log record.
Definition: log0recv.cc:1522
Recovery.
Redo log parsing and applying.
Redo log - the log_sys.
uint64_t lsn_t
Type used for all log sequence number storage and arithmetic.
Definition: log0types.h:63
Mini-transaction buffer global types.
mlog_id_t
Definition: mtr0types.h:63
Definition: buf0block_hint.cc:30
Definition: buf0dblwr.cc:79
Definition: log0common.h:32
Unique_ptr< T, std::nullptr_t > make_unique(size_t size)
In-place constructs a new unique pointer with no specific allocator and with array type T.
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
This file contains a set of libraries providing overloads for regular dynamic allocation routines whi...
Definition: aligned_alloc.h:48
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2742
std::conditional_t< !std::is_array< T >::value, std::unique_ptr< T, detail::Deleter< T > >, std::conditional_t< detail::is_unbounded_array_v< T >, std::unique_ptr< T, detail::Array_deleter< std::remove_extent_t< T > > >, void > > unique_ptr
The following is a common type that is returned by all the ut::make_unique (non-aligned) specializati...
Definition: ut0new.h:2284
The interface to the operating system file io.
uint64_t os_offset_t
File offset in bytes.
Definition: os0file.h:87
required uint64 version
Definition: replication_group_member_actions.proto:41
required string type
Definition: replication_group_member_actions.proto:34
case opt name
Definition: sslopt-case.h:29
The buffer control block structure.
Definition: buf0buf.h:1759
Redo log - single data structure with state of the redo log system.
Definition: log0sys.h:77
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:295
InnoDB condition variable.
Definition: os0event.cc:63
Hashed page file address struct.
Definition: log0recv.h:353
page_no_t page_no
Page number.
Definition: log0recv.h:363
recv_addr_state state
recovery state of the page
Definition: log0recv.h:357
space_id_t space
Space ID.
Definition: log0recv.h:360
List rec_list
List of log records for this page.
Definition: log0recv.h:366
Block of log record data.
Definition: log0recv.h:297
recv_data_t * next
pointer to the next block or NULL.
Definition: log0recv.h:302
Definition: log0recv.h:449
byte * ptr
Encryption key.
Definition: log0recv.h:457
space_id_t space_id
Tablespace ID.
Definition: log0recv.h:451
byte * iv
Encryption IV.
Definition: log0recv.h:460
lsn_t lsn
LSN of REDO log encryption entry.
Definition: log0recv.h:454
Every space has its own heap and pages that belong to it.
Definition: log0recv.h:428
Pages m_pages
Pages that need to be recovered.
Definition: log0recv.h:440
mem_heap_t * m_heap
Memory heap of log records and file addresses.
Definition: log0recv.h:437
Space(mem_heap_t *heap)
Constructor.
Definition: log0recv.h:431
Space()
Default constructor.
Definition: log0recv.h:434
Recovery system data structure.
Definition: log0recv.h:422
std::vector< Encryption_Key > Encryption_Keys
Definition: log0recv.h:463
Missing_Ids deleted
Tablespace IDs that were explicitly deleted.
Definition: log0recv.h:577
ulint len
Amount of data in buf.
Definition: log0recv.h:506
ib::redo::Redo_applier_registry per_thread_applier
Registry of Per-thread Redo_applier instances.
Definition: log0recv.h:582
ib_mutex_t mutex
mutex protecting the fields apply_log_recs, decrements of n_pages_to_recover, and the state field in ...
Definition: log0recv.h:469
bool is_meb_db
Data directory has been recognized as data directory from MEB.
Definition: log0recv.h:547
lsn_t previous_recovered_lsn
The previous value of recovered_lsn - before we parsed the last mtr.
Definition: log0recv.h:532
os_event_t flush_end
event to signal that the page cleaner has finished the request
Definition: log0recv.h:479
dblwr::recv::DBLWR * dblwr
Doublewrite buffer pages, destroyed after recovery completes.
Definition: log0recv.h:564
Spaces * spaces
Hash table of pages, indexed by SpaceID.
Definition: log0recv.h:555
lsn_t recovered_lsn
The log records have been parsed up to this lsn.
Definition: log0recv.h:526
ut::Todo_counter n_pages_to_recover
Number of unique unprocessed page ids in the spaces nested hash table.
Definition: log0recv.h:561
ulint recovered_offset
Start offset of non-parsed log records in buf.
Definition: log0recv.h:523
lsn_t last_block_first_mtr_boundary
Tracks what should be the proper value of first_rec_group field in the header of the block to which r...
Definition: log0recv.h:537
std::unordered_map< page_no_t, recv_addr_t *, std::hash< page_no_t >, std::equal_to< page_no_t > > Pages
Definition: log0recv.h:425
std::unordered_map< space_id_t, Space, std::hash< space_id_t >, std::equal_to< space_id_t > > Spaces
Definition: log0recv.h:446
ib_mutex_t writer_mutex
mutex coordinating flushing between recv_writer_thread and the recovery thread.
Definition: log0recv.h:473
bool is_cloned_db
Data directory has been recognized as cloned data directory.
Definition: log0recv.h:544
os_event_t flush_start
event to activate page cleaner threads
Definition: log0recv.h:476
Missing_Ids missing_ids
Tablespace IDs that were ignored during redo log apply.
Definition: log0recv.h:574
std::unordered_set< space_id_t > Missing_Ids
Definition: log0recv.h:443
lsn_t checkpoint_lsn
Checkpoint lsn that was used during recovery (read from file).
Definition: log0recv.h:514
uint32_t scanned_epoch_no
The log data has been scanned up to this epoch_no.
Definition: log0recv.h:520
size_t buf_len
Size of the parsing buffer.
Definition: log0recv.h:503
buf_flush_t flush_type
type of the flush request.
Definition: log0recv.h:483
Encryption_Keys * keys
Encryption Key information per tablespace ID.
Definition: log0recv.h:571
bool dblwr_state
Doublewrite buffer state before MEB recovery starts.
Definition: log0recv.h:552
bool found_corrupt_log
Set when finding a corrupt log block or record, or there is a log parsing buffer overflow.
Definition: log0recv.h:541
lsn_t parse_start_lsn
This is the lsn from which we were able to start parsing log records and adding them to the hash tabl...
Definition: log0recv.h:511
lsn_t scanned_lsn
The log data has been scanned up to this lsn.
Definition: log0recv.h:517
byte * buf
Buffer for parsing log records.
Definition: log0recv.h:500
bool apply_log_recs
This is true when log rec application to pages is allowed; this flag tells the i/o-handler if it shou...
Definition: log0recv.h:497
MetadataRecover * metadata_recover
We store and merge all table persistent data here during scanning redo logs.
Definition: log0recv.h:568
Stored log record struct.
Definition: log0recv.h:306
recv_data_t * data
Chain of blocks containing the log record body.
Definition: log0recv.h:316
lsn_t start_lsn
Start lsn of the log segment written by the mtr which generated this log record: NOTE that this is no...
Definition: log0recv.h:321
UT_LIST_NODE_T(recv_t) Node
Definition: log0recv.h:307
ulint len
Log record body length in bytes.
Definition: log0recv.h:313
lsn_t end_lsn
End lsn of the log segment written by the mtr which generated this log record: NOTE that this is not ...
Definition: log0recv.h:326
Node rec_list
List node, list anchored in recv_addr_t.
Definition: log0recv.h:329
mlog_id_t type
Log record type.
Definition: log0recv.h:310
typedef UT_LIST_BASE_NODE_T(rw_lock_t, list) rw_lock_list_t
#define UNIV_NOTHROW
Definition: univ.i:459
unsigned long int ulint
Definition: univ.i:403
Utilities for byte operations.
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:97
#define UT_LIST_NODE_T(t)
Macro used for legacy reasons.
Definition: ut0lst.h:64
Dynamic memory allocation routines and custom allocators specifically crafted to support memory instr...
#define UT_NEW_THIS_FILE_PSI_KEY
Definition: ut0new.h:408
static uint64_t lsn
Definition: xcom_base.cc:446