MySQL 26.7.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 "ut0todo_counter.h"
51
52#include <list>
53#include <unordered_map>
54#include <unordered_set>
55
56class MetadataRecover;
58
59#ifdef UNIV_HOTBACKUP
60
61struct recv_addr_t;
62
63/** list of tablespaces, that experienced an inplace DDL during a backup op */
64extern std::list<std::pair<space_id_t, lsn_t>> index_load_list;
65
66/** Scans the log segment and n_bytes_scanned is set to the length of valid
67log scanned.
68@param[in] buf buffer containing log data
69@param[in] buf_len data length in that buffer
70@param[in,out] scanned_lsn lsn of buffer start, we return scanned
71lsn
72@param[in,out] scanned_checkpoint_no 4 lowest bytes of the highest scanned
73@param[out] block_no highest block no in scanned buffer.
74checkpoint number so far
75@param[out] n_bytes_scanned how much we were able to scan, smaller
76than buf_len if log data ended here
77@param[out] has_encrypted_log set true, if buffer contains encrypted
78redo log, set false otherwise */
79void meb_scan_log_seg(byte *buf, size_t buf_len, lsn_t *scanned_lsn,
80 uint32_t *scanned_checkpoint_no, uint32_t *block_no,
81 size_t *n_bytes_scanned, bool *has_encrypted_log);
82
83/** Applies the hashed log records to the page, if the page lsn is less than the
84lsn of a log record. This can be called when a buffer page has just been
85read in, or also for a page already in the buffer pool.
86
87
88@param[in,out] block buffer block */
90
91/** Wrapper for recv_recover_page_func().
92Applies the hashed log records to the page, if the page lsn is less than the
93lsn of a log record. This can be called when a buffer page has just been
94read in, or also for a page already in the buffer pool.
95@param jri in: true if just read in (the i/o handler calls this for
96a freshly read page)
97@param block in,out: the buffer block
98*/
99static inline void recv_recover_page(bool jri [[maybe_unused]],
100 buf_block_t *block) {
102}
103
104/** Applies log records in the hash table to a backup. */
105void meb_apply_log_recs(void);
106
107/** Applies log records in the hash table to a backup using a callback
108functions.
109@param[in] apply_log_record_function function for apply
110@param[in] wait_till_done_function function for wait */
111void meb_apply_log_recs_via_callback(
112 void (*apply_log_record_function)(recv_addr_t *),
113 void (*wait_till_done_function)());
114
115/** Applies a log record in the hash table to a backup.
116@param[in] recv_addr chain of log records
117@param[in,out] block buffer block to apply the records to */
118void meb_apply_log_record(recv_addr_t *recv_addr, buf_block_t *block);
119
120/** Process a file name passed as an input
121@param[in] name absolute path of tablespace file
122@param[in] space_id the tablespace ID
123@retval true if able to process file successfully.
124@retval false if unable to process the file */
125void meb_fil_name_process(const char *name, space_id_t space_id);
126
127/** Scans log from a buffer and stores new log data to the parsing buffer.
128Parses and hashes the log records if new data found.
129@param[in] buf buffer containing a log
130segment or garbage
131@param[in] len buffer length
132@param[in] start_lsn buffer start lsn
133@param[out] group_scanned_lsn scanning succeeded up to this lsn
134@retval true if limit_lsn has been reached, or not able to scan any
135more in this log group
136@retval false otherwise */
137[[nodiscard]] bool meb_scan_log_recs(const byte *buf, size_t len,
138 lsn_t start_lsn, lsn_t *group_scanned_lsn);
139#else /* UNIV_HOTBACKUP */
140
141/** Applies the hashed log records to the page, if the page lsn is less than the
142lsn of a log record. This can be called when a buffer page has just been
143read in, or also for a page already in the buffer pool.
144
145
146@param[in] just_read_in true if the IO handler calls this for a freshly
147 read page
148@param[in,out] block buffer block */
149void recv_recover_page_func(bool just_read_in, buf_block_t *block);
150
151/** Wrapper for recv_recover_page_func().
152Applies the hashed log records to the page, if the page lsn is less than the
153lsn of a log record. This can be called when a buffer page has just been
154read in, or also for a page already in the buffer pool.
155@param jri in: true if just read in (the i/o handler calls this for
156a freshly read page)
157@param[in,out] block buffer block */
158static inline void recv_recover_page(bool jri, buf_block_t *block) {
159 recv_recover_page_func(jri, block);
160}
161
162#endif /* UNIV_HOTBACKUP */
163
164/** Check the 4-byte checksum to the trailer checksum field of a log
165block.
166@param[in] block pointer to a log block
167@return whether the checksum matches */
168[[nodiscard]] bool log_block_checksum_is_ok(const byte *block);
169
170/** Frees the recovery system. */
171void recv_sys_free();
172
173/** Reset the state of the recovery system variables. */
174void recv_sys_var_init();
175
176#ifdef UNIV_HOTBACKUP
177/** Get the number of bytes used by all the heaps
178@return number of bytes used */
179size_t meb_heap_used();
180#endif /* UNIV_HOTBACKUP */
181
182/** Returns true if recovery is currently running.
183@return recv_recovery_on */
184[[nodiscard]] static inline bool recv_recovery_is_on();
185
186/** Returns true if the page is brand new (the next log record is init_file_page
187or no records to apply).
188@param[in] block buffer block
189@return true if brand new */
191
192/** Recovers all tablespaces from the redo log.
193@see recv_recovery_from_checkpoint_finish
194@param[in] flush_lsn lsn stored at offset FIL_PAGE_FILE_FLUSH_LSN
195 in the system tablespace header
196@return error code or DB_SUCCESS */
197[[nodiscard]] dberr_t recv_recovery_from_checkpoint_start(lsn_t flush_lsn);
198
199/** Determine if a redo log from a version before MySQL 8.0.30 is clean.
200@param[in,out] log redo log
201@return error code
202@retval DB_SUCCESS if the redo log is clean
203@retval DB_ERROR if the redo log is corrupted or dirty */
205
206/** Complete the recovery from the latest checkpoint.
207@param[in] aborting true if the server has to abort due to an error
208@return recovered persistent metadata or nullptr if aborting*/
210 bool aborting);
211
212#ifndef UNIV_HOTBACKUP
213/** Scans log from a stream and stores new log data to the parsing buffer.
214Parses and hashes the log records if new data found. Each time the hash
215table gets full (see max_mem), it will apply all the records from the
216hashmap to the pages ("a batch"), clearing the hashmap, and continuing
217this way till the end of stream.
218@param[in] checkpoint_lsn log sequence number found in checkpoint
219 header. May be inexact (in a middle of
220 an mtr which we can ignore, as it is
221 already applied to tablespace files)
222 until which all redo log has been
223 scanned */
224[[nodiscard]] dberr_t recv_recovery_begin(lsn_t checkpoint_lsn);
225#endif /* !UNIV_HOTBACKUP */
226
227/** Creates the recovery system. */
228void recv_sys_create();
229
230/** Release recovery system mutexes. */
231void recv_sys_close();
232
233/** Inits the recovery system for a recovery operation. */
234void recv_sys_init();
235
236/** Calculates the new value for lsn when more data is added to the log.
237@param[in] lsn Old LSN
238@param[in] len This many bytes of data is added, log block
239 headers not included
240@return LSN after data addition */
242
243#if defined(UNIV_DEBUG) || defined(UNIV_HOTBACKUP)
244/** Return string name of the redo log record type.
245@param[in] type record log record enum
246@return string name of record log record */
247const char *get_mlog_string(mlog_id_t type);
248#endif /* UNIV_DEBUG || UNIV_HOTBACKUP */
249
250/** Block of log record data */
252 /** pointer to the next block or NULL. The log record data
253 is stored physically immediately after this struct, max amount
254 RECV_DATA_BLOCK_SIZE bytes of it */
255
257};
258
259/** Stored log record struct */
260struct recv_t {
262
263 /** Log record type */
265
266 /** Log record body length in bytes */
268
269 /** Chain of blocks containing the log record body */
271
272 /** Start lsn of the log segment written by the mtr which generated
273 this log record: NOTE that this is not necessarily the start lsn of
274 this log record */
276
277 /** End lsn of the log segment written by the mtr which generated
278 this log record: NOTE that this is not necessarily the end LSN of
279 this log record */
281
282 /** List node, list anchored in recv_addr_t */
284};
285
286/** States of recv_addr_t */
288
289 /** not yet processed */
291
292 /** page is being read */
294
295 /** log records are being applied on the page */
297
298 /** log records have been applied on the page */
300
301 /** log records have been discarded because the tablespace
302 does not exist */
305
306/** Hashed page file address struct */
309
310 /** recovery state of the page */
312
313 /** Space ID */
315
316 /** Page number */
318
319 /** List of log records for this page */
321};
322
323// Forward declaration
324namespace dblwr {
325namespace recv {
326class DBLWR;
327}
328} // namespace dblwr
329
330/** Class to parse persistent dynamic metadata redo log, store and
331merge them and apply them to in-memory table objects finally */
334 table_id_t, PersistentTableMetadata *, std::less<table_id_t>,
336
337 public:
338 /** Default constructor */
340
341 /** Destructor */
343
344 /** Parse a dynamic metadata redo log of a table and store
345 the metadata locally
346 @param[in] id table id
347 @param[in] version table dynamic metadata version
348 @param[in] ptr redo log start
349 @param[in] end end of redo log
350 @retval ptr to next redo log record, nullptr if this log record
351 was truncated */
352 const byte *parseMetadataLog(table_id_t id, uint64_t version, const byte *ptr,
353 const byte *end);
354
355 /** Store the collected persistent dynamic metadata to
356 mysql.innodb_dynamic_metadata */
357 void store();
358
359 /** If there is any metadata to be applied
360 @return true if any metadata to be applied, otherwise false */
361 bool empty() const { return m_tables.empty(); }
362
363 private:
364 /** Get the dynamic metadata of a specified table,
365 create a new one if not exist
366 @param[in] id table id
367 @return the metadata of the specified table */
369
370 private:
371 /** Map used to store and merge persistent dynamic metadata */
373};
374
375/** Recovery system data structure */
377 using Pages =
378 std::unordered_map<page_no_t, recv_addr_t *, std::hash<page_no_t>,
379 std::equal_to<page_no_t>>;
380
381 /** Every space has its own heap and pages that belong to it. */
382 struct Space {
383 /** Constructor
384 @param[in,out] heap Heap to use for the log records. */
385 explicit Space(mem_heap_t *heap) : m_heap(heap), m_pages() {}
386
387 /** Default constructor */
388 Space() : m_heap(), m_pages() {}
389
390 /** Memory heap of log records and file addresses */
392
393 /** Pages that need to be recovered */
395 };
396
397 using Missing_Ids = std::unordered_set<space_id_t>;
398
399 using Spaces = std::unordered_map<space_id_t, Space, std::hash<space_id_t>,
400 std::equal_to<space_id_t>>;
401
402 /* Recovery encryption information */
404 /** Tablespace ID */
406
407 /** LSN of REDO log encryption entry */
409
410 /** Encryption key */
411 byte *ptr;
412
413 /** Encryption IV */
414 byte *iv;
415 };
416
417 using Encryption_Keys = std::vector<Encryption_Key>;
418
419#ifndef UNIV_HOTBACKUP
420
421 /** mutex protecting the fields apply_log_recs, decrements of
422 n_pages_to_recover, and the state field in each recv_addr struct */
423 ib_mutex_t mutex;
424
425 /** mutex coordinating flushing between recv_writer_thread and
426 the recovery thread. */
427 ib_mutex_t writer_mutex;
428
429 /** event to activate page cleaner threads */
431
432 /** event to signal that the page cleaner has finished the request */
434
435 /** type of the flush request. BUF_FLUSH_LRU: flush end of LRU,
436 keeping free blocks. BUF_FLUSH_LIST: flush all of blocks. */
438
439#else /* !UNIV_HOTBACKUP */
440 /** This is true when the space log record needs to be applied */
441 bool apply_file_operations;
442
443 /** This is true when an inconsistency with the file system contents
444 is detected during log scan or apply */
445 bool found_corrupt_fs;
446#endif /* !UNIV_HOTBACKUP */
447
448 /** This is true when log rec application to pages is allowed;
449 this flag tells the i/o-handler if it should do log record
450 application */
452
453 /** Buffer for parsing log records */
454 byte *buf;
455
456 /** Size of the parsing buffer */
457 size_t buf_len;
458
459 /** Amount of data in buf */
461
462 /** This is the lsn from which we were able to start parsing
463 log records and adding them to the hash table; zero if a suitable
464 start point not found yet */
466
467 /** Checkpoint lsn that was used during recovery (read from file). */
469
470 /** The log data has been scanned up to this lsn */
472
473 /** The log data has been scanned up to this epoch_no */
475
476 /** Start offset of non-parsed log records in buf */
478
479 /** The log records have been parsed up to this lsn */
481
482 /** The previous value of recovered_lsn - before we parsed the last mtr.
483 It is equal to recovered_lsn before we parsed any mtr. This is used to
484 find moments in which recovered_lsn moves to the next block in which case
485 we should update the last_block_first_mtr_boundary (described below). */
487
488 /** Tracks what should be the proper value of first_rec_group field in the
489 header of the block to which recovered_lsn belongs. It might be also zero,
490 in which case it means we do not know. */
492
493 /** Set when finding a corrupt log block or record, or there
494 is a log parsing buffer overflow */
496
497 /** Data directory has been recognized as cloned data directory. */
499
500 /** Data directory has been recognized as data directory from MEB. */
502
503 /** Doublewrite buffer state before MEB recovery starts. We restore to this
504 state after MEB recovery completes and disable the doublewrite buffer during
505 MEB recovery. */
507
508 /** Hash table of pages, indexed by SpaceID. */
510
511 /** Number of unique unprocessed page ids in the spaces nested hash table.
512 Increments are done only from the main recovery thread before apply starts.
513 Decrements are done from multiple threads during batch apply phase, and are
514 protected by the recv_sys_t::mutex. */
516
517 /** Doublewrite buffer pages, destroyed after recovery completes */
519
520 /** We store and merge all table persistent data here during
521 scanning redo logs */
523
524 /** Encryption Key information per tablespace ID */
526
527 /** Tablespace IDs that were ignored during redo log apply. */
529
530 /** Tablespace IDs that were explicitly deleted. */
532
533 /** Redo log applier. */
535};
536
537/** The recovery system */
538extern recv_sys_t *recv_sys;
539
540/** true when applying redo log records during crash recovery; false
541otherwise. Note that this is false while a background thread is
542rolling back incomplete transactions. */
543extern volatile bool recv_recovery_on;
544
545/** true when recv_init_crash_recovery() has been called. */
546extern bool recv_needed_recovery;
547
548/** true if buf_page_is_corrupted() should check if the log sequence
549number (FIL_PAGE_LSN) is in the future. Initially false, and set by
550recv_recovery_from_checkpoint_start(). */
551extern bool recv_lsn_checks_on;
552
553/** Size of the parsing buffer; it must accommodate RECV_SCAN_SIZE many
554times! */
555constexpr uint32_t RECV_PARSING_BUF_SIZE = 2 * 1024 * 1024;
556
557/** Size of block reads when the log groups are scanned forward to do a
558roll-forward */
559#define RECV_SCAN_SIZE (4 * UNIV_PAGE_SIZE)
560
562
563#ifdef UNIV_HOTBACKUP
564/* Following functions are defined in Redo Log Handler implementation but are
565exposed to MEB as it needs them and is not following Handler_interface.
566*/
567[[nodiscard]] dberr_t recv_parse_and_apply_log_recs(size_t max_mem);
569void recv_reset_buffer();
571#endif
572
573#include "log0recv.ic"
574
575#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:332
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:256
bool empty() const
If there is any metadata to be applied.
Definition: log0recv.h:361
void store()
Store the collected persistent dynamic metadata to mysql.innodb_dynamic_metadata.
Definition: log0recv.cc:583
PersistentTableMetadata * getMetadata(table_id_t id)
Get the dynamic metadata of a specified table, create a new one if not exist.
Definition: log0recv.cc:230
PersistentTables m_tables
Map used to store and merge persistent dynamic metadata.
Definition: log0recv.h:372
std::map< table_id_t, PersistentTableMetadata *, std::less< table_id_t >, ut::allocator< std::pair< const table_id_t, PersistentTableMetadata * > > > PersistentTables
Definition: log0recv.h:335
Persistent dynamic metadata for a table.
Definition: dict0mem.h:2811
Redo recovery configuration.
Definition: buf0dblwr.h:481
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:2041
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:1998
bool recv_sys_resize_buf()
Resize the recovery parsing buffer up to log_buffer_size.
Definition: log0recv.cc:311
void recv_track_changes_of_recovered_lsn()
Definition: log0recv.cc:1718
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:2051
MetadataRecover * recv_recovery_from_checkpoint_finish(bool aborting)
Complete the recovery from the latest checkpoint.
Definition: log0recv.cc:2382
void recv_sys_free()
Frees the recovery system.
Definition: log0recv.cc:668
void recv_sys_init()
Inits the recovery system for a recovery operation.
Definition: log0recv.cc:467
recv_addr_state
States of recv_addr_t.
Definition: log0recv.h:287
@ RECV_BEING_READ
page is being read
Definition: log0recv.h:293
@ RECV_DISCARDED
log records have been discarded because the tablespace does not exist
Definition: log0recv.h:303
@ RECV_BEING_PROCESSED
log records are being applied on the page
Definition: log0recv.h:296
@ RECV_NOT_PROCESSED
not yet processed
Definition: log0recv.h:290
@ RECV_PROCESSED
log records have been applied on the page
Definition: log0recv.h:299
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:1544
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:200
void recv_sys_close()
Release recovery system mutexes.
Definition: log0recv.cc:378
constexpr uint32_t RECV_PARSING_BUF_SIZE
Size of the parsing buffer; it must accommodate RECV_SCAN_SIZE many times!
Definition: log0recv.h:555
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:168
void recv_sys_var_init()
Reset the state of the recovery system variables.
Definition: log0recv.cc:411
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:1284
static void recv_recover_page(bool jri, buf_block_t *block)
Wrapper for recv_recover_page_func().
Definition: log0recv.h:158
dberr_t recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
Recovers all tablespaces from the redo log.
Definition: log0recv.cc:2304
const char * get_mlog_string(mlog_id_t type)
Return string name of the redo log record type.
Definition: log0recv.cc:2433
recv_sys_t * recv_sys
The recovery system.
Definition: log0recv.cc:103
bool recv_needed_recovery
true when recv_init_crash_recovery() has been called.
Definition: log0recv.cc:152
void recv_sys_create()
Creates the recovery system.
Definition: log0recv.cc:297
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:108
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:157
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:1439
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
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
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:1756
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:307
page_no_t page_no
Page number.
Definition: log0recv.h:317
recv_addr_state state
recovery state of the page
Definition: log0recv.h:311
space_id_t space
Space ID.
Definition: log0recv.h:314
List rec_list
List of log records for this page.
Definition: log0recv.h:320
Block of log record data.
Definition: log0recv.h:251
recv_data_t * next
pointer to the next block or NULL.
Definition: log0recv.h:256
Definition: log0recv.h:403
byte * ptr
Encryption key.
Definition: log0recv.h:411
space_id_t space_id
Tablespace ID.
Definition: log0recv.h:405
byte * iv
Encryption IV.
Definition: log0recv.h:414
lsn_t lsn
LSN of REDO log encryption entry.
Definition: log0recv.h:408
Every space has its own heap and pages that belong to it.
Definition: log0recv.h:382
Pages m_pages
Pages that need to be recovered.
Definition: log0recv.h:394
mem_heap_t * m_heap
Memory heap of log records and file addresses.
Definition: log0recv.h:391
Space(mem_heap_t *heap)
Constructor.
Definition: log0recv.h:385
Space()
Default constructor.
Definition: log0recv.h:388
Recovery system data structure.
Definition: log0recv.h:376
std::vector< Encryption_Key > Encryption_Keys
Definition: log0recv.h:417
Missing_Ids deleted
Tablespace IDs that were explicitly deleted.
Definition: log0recv.h:531
ulint len
Amount of data in buf.
Definition: log0recv.h:460
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:423
bool is_meb_db
Data directory has been recognized as data directory from MEB.
Definition: log0recv.h:501
lsn_t previous_recovered_lsn
The previous value of recovered_lsn - before we parsed the last mtr.
Definition: log0recv.h:486
os_event_t flush_end
event to signal that the page cleaner has finished the request
Definition: log0recv.h:433
dblwr::recv::DBLWR * dblwr
Doublewrite buffer pages, destroyed after recovery completes.
Definition: log0recv.h:518
Spaces * spaces
Hash table of pages, indexed by SpaceID.
Definition: log0recv.h:509
lsn_t recovered_lsn
The log records have been parsed up to this lsn.
Definition: log0recv.h:480
ut::Todo_counter n_pages_to_recover
Number of unique unprocessed page ids in the spaces nested hash table.
Definition: log0recv.h:515
ulint recovered_offset
Start offset of non-parsed log records in buf.
Definition: log0recv.h:477
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:491
std::unordered_map< page_no_t, recv_addr_t *, std::hash< page_no_t >, std::equal_to< page_no_t > > Pages
Definition: log0recv.h:379
std::unordered_map< space_id_t, Space, std::hash< space_id_t >, std::equal_to< space_id_t > > Spaces
Definition: log0recv.h:400
ib_mutex_t writer_mutex
mutex coordinating flushing between recv_writer_thread and the recovery thread.
Definition: log0recv.h:427
bool is_cloned_db
Data directory has been recognized as cloned data directory.
Definition: log0recv.h:498
os_event_t flush_start
event to activate page cleaner threads
Definition: log0recv.h:430
Missing_Ids missing_ids
Tablespace IDs that were ignored during redo log apply.
Definition: log0recv.h:528
std::unordered_set< space_id_t > Missing_Ids
Definition: log0recv.h:397
lsn_t checkpoint_lsn
Checkpoint lsn that was used during recovery (read from file).
Definition: log0recv.h:468
uint32_t scanned_epoch_no
The log data has been scanned up to this epoch_no.
Definition: log0recv.h:474
size_t buf_len
Size of the parsing buffer.
Definition: log0recv.h:457
buf_flush_t flush_type
type of the flush request.
Definition: log0recv.h:437
Encryption_Keys * keys
Encryption Key information per tablespace ID.
Definition: log0recv.h:525
bool dblwr_state
Doublewrite buffer state before MEB recovery starts.
Definition: log0recv.h:506
ut::unique_ptr< ib::redo::Redo_applier > redo_applier
Redo log applier.
Definition: log0recv.h:534
bool found_corrupt_log
Set when finding a corrupt log block or record, or there is a log parsing buffer overflow.
Definition: log0recv.h:495
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:465
lsn_t scanned_lsn
The log data has been scanned up to this lsn.
Definition: log0recv.h:471
byte * buf
Buffer for parsing log records.
Definition: log0recv.h:454
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:451
MetadataRecover * metadata_recover
We store and merge all table persistent data here during scanning redo logs.
Definition: log0recv.h:522
Stored log record struct.
Definition: log0recv.h:260
recv_data_t * data
Chain of blocks containing the log record body.
Definition: log0recv.h:270
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:275
UT_LIST_NODE_T(recv_t) Node
Definition: log0recv.h:261
ulint len
Log record body length in bytes.
Definition: log0recv.h:267
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:280
Node rec_list
List node, list anchored in recv_addr_t.
Definition: log0recv.h:283
mlog_id_t type
Log record type.
Definition: log0recv.h:264
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_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...
static uint64_t lsn
Definition: xcom_base.cc:446