MySQL 9.1.0
Source Code Documentation
log0recv.cc File Reference

Recovery. More...

#include "ha_prototypes.h"
#include <my_aes.h>
#include <sys/types.h>
#include <array>
#include <iomanip>
#include <map>
#include <new>
#include <string>
#include <vector>
#include "arch0arch.h"
#include "btr0btr.h"
#include "btr0cur.h"
#include "buf0buf.h"
#include "buf0flu.h"
#include "clone0api.h"
#include "dict0dd.h"
#include "fil0fil.h"
#include "ibuf0ibuf.h"
#include "log0chkp.h"
#include "log0encryption.h"
#include "log0files_io.h"
#include "log0log.h"
#include "log0pre_8_0_30.h"
#include "log0recv.h"
#include "log0test.h"
#include "mem0mem.h"
#include "mtr0log.h"
#include "mtr0mtr.h"
#include "os0thread-create.h"
#include "page0cur.h"
#include "page0zip.h"
#include "trx0rec.h"
#include "trx0undo.h"
#include "ut0new.h"
#include "my_dbug.h"
#include "buf0rea.h"
#include "ddl0ddl.h"
#include "srv0srv.h"
#include "srv0start.h"
#include "trx0purge.h"

Classes

struct  Log_checkpoint_location
 Describes location of a single checkpoint. More...
 

Macros

#define RECV_DATA_BLOCK_SIZE   (MEM_MAX_ALLOC_IN_BUF - sizeof(recv_data_t))
 Log records are stored in the hash table in chunks at most of this size; this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool. More...
 

Functions

static bool recv_writer_is_active ()
 
static lsn_t recv_read_log_seg (log_t &log, byte *buf, lsn_t start_lsn, lsn_t end_lsn)
 Reads a specified log segment to a buffer. More...
 
static void recv_init_crash_recovery ()
 Initialize crash recovery environment. 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_sys_create ()
 Creates the recovery system. More...
 
static bool recv_sys_resize_buf ()
 Resize the recovery parsing buffer up to log_buffer_size. More...
 
static void recv_sys_finish ()
 Free up recovery data structures. More...
 
void recv_sys_close ()
 Release recovery system mutexes. More...
 
void recv_sys_var_init ()
 Reset the state of the recovery system variables. More...
 
static size_t recv_heap_used ()
 Get the number of bytes used by all the heaps. More...
 
static bool recv_report_corrupt_log (const byte *ptr, int type, space_id_t space, page_no_t page_no)
 Prints diagnostic info of corrupt log. More...
 
void recv_sys_init ()
 Inits the recovery system for a recovery operation. More...
 
static void recv_sys_empty_hash ()
 Empties the hash table when it has been fully processed. More...
 
static bool log_block_checksum_is_ok (const byte *block)
 Check the 4-byte checksum to the trailer checksum field of a log block. More...
 
static recv_sys_t::Spacerecv_get_page_map (space_id_t space_id, bool create)
 Get the page map for a tablespace. More...
 
static recv_addr_trecv_get_rec (const page_id_t &page_id)
 Gets the list of log records for a <space, page>. More...
 
static bool log_block_epoch_no_is_valid (uint32_t log_block_epoch_no, uint32_t last_epoch_no)
 Checks if a given log data block could be considered a next valid block, with regards to the epoch_no it has stored in its header, during the recovery. More...
 
static void recv_writer_thread ()
 recv_writer thread tasked with flushing dirty pages from the buffer pools. More...
 
void recv_sys_free ()
 Frees the recovery system. More...
 
static void one_less_page_to_recover ()
 
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...
 
static bool recv_find_max_checkpoint (log_t &, Log_file_handle &file_handle, Log_checkpoint_location &checkpoint)
 Find the latest checkpoint in the given log file. More...
 
static bool recv_find_max_checkpoint (log_t &log, Log_checkpoint_location &checkpoint)
 Find the latest checkpoint (check all existing redo log files). More...
 
static void recv_read_in_area (const page_id_t &requested_page_id, const page_size_t &page_size)
 Reads in pages which have hashed log records, from an area around a given page number. More...
 
