Commit aae3f921 authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup recv_sys: Move things to members

recv_sys.recovery_on: Replaces recv_recovery_on.

recv_sys_t::apply(): Replaces recv_apply_hashed_log_recs().

recv_sys_var_init(): Remove.

recv_sys_t::recover_low(): Attempt to initialize a page based
on buffered redo log records.
parent a8b04c3e
......@@ -3986,7 +3986,6 @@ static bool xtrabackup_backup_func()
sync_check_init();
ut_d(sync_check_enable());
/* Reset the system variables in the recovery module. */
recv_sys_var_init();
trx_pool_init();
ut_crc32_init();
......@@ -5367,7 +5366,7 @@ static bool xtrabackup_prepare_func(char** argv)
ut_crc32_init();
recv_sys.create();
log_sys.create();
recv_recovery_on = true;
recv_sys.recovery_on = true;
#ifdef WITH_INNODB_DISALLOW_WRITES
srv_allow_writes_event = os_event_create(0);
......
......@@ -1536,8 +1536,7 @@ yet, to get valid size and flags.
@param[in,out] space tablespace */
inline void fil_space_open_if_needed(fil_space_t* space)
{
ut_d(extern volatile bool recv_recovery_on);
ut_ad(recv_recovery_on);
ut_ad(recv_recovery_is_on());
if (space->size == 0) {
/* Initially, size and flags will be set to 0,
......
......@@ -24,8 +24,7 @@ Recovery
Created 9/20/1997 Heikki Tuuri
*******************************************************/
#ifndef log0recv_h
#define log0recv_h
#pragma once
#include "ut0byte.h"
#include "buf0types.h"
......@@ -38,7 +37,7 @@ Created 9/20/1997 Heikki Tuuri
extern bool recv_writer_thread_active;
/** @return whether recovery is currently running. */
#define recv_recovery_is_on() UNIV_UNLIKELY(recv_recovery_on)
#define recv_recovery_is_on() UNIV_UNLIKELY(recv_sys.recovery_on)
/** Find the latest checkpoint in the log header.
@param[out] max_field LOG_CHECKPOINT_1 or LOG_CHECKPOINT_2
......@@ -70,16 +69,6 @@ void
recv_recovery_rollback_active(void);
/*===============================*/
/********************************************************//**
Reset the state of the recovery system variables. */
void
recv_sys_var_init(void);
/*===================*/
/** Apply recv_sys.pages to persistent data pages.
@param[in] last_batch whether redo log writes are possible */
void recv_apply_hashed_log_recs(bool last_batch);
/** Whether to store redo log records in recv_sys.pages */
enum store_t {
/** Do not store redo log records. */
......@@ -220,6 +209,8 @@ struct recv_sys_t
{
/** mutex protecting apply_log_recs and page_recv_t::state */
ib_mutex_t mutex;
/** whether we are applying redo log records during crash recovery */
bool recovery_on;
/** whether recv_recover_page(), invoked from buf_page_io_complete(),
should apply log records*/
bool apply_log_recs;
......@@ -275,6 +266,7 @@ struct recv_sys_t
/** buffered records waiting to be applied to pages */
map pages;
private:
/** Process a record that indicates that a tablespace size is being shrunk.
@param page_id first page that is not in the file
@param lsn log sequence number of the shrink operation */
......@@ -290,6 +282,7 @@ struct recv_sys_t
unsigned pages;
} truncated_undo_spaces[127];
public:
/** The contents of the doublewrite buffer */
recv_dblwr_t dblwr;
......@@ -301,6 +294,13 @@ struct recv_sys_t
void close_files() { files.clear(); }
private:
/** Attempt to initialize a page based on redo log records.
@param page_id page identifier
@param p iterator pointing to page_id
@param mtr mini-transaction
@return whether the page was successfully initialized */
inline buf_block_t *recover_low(const page_id_t page_id, map::iterator &p,
mtr_t &mtr);
/** All found log files (multiple ones are possible if we are upgrading
from before MariaDB Server 10.5.1) */
std::vector<log_file_t> files;
......@@ -316,6 +316,9 @@ struct recv_sys_t
@param[in,out] store whether to store page operations
@return whether the memory is exhausted */
inline bool is_memory_exhausted(store_t *store);
/** Apply buffered log to persistent data pages.
@param last_batch whether it is possible to write more redo log */
void apply(bool last_batch);
#ifdef UNIV_DEBUG
/** whether all redo log in the current batch has been applied */
......@@ -386,10 +389,6 @@ struct recv_sys_t
/** The recovery system */
extern recv_sys_t recv_sys;
/** 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 volatile bool recv_recovery_on;
/** If the following is TRUE, the buffer pool file pages must be invalidated
after recovery and no ibuf operations are allowed; this will be set if
recv_sys.pages becomes too full, and log records must be merged
......@@ -420,5 +419,3 @@ times! */
/** Size of block reads when the log groups are scanned forward to do a
roll-forward */
#define RECV_SCAN_SIZE (4U << srv_page_size_shift)
#endif
......@@ -1207,7 +1207,7 @@ static bool log_preflush_pool_modified_pages(lsn_t new_oldest)
not know how up-to-date the disk version of the database is,
and we could not make a new checkpoint on the basis of the
info on the buffer pool only. */
recv_apply_hashed_log_recs(true);
recv_sys.apply(true);
}
if (new_oldest == LSN_MAX
......@@ -1334,7 +1334,7 @@ bool log_checkpoint()
os_thread_sleep(360000000););
if (recv_recovery_is_on()) {
recv_apply_hashed_log_recs(true);
recv_sys.apply(true);
}
switch (srv_file_flush_method) {
......
This diff is collapsed.
......@@ -807,7 +807,6 @@ srv_boot(void)
/*==========*/
{
sync_check_init();
recv_sys_var_init();
trx_pool_init();
row_mysql_init();
srv_init();
......
......@@ -1567,7 +1567,7 @@ dberr_t srv_start(bool create_new_db)
respective file pages, for the last batch of
recv_group_scan_log_recs(). */
recv_apply_hashed_log_recs(true);
recv_sys.apply(true);
if (recv_sys.found_corrupt_log
|| recv_sys.found_corrupt_fs) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment