diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-03-02 14:34:52 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-03-02 15:01:46 +0200 |
commit | 8511f04fdb4cc69a6c90b543624305ef715f9e53 (patch) | |
tree | 7dd3e97fb99139203dccd52933a60da445f086b8 | |
parent | 55a5b5baf665793b63cb49bb59b0356ad77fdd00 (diff) | |
download | mariadb-git-8511f04fdb4cc69a6c90b543624305ef715f9e53.tar.gz |
Cleanup: Remove srv_start_lsn
Most of the time, we can refer to recv_sys.recovered_lsn.
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 4 | ||||
-rw-r--r-- | storage/innobase/include/log0crypt.h | 7 | ||||
-rw-r--r-- | storage/innobase/include/srv0start.h | 2 | ||||
-rw-r--r-- | storage/innobase/log/log0crypt.cc | 10 | ||||
-rw-r--r-- | storage/innobase/log/log0log.cc | 7 | ||||
-rw-r--r-- | storage/innobase/log/log0recv.cc | 12 | ||||
-rw-r--r-- | storage/innobase/srv/srv0srv.cc | 2 | ||||
-rw-r--r-- | storage/innobase/srv/srv0start.cc | 5 |
8 files changed, 19 insertions, 30 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index a17aace794b..f90a7390993 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -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 diff --git a/storage/innobase/include/log0crypt.h b/storage/innobase/include/log0crypt.h index 8d26ccb2ba3..2095649f131 100644 --- a/storage/innobase/include/log0crypt.h +++ b/storage/innobase/include/log0crypt.h @@ -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 diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h index 10b9a710ac1..34ca11a23f0 100644 --- a/storage/innobase/include/srv0start.h +++ b/storage/innobase/include/srv0start.h @@ -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; diff --git a/storage/innobase/log/log0crypt.cc b/storage/innobase/log/log0crypt.cc index d03e23d7a08..ea621a1bf1a 100644 --- a/storage/innobase/log/log0crypt.cc +++ b/storage/innobase/log/log0crypt.cc @@ -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 @@ next_slot: } /** 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 @@ found: 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; diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 178251843b4..4a1ff08e2bc 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -1892,7 +1892,7 @@ wait_suspend_loop: 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 @@ wait_suspend_loop: 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; diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 94e205b7656..40daf88ef05 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -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 @@ completed: 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; diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index ca66ab453ed..404140a7872 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -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; diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 65c89d718e8..6145d50cbc9 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -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 @@ skip_monitors: 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(); } |