static void recv_apply_log_rec (recv_addr_t *recv_addr)
 Apply the log records to a page. 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...
 
static bool check_encryption (page_no_t page_no, space_id_t space_id, const byte *start, const byte *end)
 Check if redo log is for encryption information. More...
 
static const byterecv_parse_or_apply_log_rec_body (mlog_id_t type, const byte *ptr, const byte *end_ptr, space_id_t space_id, page_no_t page_no, buf_block_t *block, mtr_t *mtr, ulint parsed_bytes, lsn_t start_lsn)
 Try to parse a single log record body and also applies it if specified. More...
 
static void recv_add_to_hash_table (mlog_id_t type, space_id_t space_id, page_no_t page_no, const byte *body, const byte *rec_end, lsn_t start_lsn, lsn_t end_lsn)
 Adds a new log record to the hash table of log records. More...
 
static void recv_data_copy_to_buf (byte *buf, recv_t *recv)
 Copies the log record body from recv to buf. 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...
 
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 ulint recv_parse_log_rec (mlog_id_t *type, const byte *ptr, const byte *end_ptr, space_id_t *space_id, page_no_t *page_no, const byte **body)
 Tries to parse a single log record. More...
 
static bool recv_update_bytes_to_ignore_before_checkpoint (size_t next_parsed_bytes)
 Subtracts next number of bytes to ignore before we reach the checkpoint or returns information that there was nothing more to skip. More...
 
static void recv_track_changes_of_recovered_lsn ()
 Tracks changes of recovered_lsn and tracks proper values for what first_rec_group should be for consecutive blocks. More...
 
static bool recv_single_rec (const byte *ptr, const byte *end_ptr)
 Parse and store a single log record entry. More...
 
static bool recv_multi_rec (const byte *ptr, const byte *end_ptr)
 Parse and store a multiple record log entry. More...
 
static void recv_parse_log_recs ()
 Parse log records from a buffer and optionally store them to a hash table to wait merging to file pages. More...
 
static bool recv_sys_add_to_parsing_buf (const byte *log_block, lsn_t scanned_lsn)
 Adds data from a new log block to the parsing buffer of recv_sys if recv_sys->parse_start_lsn is non-zero. More...
 
static void recv_reset_buffer ()
 Moves the parsing buffer data left to the buffer start. More...
 
static bool recv_scan_log_recs (log_t &log, size_t max_memory, const byte *buf, size_t len, lsn_t start_lsn, lsn_t *read_upto_lsn)
 Scans log from a buffer and stores new log data to the parsing buffer. More...
 
static dberr_t recv_recovery_begin (log_t &log, const lsn_t checkpoint_lsn)
 Scans log from a buffer and stores new log data to the parsing buffer. More...
 
dberr_t recv_recovery_from_checkpoint_start (log_t &log, lsn_t flush_lsn)
 Start recovering from a redo log checkpoint. More...
 
static void verify_page_type (page_id_t page_id, page_type_t type)
 Check the page type, if there is a mismatch then throw fatal error. More...
 
MetadataRecoverrecv_recovery_from_checkpoint_finish (bool aborting)
 Complete the recovery from the latest checkpoint. More...
 
const char * get_mlog_string (mlog_id_t type)
 Return string name of the redo log record type. More...
 

Variables

static const size_t RECV_READ_AHEAD_AREA = 32
 Read-ahead area in applying log records to file pages. More...
 
recv_sys_trecv_sys = nullptr
 The recovery system. More...
 
volatile bool recv_recovery_on
 true when applying redo log records during crash recovery; false otherwise. More...
 
PSI_memory_key mem_log_recv_page_hash_key
 
PSI_memory_key mem_log_recv_space_hash_key
 
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...
 
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_is_making_a_backup = false
 true When the redo log is being backed up More...
 
bool recv_is_from_backup = false
 true when recovering from a backed up redo log file More...
 
static ulint recv_scan_print_counter
 The following counter is used to decide when to print info on log scan. More...
 
