Commit 8511f04f authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: Remove srv_start_lsn

Most of the time, we can refer to recv_sys.recovered_lsn.
parent 55a5b5ba
......@@ -5452,11 +5452,11 @@ static bool xtrabackup_prepare_func(char** argv)
}
/* Check whether the log is applied enough or not. */
if (srv_start_lsn && srv_start_lsn < target_lsn) {
if (recv_sys.recovered_lsn && recv_sys.recovered_lsn < target_lsn) {
msg("mariabackup: error: "
"The log was only applied up to LSN " LSN_PF
", instead of " LSN_PF,
srv_start_lsn, target_lsn);
recv_sys.recovered_lsn, target_lsn);
ok = false;
}
#ifdef WITH_WSREP
......
......@@ -60,11 +60,10 @@ bool
log_crypt_101_read_checkpoint(const byte* buf);
/** Decrypt a MariaDB 10.1 redo log block.
@param[in,out] buf log block
@param[in,out] buf log block
@param[in] start_lsn server start LSN
@return whether the decryption was successful */
UNIV_INTERN
bool
log_crypt_101_read_block(byte* buf);
bool log_crypt_101_read_block(byte* buf, lsn_t start_lsn);
/** Read the checkpoint crypto (version, msg and iv) info.
@param[in] buf checkpoint buffer
......
......@@ -94,8 +94,6 @@ srv_get_encryption_data_filename(
/** Log sequence number at shutdown */
extern lsn_t srv_shutdown_lsn;
/** Log sequence number immediately after startup */
extern lsn_t srv_start_lsn;
/** TRUE if the server is being started */
extern bool srv_is_being_started;
......
......@@ -29,7 +29,6 @@ MDEV-11782: Rewritten for MariaDB 10.2 by Marko Mäkelä, MariaDB Corporation.
#include <mysql/service_my_crypt.h>
#include "log0crypt.h"
#include "srv0start.h" // for srv_start_lsn
#include "log0recv.h" // for recv_sys
/** innodb_encrypt_log: whether to encrypt the redo log */
......@@ -302,11 +301,10 @@ log_crypt_101_read_checkpoint(const byte* buf)
}
/** Decrypt a MariaDB 10.1 redo log block.
@param[in,out] buf log block
@param[in,out] buf log block
@param[in] start_lsn server start LSN
@return whether the decryption was successful */
UNIV_INTERN
bool
log_crypt_101_read_block(byte* buf)
bool log_crypt_101_read_block(byte* buf, lsn_t start_lsn)
{
ut_ad(log_block_calc_checksum_format_0(buf)
!= log_block_get_checksum(buf));
......@@ -341,7 +339,7 @@ log_crypt_101_read_block(byte* buf)
memcpy(aes_ctr_iv, info->crypt_nonce.bytes, 3);
mach_write_to_8(aes_ctr_iv + 3,
log_block_get_start_lsn(srv_start_lsn, log_block_no));
log_block_get_start_lsn(start_lsn, log_block_no));
memcpy(aes_ctr_iv + 11, buf, 4);
aes_ctr_iv[11] &= ~(LOG_BLOCK_FLUSH_BIT_MASK >> 24);
aes_ctr_iv[15] = 0;
......
......@@ -1892,7 +1892,7 @@ logs_empty_and_mark_files_at_shutdown(void)
redo log before fil_close_all_files(). */
log_sys.log.flush_data_only();
} else {
lsn = srv_start_lsn;
lsn = recv_sys.recovered_lsn;
}
srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
......@@ -1907,9 +1907,10 @@ logs_empty_and_mark_files_at_shutdown(void)
ut_a(lsn == log_sys.lsn
|| srv_force_recovery == SRV_FORCE_NO_LOG_REDO);
if (lsn < srv_start_lsn) {
if (UNIV_UNLIKELY(lsn < recv_sys.recovered_lsn)) {
ib::error() << "Shutdown LSN=" << lsn
<< " is less than start LSN=" << srv_start_lsn;
<< " is less than start LSN="
<< recv_sys.recovered_lsn;
}
srv_shutdown_lsn = lsn;
......
......@@ -1444,7 +1444,7 @@ static dberr_t recv_log_format_0_recover(lsn_t lsn, bool crypt)
if (log_block_calc_checksum_format_0(buf)
!= log_block_get_checksum(buf)
&& !log_crypt_101_read_block(buf)) {
&& !log_crypt_101_read_block(buf, lsn)) {
ib::error() << NO_UPGRADE_RECOVERY_MSG
<< ", and it appears corrupted.";
return(DB_CORRUPTION);
......@@ -3043,7 +3043,6 @@ recv_group_scan_log_recs(
recv_sys.len = 0;
recv_sys.recovered_offset = 0;
recv_sys.clear();
srv_start_lsn = *contiguous_lsn;
recv_sys.parse_start_lsn = *contiguous_lsn;
recv_sys.scanned_lsn = *contiguous_lsn;
recv_sys.recovered_lsn = *contiguous_lsn;
......@@ -3303,7 +3302,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
if (err != DB_SUCCESS) {
srv_start_lsn = recv_sys.recovered_lsn = log_sys.lsn;
recv_sys.recovered_lsn = log_sys.lsn;
log_mutex_exit();
return(err);
}
......@@ -3540,11 +3539,8 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
recv_synchronize_groups();
if (!recv_needed_recovery) {
ut_a(checkpoint_lsn == recv_sys.recovered_lsn);
} else {
srv_start_lsn = recv_sys.recovered_lsn;
}
ut_ad(recv_needed_recovery
|| checkpoint_lsn == recv_sys.recovered_lsn);
log_sys.buf_free = ulong(log_sys.lsn % OS_FILE_LOG_BLOCK_SIZE);
log_sys.buf_next_to_write = log_sys.buf_free;
......
......@@ -1462,7 +1462,7 @@ void srv_error_monitor_task(void*)
{
/* number of successive fatal timeouts observed */
static ulint fatal_cnt;
static lsn_t old_lsn = srv_start_lsn;
static lsn_t old_lsn = recv_sys.recovered_lsn;
lsn_t new_lsn;
/* longest waiting thread for a semaphore */
os_thread_id_t waiter;
......
......@@ -102,8 +102,6 @@ Created 2/16/1996 Heikki Tuuri
#include "ut0crc32.h"
#include "btr0scrub.h"
/** Log sequence number immediately after startup */
lsn_t srv_start_lsn;
/** Log sequence number at shutdown */
lsn_t srv_shutdown_lsn;
......@@ -1036,7 +1034,6 @@ static lsn_t srv_prepare_to_delete_redo_log_file(bool old_exists)
<< " bytes; LSN=" << flushed_lsn;
}
srv_start_lsn = flushed_lsn;
bool do_flush_logs = flushed_lsn != log_sys.flushed_to_disk_lsn;
log_mutex_exit();
......@@ -2000,7 +1997,7 @@ dberr_t srv_start(bool create_new_db)
if (srv_print_verbose_log) {
ib::info() << INNODB_VERSION_STR
<< " started; log sequence number "
<< srv_start_lsn
<< recv_sys.recovered_lsn
<< "; transaction id " << trx_sys.get_max_trx_id();
}
......
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