MySQL 8.4.2
Source Code Documentation
|
Recovery. More...
#include "buf0types.h"
#include "dict0types.h"
#include "hash0hash.h"
#include "log0sys.h"
#include "mtr0types.h"
#include "os0file.h"
#include "ut0byte.h"
#include "ut0new.h"
#include <list>
#include <unordered_map>
#include <unordered_set>
#include "log0recv.ic"
Go to the source code of this file.
Classes | |
struct | recv_data_t |
Block of log record data. More... | |
struct | recv_t |
Stored log record struct. More... | |
struct | recv_addr_t |
Hashed page file address struct. More... | |
class | MetadataRecover |
Class to parse persistent dynamic metadata redo log, store and merge them and apply them to in-memory table objects finally. More... | |
struct | recv_sys_t |
Recovery system data structure. More... | |
struct | recv_sys_t::Space |
Every space has its own heap and pages that belong to it. More... | |
struct | recv_sys_t::Encryption_Key |
struct | recv_sys_t::Mlog_record |
Mini transaction log record. More... | |
Namespaces | |
namespace | dblwr |
namespace | dblwr::recv |
Macros | |
#define | RECV_SCAN_SIZE (4 * UNIV_PAGE_SIZE) |
Size of block reads when the log groups are scanned forward to do a roll-forward. More... | |
Enumerations | |
enum | recv_addr_state { RECV_NOT_PROCESSED , RECV_BEING_READ , RECV_BEING_PROCESSED , RECV_PROCESSED , RECV_DISCARDED } |
States of recv_addr_t. More... | |
Functions | |
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. More... | |
static void | recv_recover_page (bool jri, buf_block_t *block) |
Wrapper for recv_recover_page_func(). More... | |
void | recv_sys_free () |
Frees the recovery system. More... | |
void | recv_sys_var_init () |
Reset the state of the recovery system variables. More... | |
static bool | recv_recovery_is_on () |
Returns true if recovery is currently running. More... | |
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). More... | |
dberr_t | recv_recovery_from_checkpoint_start (log_t &log, lsn_t flush_lsn) |
Start recovering from a redo log checkpoint. More... | |
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. More... | |
MetadataRecover * | recv_recovery_from_checkpoint_finish (bool aborting) |
Complete the recovery from the latest checkpoint. More... | |
void | recv_sys_create () |
Creates the recovery system. More... | |
void | recv_sys_close () |
Release recovery system mutexes. More... | |
void | recv_sys_init () |
Inits the recovery system for a recovery operation. More... | |
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. More... | |
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. More... | |
const char * | get_mlog_string (mlog_id_t type) |
Return string name of the redo log record type. More... | |
Variables | |
recv_sys_t * | recv_sys |
The recovery system. More... | |
volatile bool | recv_recovery_on |
true when applying redo log records during crash recovery; false otherwise. More... | |
bool | recv_no_ibuf_operations |
If the following is true, the buffer pool file pages must be invalidated after recovery and no ibuf operations are allowed; this becomes true if the log record hash table becomes too full, and log records must be merged to file pages already before the recovery is finished: in this case no ibuf operations are allowed, as they could modify the pages read in the buffer pool before the pages have been recovered to the up-to-date state. More... | |
bool | recv_needed_recovery |
true when recv_init_crash_recovery() has been called. More... | |
bool | recv_lsn_checks_on |
true if buf_page_is_corrupted() should check if the log sequence number (FIL_PAGE_LSN) is in the future. More... | |
constexpr uint32_t | RECV_PARSING_BUF_SIZE = 2 * 1024 * 1024 |
Size of the parsing buffer; it must accommodate RECV_SCAN_SIZE many times! More... | |
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 log and store the scanned log records in a hashmap allocated in the Buffer Pool in frames of non-LRU managed blocks. More... | |
std::list< space_id_t > | recv_encr_ts_list |
A list of tablespaces for which (un)encryption process was not completed before crash. More... | |
Recovery.
Created 9/20/1997 Heikki Tuuri
#define RECV_SCAN_SIZE (4 * UNIV_PAGE_SIZE) |
Size of block reads when the log groups are scanned forward to do a roll-forward.
enum recv_addr_state |
States of recv_addr_t.
const char * get_mlog_string | ( | mlog_id_t | type | ) |
Return string name of the redo log record type.
[in] | type | record log record enum |
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.
[in,out] | log | redo log |
[in] | allow_ibuf | if true, ibuf operations are allowed during the application; if false, no ibuf operations are allowed, and after the application all file pages are flushed to disk and invalidated in buffer pool: this alternative means that no new log records can be generated during the application; the caller must in this case own the log mutex |
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.
[in] | lsn | Old LSN |
[in] | len | This many bytes of data is added, log block headers not included |
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).
[in] | block | buffer block |
|
inlinestatic |
Wrapper for recv_recover_page_func().
Applies the hashed log records to the page, if the page lsn is less than the lsn of a log record. This can be called when a buffer page has just been read in, or also for a page already in the buffer pool.
jri | in: true if just read in (the i/o handler calls this for a freshly read page) | |
[in,out] | block | buffer block |
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.
This can be called when a buffer page has just been read in, or also for a page already in the buffer pool.
[in] | just_read_in | true if the IO handler calls this for a freshly read page |
[in,out] | block | buffer block |
MetadataRecover * recv_recovery_from_checkpoint_finish | ( | bool | aborting | ) |
Complete the recovery from the latest checkpoint.
[in] | aborting | true if the server has to abort due to an error |
Start recovering from a redo log checkpoint.
[in,out] | log | redo log |
[in] | flush_lsn | lsn stored at offset FIL_PAGE_FILE_FLUSH_LSN in the system tablespace header |
|
inlinestatic |
Returns true if recovery is currently running.
void recv_sys_close | ( | ) |
Release recovery system mutexes.
void recv_sys_create | ( | ) |
Creates the recovery system.
void recv_sys_free | ( | ) |
Frees the recovery system.
void recv_sys_init | ( | ) |
Inits the recovery system for a recovery operation.
void recv_sys_var_init | ( | ) |
Reset the state of the recovery system variables.
Determine if a redo log from a version before MySQL 8.0.30 is clean.
[in,out] | log | redo log |
DB_SUCCESS | if the redo log is clean |
DB_ERROR | if the redo log is corrupted or dirty |
|
extern |
A list of tablespaces for which (un)encryption process was not completed before crash.
|
extern |
true if buf_page_is_corrupted() should check if the log sequence number (FIL_PAGE_LSN) is in the future.
Initially false, and set by recv_recovery_from_checkpoint_start().
|
extern |
This many blocks must be left in each Buffer Pool instance to be managed by the LRU when we scan the log and store the scanned log records in a hashmap allocated in the Buffer Pool in frames of non-LRU managed blocks.
We will use these free blocks to read in pages when we start applying the log records to the database.
|
extern |
true when recv_init_crash_recovery() has been called.
|
extern |
If the following is true, the buffer pool file pages must be invalidated after recovery and no ibuf operations are allowed; this becomes true if the log record hash table becomes too full, and log records must be merged to file pages already before the recovery is finished: in this case no ibuf operations are allowed, as they could modify the pages read in the buffer pool before the pages have been recovered to the up-to-date state.
true means that recovery is running and no operations on the log files are allowed yet: the variable name is misleading.
|
constexpr |
Size of the parsing buffer; it must accommodate RECV_SCAN_SIZE many times!
|
extern |
true when applying redo log records during crash recovery; false otherwise.
Note that this is false while a background thread is rolling back incomplete transactions.
|
extern |
The recovery system.