static mlog_id_t recv_previous_parsed_rec_type
 The type of the previous parsed redo log record. More...
 
static ulint recv_previous_parsed_rec_offset
 The offset of the previous parsed redo log record. More...
 
static ulint recv_previous_parsed_rec_is_multi
 The 'multi' flag of the previous parsed redo log record. 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...
 
static lsn_t recv_max_page_lsn
 The maximum lsn we see for a page during the recovery process. More...
 

Detailed Description

Recovery.

Created 9/20/1997 Heikki Tuuri

Macro Definition Documentation

◆ RECV_DATA_BLOCK_SIZE

#define RECV_DATA_BLOCK_SIZE   (MEM_MAX_ALLOC_IN_BUF - sizeof(recv_data_t))

Log records are stored in the hash table in chunks at most of this size; this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool.

Function Documentation

◆ check_encryption()

static bool check_encryption ( page_no_t  page_no,
space_id_t  space_id,
const byte start,
const byte end 
)
inlinestatic

Check if redo log is for encryption information.

Parameters
[in]page_noPage number
[in]space_idTablespace identifier
[in]startRedo log record body
[in]endEnd of buffer
Returns
true if encryption information.

◆ get_mlog_string()

const char * get_mlog_string ( mlog_id_t  type)

Return string name of the redo log record type.

Parameters
[in]typerecord log record enum
Returns
string name of record log record

◆ log_block_checksum_is_ok()

static bool log_block_checksum_is_ok ( const byte block)
static

Check the 4-byte checksum to the trailer checksum field of a log block.

Parameters
[in]blockpointer to a log block
Returns
whether the checksum matches

◆ log_block_epoch_no_is_valid()

static bool log_block_epoch_no_is_valid ( uint32_t  log_block_epoch_no,
uint32_t  last_epoch_no 
)
static

Checks if a given log data block could be considered a next valid block, with regards to the epoch_no it has stored in its header, during the recovery.

Parameters
[in]log_block_epoch_noepoch_no of the log data block to check
[in]last_epoch_noepoch_no of the last data block scanned
Returns
true iff the provided log block has valid epoch_no

◆ one_less_page_to_recover()

static void one_less_page_to_recover ( )
static

◆ recv_add_to_hash_table()

static void recv_add_to_hash_table ( mlog_id_t  type,
space_id_t  space_id,
page_no_t  page_no,
const byte body,
const byte rec_end,
lsn_t  start_lsn,
lsn_t  end_lsn 
)
static

Adds a new log record to the hash table of log records.

Parameters
[in]typelog record type
[in]space_idTablespace id
[in]page_nopage number
[in]bodylog record body
[in]rec_endlog record end
[in]start_lsnstart lsn of the mtr
[in]end_lsnend lsn of the mtr

◆ recv_apply_hashed_log_recs()

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.

Parameters
[in,out]logredo log
[in]allow_ibufif 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

◆ recv_apply_log_rec()

static void recv_apply_log_rec ( recv_addr_t recv_addr)
static

Apply the log records to a page.

Parameters
[in,out]recv_addrRedo log records to apply

◆ recv_calc_lsn_on_data_add()

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.

Parameters
[in]lsnOld LSN
[in]lenThis many bytes of data is added, log block headers not included
Returns
LSN after data addition

◆ recv_data_copy_to_buf()

static void recv_data_copy_to_buf ( byte buf,
recv_t recv 
)
static

Copies the log record body from recv to buf.

Parameters
[in]bufBuffer of length at least recv->len
[in]recvLog record

◆ recv_find_max_checkpoint() [1/2]

static bool recv_find_max_checkpoint ( log_t ,
Log_file_handle file_handle,
Log_checkpoint_location checkpoint 
)
static

Find the latest checkpoint in the given log file.

Parameters
[in]file_handlehandle for the opened redo log file
[out]checkpointthe latest checkpoint found (if any)
Returns
true iff any checkpoint has been found

◆ recv_find_max_checkpoint() [2/2]

