MySQL  8.0.21
Source Code Documentation
log0recv.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1997, 2020, Oracle and/or its affiliates. All Rights Reserved.
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 also distributed with certain software (including but not
10 limited to OpenSSL) that is licensed under separate terms, as designated in a
11 particular file or component or in included license documentation. The authors
12 of MySQL hereby grant you an additional permission to link the program and
13 your derivative works with the separately licensed software that they have
14 included with MySQL.
15 
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19 for more details.
20 
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 
25 *****************************************************************************/
26 
27 /** @file include/log0recv.h
28  Recovery
29 
30  Created 9/20/1997 Heikki Tuuri
31  *******************************************************/
32 
33 #ifndef log0recv_h
34 #define log0recv_h
35 
36 #include "buf0types.h"
37 #include "dict0types.h"
38 #include "hash0hash.h"
39 #include "log0types.h"
40 #include "mtr0types.h"
41 #include "os0file.h" /* OS_FILE_LOG_BLOCK_SIZE */
42 #include "univ.i"
43 #include "ut0byte.h"
44 #include "ut0new.h"
45 
46 #include <list>
47 #include <set>
48 #include <unordered_map>
49 
50 class MetadataRecover;
52 
53 #ifdef UNIV_HOTBACKUP
54 
55 struct recv_addr_t;
56 
57 /** list of tablespaces, that experienced an inplace DDL during a backup op */
58 extern std::list<std::pair<space_id_t, lsn_t>> index_load_list;
59 /** the last redo log flush len as seen by MEB */
60 extern volatile lsn_t backup_redo_log_flushed_lsn;
61 /** TRUE when the redo log is being backed up */
62 extern bool recv_is_making_a_backup;
63 
64 /** Scans the log segment and n_bytes_scanned is set to the length of valid
65 log scanned.
66 @param[in] buf buffer containing log data
67 @param[in] buf_len data length in that buffer
68 @param[in,out] scanned_lsn lsn of buffer start, we return scanned
69 lsn
70 @param[in,out] scanned_checkpoint_no 4 lowest bytes of the highest scanned
71 @param[out] block_no highest block no in scanned buffer.
72 checkpoint number so far
73 @param[out] n_bytes_scanned how much we were able to scan, smaller
74 than buf_len if log data ended here
75 @param[out] has_encrypted_log set true, if buffer contains encrypted
76 redo log, set false otherwise */
77 void meb_scan_log_seg(byte *buf, ulint buf_len, lsn_t *scanned_lsn,
78  uint32_t *scanned_checkpoint_no, uint32_t *block_no,
79  ulint *n_bytes_scanned, bool *has_encrypted_log);
80 
81 /** Applies the hashed log records to the page, if the page lsn is less than the
82 lsn of a log record. This can be called when a buffer page has just been
83 read in, or also for a page already in the buffer pool.
84 
85 TODO(Bug#31173032): Remove SUPPRESS_UBSAN_CLANG10.
86 
87 @param[in,out] block buffer block */
89 
90 /** Wrapper for recv_recover_page_func().
91 Applies the hashed log records to the page, if the page lsn is less than the
92 lsn of a log record. This can be called when a buffer page has just been
93 read in, or also for a page already in the buffer pool.
94 @param jri in: TRUE if just read in (the i/o handler calls this for
95 a freshly read page)
96 @param block in,out: the buffer block
97 */
98 #define recv_recover_page(jri, block) recv_recover_page_func(block)
99 
100 /** Applies log records in the hash table to a backup. */
101 void meb_apply_log_recs(void);
102 
103 /** Applies log records in the hash table to a backup using a callback
104 functions.
105 @param[in] apply_log_record_function function for apply
106 @param[in] wait_till_done_function function for wait */
107 void meb_apply_log_recs_via_callback(
108  void (*apply_log_record_function)(recv_addr_t *),
109  void (*wait_till_done_function)());
110 
111 /** Applies a log record in the hash table to a backup.
112 @param[in] recv_addr chain of log records
113 @param[in,out] block buffer block to apply the records to */
114 void meb_apply_log_record(recv_addr_t *recv_addr, buf_block_t *block);
115 
116 /** Process a file name passed as an input
117 @param[in] name absolute path of tablespace file
118 @param[in] space_id the tablespace ID
119 @retval true if able to process file successfully.
120 @retval false if unable to process the file */
121 void meb_fil_name_process(const char *name, space_id_t space_id);
122 
123 /** Scans log from a buffer and stores new log data to the parsing buffer.
124 Parses and hashes the log records if new data found. Unless
125 UNIV_HOTBACKUP is defined, this function will apply log records
126 automatically when the hash table becomes full.
127 @param[in] available_memory we let the hash table of recs
128 to grow to this size, at the maximum
129 @param[in] buf buffer containing a log
130 segment or garbage
131 @param[in] len buffer length
132 @param[in] checkpoint_lsn latest checkpoint LSN
133 @param[in] start_lsn buffer start lsn
134 @param[in] contiguous_lsn it is known that all log
135 groups contain contiguous log data up to this lsn
136 @param[out] group_scanned_lsn scanning succeeded up to this lsn
137 @retval true if limit_lsn has been reached, or not able to scan any
138 more in this log group
139 @retval false otherwise */
140 bool meb_scan_log_recs(ulint available_memory, const byte *buf, ulint len,
141  lsn_t checkpoint_lsn, lsn_t start_lsn,
142  lsn_t *contiguous_lsn, lsn_t *group_scanned_lsn);
143 
144 /** Creates an IORequest object for decrypting redo log with
145 Encryption::decrypt_log() method. If the encryption_info parameter is
146 a null pointer, then encryption information is read from
147 "ib_logfile0". If the encryption_info parameter is not null, then it
148 should contain a copy of the encryption info stored in the header of
149 "ib_logfile0".
150 @param[in,out] encryption_request an IORequest object
151 @param[in] encryption_info a copy of the encryption info in
152 the header of "ib_logfile0", or a null pointer
153 @retval true if the call succeeded
154 @retval false otherwise */
155 bool meb_read_log_encryption(IORequest &encryption_request,
156  byte *encryption_info = nullptr);
157 
158 bool recv_check_log_header_checksum(const byte *buf);
159 /** Check the 4-byte checksum to the trailer checksum field of a log
160 block.
161 @param[in] block pointer to a log block
162 @return whether the checksum matches */
163 bool log_block_checksum_is_ok(const byte *block);
164 #else /* UNIV_HOTBACKUP */
165 
166 /** Applies the hashed log records to the page, if the page lsn is less than the
167 lsn of a log record. This can be called when a buffer page has just been
168 read in, or also for a page already in the buffer pool.
169 
170 TODO(fix Bug#31173032): Remove SUPPRESS_UBSAN_CLANG10.
171 
172 @param[in] just_read_in true if the IO handler calls this for a freshly
173  read page
174 @param[in,out] block buffer block */
175 void recv_recover_page_func(bool just_read_in,
177 
178 /** Wrapper for recv_recover_page_func().
179 Applies the hashed log records to the page, if the page lsn is less than the
180 lsn of a log record. This can be called when a buffer page has just been
181 read in, or also for a page already in the buffer pool.
182 @param jri in: TRUE if just read in (the i/o handler calls this for
183 a freshly read page)
184 @param[in,out] block buffer block */
185 #define recv_recover_page(jri, block) recv_recover_page_func(jri, block)
186 
187 /** Frees the recovery system. */
188 void recv_sys_free();
189 
190 /** Reset the state of the recovery system variables. */
191 void recv_sys_var_init();
192 
193 #endif /* UNIV_HOTBACKUP */
194 
195 #ifdef UNIV_HOTBACKUP
196 /** Get the number of bytes used by all the heaps
197 @return number of bytes used */
198 size_t meb_heap_used();
199 #endif /* UNIV_HOTBACKUP */
200 
201 /** Returns true if recovery is currently running.
202 @return recv_recovery_on */
203 UNIV_INLINE
204 bool recv_recovery_is_on() MY_ATTRIBUTE((warn_unused_result));
205 
206 /** Start recovering from a redo log checkpoint.
207 @see recv_recovery_from_checkpoint_finish
208 @param[in,out] log redo log
209 @param[in] flush_lsn FIL_PAGE_FILE_FLUSH_LSN
210  of first system tablespace page
211 @return error code or DB_SUCCESS */
213  MY_ATTRIBUTE((warn_unused_result));
214 
215 /** Complete the recovery from the latest checkpoint.
216 @param[in,out] log redo log
217 @param[in] aborting true if the server has to abort due to an error
218 @return recovered persistent metadata or nullptr if aborting*/
220  MY_ATTRIBUTE((warn_unused_result));
221 
222 /** Creates the recovery system. */
223 void recv_sys_create();
224 
225 /** Release recovery system mutexes. */
226 void recv_sys_close();
227 
228 /** Inits the recovery system for a recovery operation.
229 @param[in] max_mem Available memory in bytes */
230 void recv_sys_init(ulint max_mem);
231 
232 /** Calculates the new value for lsn when more data is added to the log.
233 @param[in] lsn Old LSN
234 @param[in] len This many bytes of data is added, log block
235  headers not included
236 @return LSN after data addition */
238 
239 /** Empties the hash table of stored log records, applying them to appropriate
240 pages.
241 @param[in,out] log redo log
242 @param[in] allow_ibuf if true, ibuf operations are allowed during
243  the application; if false, no ibuf operations
244  are allowed, and after the application all
245  file pages are flushed to disk and invalidated
246  in buffer pool: this alternative means that
247  no new log records can be generated during
248  the application; the caller must in this case
249  own the log mutex */
250 void recv_apply_hashed_log_recs(log_t &log, bool allow_ibuf);
251 
252 #if defined(UNIV_DEBUG) || defined(UNIV_HOTBACKUP)
253 /** Return string name of the redo log record type.
254 @param[in] type record log record enum
255 @return string name of record log record */
256 const char *get_mlog_string(mlog_id_t type);
257 #endif /* UNIV_DEBUG || UNIV_HOTBACKUP */
258 
259 /** Block of log record data */
260 struct recv_data_t {
261  /** pointer to the next block or NULL. The log record data
262  is stored physically immediately after this struct, max amount
263  RECV_DATA_BLOCK_SIZE bytes of it */
264 
266 };
267 
268 /** Stored log record struct */
269 struct recv_t {
271 
272  /** Log record type */
274 
275  /** Log record body length in bytes */
276  ulint len;
277 
278  /** Chain of blocks containing the log record body */
280 
281  /** Start lsn of the log segment written by the mtr which generated
282  this log record: NOTE that this is not necessarily the start lsn of
283  this log record */
285 
286  /** End lsn of the log segment written by the mtr which generated
287  this log record: NOTE that this is not necessarily the end LSN of
288  this log record */
290 
291  /** List node, list anchored in recv_addr_t */
293 };
294 
295 /** States of recv_addr_t */
297 
298  /** not yet processed */
300 
301  /** page is being read */
303 
304  /** log records are being applied on the page */
306 
307  /** log records have been applied on the page */
309 
310  /** log records have been discarded because the tablespace
311  does not exist */
313 };
314 
315 /** Hashed page file address struct */
316 struct recv_addr_t {
318 
319  /** recovery state of the page */
321 
322  /** Space ID */
324 
325  /** Page number */
327 
328  /** List of log records for this page */
330 };
331 
332 // Forward declaration
333 namespace dblwr {
334 namespace recv {
335 class DBLWR;
336 }
337 } // namespace dblwr
338 
339 /** Class to parse persistent dynamic metadata redo log, store and
340 merge them and apply them to in-memory table objects finally */
342  using PersistentTables = std::map<
343  table_id_t, PersistentTableMetadata *, std::less<table_id_t>,
345 
346  public:
347  /** Default constructor */
348  MetadataRecover() UNIV_NOTHROW {}
349 
350  /** Destructor */
351  ~MetadataRecover();
352 
353  /** Parse a dynamic metadata redo log of a table and store
354  the metadata locally
355  @param[in] id table id
356  @param[in] version table dynamic metadata version
357  @param[in] ptr redo log start
358  @param[in] end end of redo log
359  @retval ptr to next redo log record, NULL if this log record
360  was truncated */
361  byte *parseMetadataLog(table_id_t id, uint64_t version, byte *ptr, byte *end);
362 
363  /** Apply the collected persistent dynamic metadata to in-memory
364  table objects */
365  void apply();
366 
367  /** Store the collected persistent dynamic metadata to
368  mysql.innodb_dynamic_metadata */
369  void store();
370 
371  /** If there is any metadata to be applied
372  @return true if any metadata to be applied, otherwise false */
373  bool empty() const { return (m_tables.empty()); }
374 
375  private:
376  /** Get the dynamic metadata of a specified table,
377  create a new one if not exist
378  @param[in] id table id
379  @return the metadata of the specified table */
380  PersistentTableMetadata *getMetadata(table_id_t id);
381 
382  private:
383  /** Map used to store and merge persistent dynamic metadata */
385 };
386 
387 /** Recovery system data structure */
388 struct recv_sys_t {
389  using Pages =
390  std::unordered_map<page_no_t, recv_addr_t *, std::hash<page_no_t>,
391  std::equal_to<page_no_t>>;
392 
393  /** Every space has its own heap and pages that belong to it. */
394  struct Space {
395  /** Constructor
396  @param[in,out] heap Heap to use for the log records. */
397  explicit Space(mem_heap_t *heap) : m_heap(heap), m_pages() {}
398 
399  /** Default constructor */
400  Space() : m_heap(), m_pages() {}
401 
402  /** Memory heap of log records and file addresses */
404 
405  /** Pages that need to be recovered */
407  };
408 
409  using Missing_Ids = std::set<space_id_t>;
410 
411  using Spaces = std::unordered_map<space_id_t, Space, std::hash<space_id_t>,
412  std::equal_to<space_id_t>>;
413 
414  /* Recovery encryption information */
415  struct Encryption_Key {
416  /** Tablespace ID */
418 
419  /** Encryption key */
421 
422  /** Encryption IV */
424  };
425 
426  using Encryption_Keys = std::vector<Encryption_Key>;
427 
428 #ifndef UNIV_HOTBACKUP
429 
430  /*!< mutex protecting the fields apply_log_recs, n_addrs, and the
431  state field in each recv_addr struct */
432  ib_mutex_t mutex;
433 
434  /** mutex coordinating flushing between recv_writer_thread and
435  the recovery thread. */
436  ib_mutex_t writer_mutex;
437 
438  /** event to activate page cleaner threads */
440 
441  /** event to signal that the page cleaner has finished the request */
443 
444  /** type of the flush request. BUF_FLUSH_LRU: flush end of LRU,
445  keeping free blocks. BUF_FLUSH_LIST: flush all of blocks. */
447 
448 #else /* !UNIV_HOTBACKUP */
449  bool apply_file_operations;
450 #endif /* !UNIV_HOTBACKUP */
451 
452  /** This is true when log rec application to pages is allowed;
453  this flag tells the i/o-handler if it should do log record
454  application */
456 
457  /** This is true when a log rec application batch is running */
459 
460  /** Possible incomplete last recovered log block */
462 
463  /** The nonaligned start address of the preceding buffer */
465 
466  /** Buffer for parsing log records */
468 
469  /** Size of the parsing buffer */
470  size_t buf_len;
471 
472  /** Amount of data in buf */
473  ulint len;
474 
475  /** This is the lsn from which we were able to start parsing
476  log records and adding them to the hash table; zero if a suitable
477  start point not found yet */
479 
480  /** Checkpoint lsn that was used during recovery (read from file). */
482 
483  /** Number of data bytes to ignore until we reach checkpoint_lsn. */
485 
486  /** The log data has been scanned up to this lsn */
488 
489  /** The log data has been scanned up to this checkpoint
490  number (lowest 4 bytes) */
492 
493  /** Start offset of non-parsed log records in buf */
495 
496  /** The log records have been parsed up to this lsn */
498 
499  /** The previous value of recovered_lsn - before we parsed the last mtr.
500  It is equal to recovered_lsn before we parsed any mtr. This is used to
501  find moments in which recovered_lsn moves to the next block in which case
502  we should update the last_block_first_rec_group (described below). */
504 
505  /** Tracks what should be the proper value of first_rec_group field in the
506  header of the block to which recovered_lsn belongs. It might be also zero,
507  in which case it means we do not know. */
509 
510  /** Set when finding a corrupt log block or record, or there
511  is a log parsing buffer overflow */
513 
514  /** Set when an inconsistency with the file system contents
515  is detected during log scan or apply */
517 
518  /** If the recovery is from a cloned database. */
520 
521  /** Recovering from MEB. */
523 
524  /** Doublewrite buffer state before MEB recovery starts. We restore to this
525  state after MEB recovery completes and disable the doublewrite buffer during
526  MEB recovery. */
528 
529  /** Hash table of pages, indexed by SpaceID. */
531 
532  /** Number of not processed hashed file addresses in the hash table */
533  ulint n_addrs;
534 
535  /** Doublewrite buffer pages, destroyed after recovery completes */
537 
538  /** We store and merge all table persistent data here during
539  scanning redo logs */
541 
542  /** Encryption Key information per tablespace ID */
544 
545  /** Tablespace IDs that were ignored during redo log apply. */
547 
548  /** Tablespace IDs that were explicitly deleted. */
550 };
551 
552 /** The recovery system */
553 extern recv_sys_t *recv_sys;
554 
555 /** TRUE when applying redo log records during crash recovery; FALSE
556 otherwise. Note that this is FALSE while a background thread is
557 rolling back incomplete transactions. */
558 extern volatile bool recv_recovery_on;
559 
560 /** If the following is TRUE, the buffer pool file pages must be invalidated
561 after recovery and no ibuf operations are allowed; this becomes TRUE if
562 the log record hash table becomes too full, and log records must be merged
563 to file pages already before the recovery is finished: in this case no
564 ibuf operations are allowed, as they could modify the pages read in the
565 buffer pool before the pages have been recovered to the up-to-date state.
566 
567 TRUE means that recovery is running and no operations on the log files
568 are allowed yet: the variable name is misleading. */
569 extern bool recv_no_ibuf_operations;
570 
571 /** TRUE when recv_init_crash_recovery() has been called. */
572 extern bool recv_needed_recovery;
573 
574 /** TRUE if buf_page_is_corrupted() should check if the log sequence
575 number (FIL_PAGE_LSN) is in the future. Initially FALSE, and set by
576 recv_recovery_from_checkpoint_start(). */
577 extern bool recv_lsn_checks_on;
578 
579 /** Size of the parsing buffer; it must accommodate RECV_SCAN_SIZE many
580 times! */
581 #define RECV_PARSING_BUF_SIZE (2 * 1024 * 1024)
582 
583 /** Size of block reads when the log groups are scanned forward to do a
584 roll-forward */
585 #define RECV_SCAN_SIZE (4 * UNIV_PAGE_SIZE)
586 
587 /** This many frames must be left free in the buffer pool when we scan
588 the log and store the scanned log records in the buffer pool: we will
589 use these free frames to read in pages when we start applying the
590 log records to the database. */
591 extern ulint recv_n_pool_free_frames;
592 
593 /** A list of tablespaces for which (un)encryption process was not
594 completed before crash. */
595 extern std::list<space_id_t> recv_encr_ts_list;
596 
597 #include "log0recv.ic"
598 
599 #endif
Allocator class for allocating memory from inside std::* containers.
Definition: ut0new.h:571
byte * iv
Encryption IV.
Definition: log0recv.h:423
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:455
ulint len
Log record body length in bytes.
Definition: log0recv.h:276
recv_sys_t * recv_sys
The recovery system.
Definition: log0recv.cc:91
recv_addr_state state
recovery state of the page
Definition: log0recv.h:320
bool apply_batch_on
This is true when a log rec application batch is running.
Definition: log0recv.h:458
mem_heap_t * m_heap
Memory heap of log records and file addresses.
Definition: log0recv.h:403
void recv_sys_init(ulint max_mem)
Inits the recovery system for a recovery operation.
Definition: log0recv.cc:584
Persistent dynamic metadata for a table.
Definition: dict0mem.h:2252
uint32 page_no_t
Page number.
Definition: api0api.h:57
uint64_t lsn_t
Type used for all log sequence number storage and arithmetics.
Definition: log0types.h:60
bool recv_no_ibuf_operations
If the following is TRUE, the buffer pool file pages must be invalidated after recovery and no ibuf o...
Definition: log0recv.cc:165
bool store(THD *thd, const Table *tp)
Stores the SDI for a table.
Definition: sdi.cc:606
Space(mem_heap_t *heap)
Constructor.
Definition: log0recv.h:397
dblwr::recv::DBLWR * dblwr
Doublewrite buffer pages, destroyed after recovery completes.
Definition: log0recv.h:536
Definition: log0recv.h:415
ib_mutex_t writer_mutex
mutex coordinating flushing between recv_writer_thread and the recovery thread.
Definition: log0recv.h:436
void recv_apply_hashed_log_recs(log_t &log, bool allow_ibuf)
Empties the hash table of stored log records, applying them to appropriate pages. ...
Definition: log0recv.cc:1212
The buffer control block structure.
Definition: buf0buf.h:1325
bool is_meb_recovery
Recovering from MEB.
Definition: log0recv.h:522
byte * buf
Buffer for parsing log records.
Definition: log0recv.h:467
List rec_list
List of log records for this page.
Definition: log0recv.h:329
mlog_id_t
Definition: mtr0types.h:62
lsn_t scanned_lsn
The log data has been scanned up to this lsn.
Definition: log0recv.h:487
PersistentTables m_tables
Map used to store and merge persistent dynamic metadata.
Definition: log0recv.h:384
#define SUPPRESS_UBSAN_CLANG10
Definition: my_compiler.h:139
Redo log - single data structure with state of the redo log system.
Definition: log0types.h:137
The interface to the operating system file io.
recv_data_t * next
pointer to the next block or NULL.
Definition: log0recv.h:265
uint32_t last_block_first_rec_group
Tracks what should be the proper value of first_rec_group field in the header of the block to which r...
Definition: log0recv.h:508
MetadataRecover * recv_recovery_from_checkpoint_finish(log_t &log, bool aborting)
Complete the recovery from the latest checkpoint.
Definition: log0recv.cc:3933
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:154
lsn_t previous_recovered_lsn
The previous value of recovered_lsn - before we parsed the last mtr.
Definition: log0recv.h:503
ulint recv_n_pool_free_frames
This many frames must be left free in the buffer pool when we scan the log and store the scanned log ...
Definition: log0recv.cc:194
Redo recovery configuration.
Definition: buf0dblwr.h:270
UT_LIST_NODE_T(recv_t) Node
Definition: log0recv.h:270
ulint len
Amount of data in buf.
Definition: log0recv.h:473
space_id_t space
Space ID.
Definition: log0recv.h:323
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:347
std::list< space_id_t > recv_encr_ts_list
A list of tablespaces for which (un)encryption process was not completed before crash.
Definition: log0recv.cc:81
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:478
bool empty() const
If there is any metadata to be applied.
Definition: log0recv.h:373
static uint64_t lsn
Definition: xcom_base.cc:426
space_id_t space_id
Tablespace ID.
Definition: log0recv.h:417
os_event_t flush_start
event to activate page cleaner threads
Definition: log0recv.h:439
The IO Context that is passed down to the low level IO code.
Definition: os0file.h:256
std::unordered_map< space_id_t, Space, std::hash< space_id_t >, std::equal_to< space_id_t > > Spaces
Definition: log0recv.h:412
byte * ptr
Encryption key.
Definition: log0recv.h:420
std::unordered_map< page_no_t, recv_addr_t *, std::hash< page_no_t >, std::equal_to< page_no_t > > Pages
Definition: log0recv.h:391
os_event_t flush_end
event to signal that the page cleaner has finished the request
Definition: log0recv.h:442
Node rec_list
List node, list anchored in recv_addr_t.
Definition: log0recv.h:292
log records have been discarded because the tablespace does not exist
Definition: log0recv.h:312
Data dictionary global types.
size_t buf_len
Size of the parsing buffer.
Definition: log0recv.h:470
Redo log types.
const char * get_mlog_string(mlog_id_t type)
Return string name of the redo log record type.
Definition: log0recv.cc:4026
log records have been applied on the page
Definition: log0recv.h:308
lsn_t recovered_lsn
The log records have been parsed up to this lsn.
Definition: log0recv.h:497
Definition: aggregate_check.h:523
Block of log record data.
Definition: log0recv.h:260
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:188
Space()
Default constructor.
Definition: log0recv.h:400
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:284
page is being read
Definition: log0recv.h:302
dberr_t recv_recovery_from_checkpoint_start(log_t &log, lsn_t flush_lsn)
Start recovering from a redo log checkpoint.
Definition: log0recv.cc:3648
Every space has its own heap and pages that belong to it.
Definition: log0recv.h:394
dberr_t
Definition: db0err.h:38
The database buffer pool global types for the directory.
bool found_corrupt_fs
Set when an inconsistency with the file system contents is detected during log scan or apply...
Definition: log0recv.h:516
buf_flush_t flush_type
type of the flush request.
Definition: log0recv.h:446
Instrumented memory allocator.
void recv_sys_var_init()
Reset the state of the recovery system variables.
Definition: log0recv.cc:506
lsn_t recv_calc_lsn_on_data_add(lsn_t lsn, uint64_t len)
Calculates the new value for lsn when more data is added to the log.
Definition: log0recv.cc:234
recv_addr_state
States of recv_addr_t.
Definition: log0recv.h:296
case opt name
Definition: sslopt-case.h:32
mysql_service_status_t recv(const char *tag, const unsigned char *data, size_t data_length) noexcept
Definition: gr_message_service_example.cc:38
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:289
bool recv_needed_recovery
TRUE when recv_init_crash_recovery() has been called.
Definition: log0recv.cc:149
lsn_t checkpoint_lsn
Checkpoint lsn that was used during recovery (read from file).
Definition: log0recv.h:481
Missing_Ids deleted
Tablespace IDs that were explicitly deleted.
Definition: log0recv.h:549
Utilities for byte operations.
ulint scanned_checkpoint_no
The log data has been scanned up to this checkpoint number (lowest 4 bytes)
Definition: log0recv.h:491
log records are being applied on the page
Definition: log0recv.h:305
bool recv_is_making_a_backup
true When the redo log is being backed up
Definition: log0recv.cc:168
const string version("\ersion\)
ib_id_t table_id_t
Table or partition identifier (unique within an InnoDB instance).
Definition: dict0types.h:215
page_no_t page_no
Page number.
Definition: log0recv.h:326
recv_data_t * data
Chain of blocks containing the log record body.
Definition: log0recv.h:279
uint32 space_id_t
Tablespace identifier.
Definition: api0api.h:59
MetadataRecover * metadata_recover
We store and merge all table persistent data here during scanning redo logs.
Definition: log0recv.h:540
ulint bytes_to_ignore_before_checkpoint
Number of data bytes to ignore until we reach checkpoint_lsn.
Definition: log0recv.h:484
Definition: buf0dblwr.cc:71
Spaces * spaces
Hash table of pages, indexed by SpaceID.
Definition: log0recv.h:530
Encryption_Keys * keys
Encryption Key information per tablespace ID.
Definition: log0recv.h:543
byte * last_block
Possible incomplete last recovered log block.
Definition: log0recv.h:461
#define UT_LIST_BASE_NODE_T(TYPE)
Definition: innodb_utility.h:47
MetadataRecover() 1
Default constructor.
Definition: log0recv.h:348
void recv_sys_free()
Frees the recovery system.
Definition: log0recv.cc:830
std::map< table_id_t, PersistentTableMetadata *, std::less< table_id_t >, ut_allocator< std::pair< const table_id_t, PersistentTableMetadata * > >> PersistentTables
Definition: log0recv.h:344
Class to parse persistent dynamic metadata redo log, store and merge them and apply them to in-memory...
Definition: log0recv.h:341
UNIV_INLINE bool recv_recovery_is_on()
Returns true if recovery is currently running.
ulint n_addrs
Number of not processed hashed file addresses in the hash table.
Definition: log0recv.h:533
ib_mutex_t mutex
Definition: log0recv.h:432
InnoDB condition variable.
Definition: os0event.cc:66
mlog_id_t type
Log record type.
Definition: log0recv.h:273
buf_flush_t
Flags for flush types.
Definition: buf0types.h:65
void recv_recover_page_func(bool just_read_in, buf_block_t *block) SUPPRESS_UBSAN_CLANG10
Applies the hashed log records to the page, if the page lsn is less than the lsn of a log record...
Definition: log0recv.cc:2391
bool found_corrupt_log
Set when finding a corrupt log block or record, or there is a log parsing buffer overflow.
Definition: log0recv.h:512
Pages m_pages
Pages that need to be recovered.
Definition: log0recv.h:406
void recv_sys_create()
Creates the recovery system.
Definition: log0recv.cc:389
byte * last_block_buf_start
The nonaligned start address of the preceding buffer.
Definition: log0recv.h:464
Stored log record struct.
Definition: log0recv.h:269
std::set< space_id_t > Missing_Ids
Definition: log0recv.h:409
bool dblwr_state
Doublewrite buffer state before MEB recovery starts.
Definition: log0recv.h:527
The simple hash table utility.
unsigned char byte
Blob class.
Definition: common.h:159
Hashed page file address struct.
Definition: log0recv.h:316
not yet processed
Definition: log0recv.h:299
volatile bool recv_recovery_on
TRUE when applying redo log records during crash recovery; FALSE otherwise.
Definition: log0recv.cc:96
ulint recovered_offset
Start offset of non-parsed log records in buf.
Definition: log0recv.h:494
void recv_sys_close()
Release recovery system mutexes.
Definition: log0recv.cc:472
#define UT_LIST_NODE_T(TYPE)
Definition: innodb_utility.h:40
Missing_Ids missing_ids
Tablespace IDs that were ignored during redo log apply.
Definition: log0recv.h:546
static bool log_block_checksum_is_ok(const byte *block)
Check the 4-byte checksum to the trailer checksum field of a log block.
Definition: log0recv.cc:692
Mini-transaction buffer global types.
static bool recv_check_log_header_checksum(const byte *buf)
Check the consistency of a log header block.
Definition: log0recv.cc:677
Recovery system data structure.
Definition: log0recv.h:388
std::vector< Encryption_Key > Encryption_Keys
mutex protecting the fields apply_log_recs, n_addrs, and the state field in each recv_addr struct ...
Definition: log0recv.h:431
bool is_cloned_db
If the recovery is from a cloned database.
Definition: log0recv.h:519