static bool recv_find_max_checkpoint ( log_t log,
Log_checkpoint_location checkpoint 
)
static

Find the latest checkpoint (check all existing redo log files).

Parameters
[in,out]logredo log
[out]checkpointthe latest checkpoint found (if any)
Returns
true iff any checkpoint has been found

◆ recv_get_page_map()

static recv_sys_t::Space * recv_get_page_map ( space_id_t  space_id,
bool  create 
)
static

Get the page map for a tablespace.

It will create one if one isn't found.

Parameters
[in]space_idTablespace ID for which page map required.
[in]createfalse if lookup only
Returns
the space data or null if not found

◆ recv_get_rec()

static recv_addr_t * recv_get_rec ( const page_id_t page_id)
static

Gets the list of log records for a <space, page>.

Parameters
[in]page_idThe <Tablespace ID,Page number> pair
Returns
the redo log entries or nullptr if not found

◆ recv_heap_used()

static size_t recv_heap_used ( )
static

Get the number of bytes used by all the heaps.

Returns
number of bytes used

◆ recv_init_crash_recovery()

static void recv_init_crash_recovery ( )
static

Initialize crash recovery environment.

Can be called iff recv_needed_recovery == false.

◆ recv_multi_rec()

static bool recv_multi_rec ( const byte ptr,
const byte end_ptr 
)
static

Parse and store a multiple record log entry.

Parameters
[in]ptrstart of buffer
[in]end_ptrend of buffer
Returns
true if end of processing

◆ recv_page_is_brand_new()

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).

Parameters
[in]blockbuffer block
Returns
true if brand new

◆ recv_parse_log_rec()

static ulint recv_parse_log_rec ( mlog_id_t type,
const byte ptr,
const byte end_ptr,
space_id_t space_id,
page_no_t page_no,
const byte **  body 
)
static

Tries to parse a single log record.

Parameters
[out]typelog record type
[in]ptrpointer to a buffer
[in]end_ptrend of the buffer
[out]space_idtablespace identifier
[out]page_nopage number
[out]bodystart of log record body
Returns
length of the record, or 0 if the record was not complete

◆ recv_parse_log_recs()

static void recv_parse_log_recs ( )
static

Parse log records from a buffer and optionally store them to a hash table to wait merging to file pages.

◆ recv_parse_or_apply_log_rec_body()

static const byte * recv_parse_or_apply_log_rec_body ( mlog_id_t  type,
const byte ptr,
const byte end_ptr,
space_id_t  space_id,
page_no_t  page_no,
buf_block_t block,
mtr_t mtr,
ulint  parsed_bytes,
lsn_t  start_lsn 
)
static

Try to parse a single log record body and also applies it if specified.

Parameters
[in]typeRedo log entry type
[in]ptrRedo log record body
[in]end_ptrEnd of buffer
[in]space_idTablespace identifier
[in]page_noPage number
[in,out]blockBuffer block, or nullptr if a page log record should not be applied or if it is a MLOG_FILE_ operation
[in,out]mtrMini-transaction, or nullptr if a page log record should not be applied
[in]parsed_bytesNumber of bytes parsed so far
[in]start_lsnlsn for REDO record
Returns
log record end, nullptr if not a complete record

◆ recv_read_in_area()

static void recv_read_in_area ( const page_id_t requested_page_id,
const page_size_t page_size 
)
static

Reads in pages which have hashed log records, from an area around a given page number.

Parameters
[in]requested_page_idThe page which has to be read in anyway, so we have an opportunity to read pages nearby.
[in]page_sizeSize of pages in this page's space

◆ recv_read_log_seg()

static lsn_t recv_read_log_seg ( log_t log,
byte buf,
lsn_t  start_lsn,
lsn_t  end_lsn 
)
static

Reads a specified log segment to a buffer.

Parameters
[in,out]logredo log
[in,out]bufbuffer where to read
[in]start_lsnread area start
[in]end_lsnread area end
Returns
lsn up to which data was available on disk (ideally end_lsn) or zero in case of error

◆ recv_recover_page_func()

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.

Parameters
[in]just_read_intrue if the IO handler calls this for a freshly read page
[in,out]blockbuffer block

◆ recv_recovery_begin()

static dberr_t recv_recovery_begin ( log_t log,
const lsn_t  checkpoint_lsn 
)
static

Scans log from a buffer and stores new log data to the parsing buffer.

Parses and hashes the log records if new data found.

Parameters
[in,out]logredo log
[in,out]checkpoint_lsnlog sequence number found in checkpoint header. May be inexact (in a middle of an mtr which we can ignore, as it is already applied to tablespace files) until which all redo log has been scanned
Returns
DB_SUCCESS if successfull

◆ recv_recovery_from_checkpoint_finish()

MetadataRecover * recv_recovery_from_checkpoint_finish ( bool  aborting)

Complete the recovery from the latest checkpoint.

Parameters
[in]abortingtrue if the server has to abort due to an error
Returns
recovered persistent metadata or nullptr if aborting

◆ recv_recovery_from_checkpoint_start()

dberr_t recv_recovery_from_checkpoint_start ( log_t log,
lsn_t  flush_lsn 
)

Start recovering from a redo log checkpoint.

See also
recv_recovery_from_checkpoint_finish
Parameters
[in,out]logredo log
[in]flush_lsnlsn stored at offset FIL_PAGE_FILE_FLUSH_LSN in the system tablespace header
Returns
error code or DB_SUCCESS

◆ recv_report_corrupt_log()

static bool recv_report_corrupt_log ( const byte ptr,
int  type,
space_id_t  space,
page_no_t  page_no 
)
static

Prints diagnostic info of corrupt log.

Parameters
[in]ptrpointer to corrupt log record
[in]typetype of the log record (could be garbage)
[in]spacetablespace ID (could be garbage)
[in]page_nopage number (could be garbage)
Returns
whether processing should continue

◆ recv_reset_buffer()

static void recv_reset_buffer ( )
static

Moves the parsing buffer data left to the buffer start.

◆ recv_scan_log_recs()

static bool recv_scan_log_recs ( log_t log,
size_t  max_memory,
const byte buf,
size_t  len,
lsn_t  start_lsn,
lsn_t read_upto_lsn 
)
static

Scans log from a buffer and stores new log data to the parsing buffer.

Parses and hashes the log records if new data found. Unless UNIV_HOTBACKUP is defined, this function will apply log records automatically when the hash table becomes full.

Parameters
[in,out]logredo log
[in]max_memorywe let the hash table of recs to grow to this size, at the maximum
[in]bufbuffer containing a log segment or garbage
[in]lenbuffer length
[in]start_lsnbuffer start lsn
[out]read_upto_lsnscanning succeeded up to this lsn
Returns
true if not able to scan any more in this log

◆ recv_single_rec()

static bool recv_single_rec ( const byte ptr,
const byte end_ptr 
)
static

Parse and store a single log record entry.

Parameters
[in]ptrstart of buffer
[in]end_ptrend of buffer
Returns
true if end of processing

◆ recv_sys_add_to_parsing_buf()

static bool recv_sys_add_to_parsing_buf ( const byte log_block,
lsn_t  scanned_lsn 
)
static

Adds data from a new log block to the parsing buffer of recv_sys if recv_sys->parse_start_lsn is non-zero.

Parameters
[in]log_blocklog block
[in]scanned_lsnlsn of how far we were able to find data in this log block
Returns
true if more data added

◆ recv_sys_close()

void recv_sys_close ( )

Release recovery system mutexes.

◆ recv_sys_create()

void recv_sys_create ( )

Creates the recovery system.

◆ recv_sys_empty_hash()

static void recv_sys_empty_hash ( )
static

Empties the hash table when it has been fully processed.

◆ recv_sys_finish()

static void recv_sys_finish ( )
static

Free up recovery data structures.

◆ recv_sys_free()

void recv_sys_free ( )

Frees the recovery system.

◆ recv_sys_init()

void recv_sys_init ( )

Inits the recovery system for a recovery operation.

◆ recv_sys_resize_buf()

static bool recv_sys_resize_buf ( )
static

Resize the recovery parsing buffer up to log_buffer_size.

◆ recv_sys_var_init()

void recv_sys_var_init ( )

Reset the state of the recovery system variables.

◆ recv_track_changes_of_recovered_lsn()

static void recv_track_changes_of_recovered_lsn ( )
static

Tracks changes of recovered_lsn and tracks proper values for what first_rec_group should be for consecutive blocks.

Must be called when recv_sys->recovered_lsn is changed to next lsn pointing at boundary between consecutive parsed mini-transactions.

◆ recv_update_bytes_to_ignore_before_checkpoint()

static bool recv_update_bytes_to_ignore_before_checkpoint ( size_t  next_parsed_bytes)
static

Subtracts next number of bytes to ignore before we reach the checkpoint or returns information that there was nothing more to skip.

Parameters
[in]next_parsed_bytesnumber of next bytes that were parsed, which are supposed to be subtracted from bytes to ignore before checkpoint
Return values
truethere were still bytes to ignore
falsethere was already 0 bytes to ignore, nothing changed.

◆ recv_verify_log_is_clean_pre_8_0_30()

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.

Parameters
[in,out]logredo log
Returns
error code
Return values
DB_SUCCESSif the redo log is clean
DB_ERRORif the redo log is corrupted or dirty

◆ recv_writer_is_active()

static bool recv_writer_is_active ( )
static

◆ recv_writer_thread()

static void recv_writer_thread ( )
static

recv_writer thread tasked with flushing dirty pages from the buffer pools.

◆ verify_page_type()

static void verify_page_type ( page_id_t  page_id,
page_type_t  type 
)
static

Check the page type, if there is a mismatch then throw fatal error.

It may so happen that data file before 5.7 GA version may contain uninitialized bytes in the FIL_PAGE_TYPE field.

Parameters
[in]page_idPage id to verify
[in]typeExpected page type

Variable Documentation

◆ mem_log_recv_page_hash_key

PSI_memory_key mem_log_recv_page_hash_key

◆ mem_log_recv_space_hash_key

PSI_memory_key mem_log_recv_space_hash_key

◆ recv_is_from_backup

bool recv_is_from_backup = false

true when recovering from a backed up redo log file

◆ recv_is_making_a_backup

bool recv_is_making_a_backup = false

true When the redo log is being backed up

◆ recv_lsn_checks_on

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.

Initially false, and set by recv_recovery_from_checkpoint_start().

◆ recv_max_page_lsn

lsn_t recv_max_page_lsn
static

The maximum lsn we see for a page during the recovery process.

If this is bigger than the lsn we are able to scan up to, that is an indication that the recovery failed and the database may be corrupt.

◆ recv_n_frames_for_pages_per_pool_instance

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.

We will use these free blocks to read in pages when we start applying the log records to the database.

◆ recv_needed_recovery

bool recv_needed_recovery

true when recv_init_crash_recovery() has been called.

◆ recv_no_ibuf_operations

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.

true means that recovery is running and no operations on the log files are allowed yet: the variable name is misleading.

◆ recv_previous_parsed_rec_is_multi

ulint recv_previous_parsed_rec_is_multi
static

The 'multi' flag of the previous parsed redo log record.

◆ recv_previous_parsed_rec_offset

ulint recv_previous_parsed_rec_offset
static

The offset of the previous parsed redo log record.

◆ recv_previous_parsed_rec_type

mlog_id_t recv_previous_parsed_rec_type
static

The type of the previous parsed redo log record.

◆ RECV_READ_AHEAD_AREA

const size_t RECV_READ_AHEAD_AREA = 32
static

Read-ahead area in applying log records to file pages.

◆ recv_recovery_on

volatile bool recv_recovery_on

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.

◆ recv_scan_print_counter

ulint recv_scan_print_counter
static

The following counter is used to decide when to print info on log scan.

◆ recv_sys

recv_sys_t* recv_sys = nullptr

The recovery system.