Commit 57c592f7 authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: Remove recv_sys.remove_extra_log_files

create_log_file(): Delete all old redo log files where they used to be
deleted, after the crash injection point innodb_log_abort_6,
before commit 9ef2d29f
deprecated and ignored the setting innodb_log_files_in_group.
parent 70f0dbe4
...@@ -296,17 +296,13 @@ struct recv_sys_t ...@@ -296,17 +296,13 @@ struct recv_sys_t
/** Last added LSN to pages. */ /** Last added LSN to pages. */
lsn_t last_stored_lsn= 0; lsn_t last_stored_lsn= 0;
/** After successful upgrade from multiple redo log files we'd like
to remove extra ones */
bool remove_extra_log_files{false};
void read(os_offset_t offset, span<byte> buf); void read(os_offset_t offset, span<byte> buf);
size_t files_size(); inline size_t files_size();
void close_files() { files.clear(); } void close_files() { files.clear(); }
private: private:
/** All found log files (more that one is possible if we're upgrading /** All found log files (multiple ones are possible if we are upgrading
from older MariaDB version */ from before MariaDB Server 10.5.1) */
std::vector<log_file_t> files; std::vector<log_file_t> files;
void open_log_files_if_needed(); void open_log_files_if_needed();
......
...@@ -743,7 +743,7 @@ void recv_sys_t::read(os_offset_t total_offset, span<byte> buf) ...@@ -743,7 +743,7 @@ void recv_sys_t::read(os_offset_t total_offset, span<byte> buf)
ut_a(err == DB_SUCCESS); ut_a(err == DB_SUCCESS);
} }
size_t recv_sys_t::files_size() inline size_t recv_sys_t::files_size()
{ {
open_log_files_if_needed(); open_log_files_if_needed();
return files.size(); return files.size();
...@@ -1439,7 +1439,6 @@ ATTRIBUTE_COLD static dberr_t recv_log_recover_pre_10_2() ...@@ -1439,7 +1439,6 @@ ATTRIBUTE_COLD static dberr_t recv_log_recover_pre_10_2()
log_sys.last_checkpoint_lsn= log_sys.next_checkpoint_lsn= log_sys.last_checkpoint_lsn= log_sys.next_checkpoint_lsn=
log_sys.write_lsn= log_sys.current_flush_lsn= lsn; log_sys.write_lsn= log_sys.current_flush_lsn= lsn;
log_sys.next_checkpoint_no= 0; log_sys.next_checkpoint_no= 0;
recv_sys.remove_extra_log_files= true;
return DB_SUCCESS; return DB_SUCCESS;
} }
...@@ -1527,7 +1526,6 @@ static dberr_t recv_log_recover_10_4() ...@@ -1527,7 +1526,6 @@ static dberr_t recv_log_recover_10_4()
log_sys.last_checkpoint_lsn = log_sys.next_checkpoint_lsn log_sys.last_checkpoint_lsn = log_sys.next_checkpoint_lsn
= log_sys.write_lsn = log_sys.current_flush_lsn = lsn; = log_sys.write_lsn = log_sys.current_flush_lsn = lsn;
log_sys.next_checkpoint_no = 0; log_sys.next_checkpoint_no = 0;
recv_sys.remove_extra_log_files = true;
return DB_SUCCESS; return DB_SUCCESS;
} }
......
...@@ -265,8 +265,9 @@ static dberr_t create_log_file(lsn_t lsn, std::string& logfile0) ...@@ -265,8 +265,9 @@ static dberr_t create_log_file(lsn_t lsn, std::string& logfile0)
DBUG_EXECUTE_IF("innodb_log_abort_6", delete_log_file("0"); DBUG_EXECUTE_IF("innodb_log_abort_6", delete_log_file("0");
return DB_ERROR;); return DB_ERROR;);
delete_log_file("0"); for (size_t i = 0; i < 102; i++) {
delete_log_file(INIT_LOG_FILE0); delete_log_file(std::to_string(i).c_str());
}
DBUG_PRINT("ib_log", ("After innodb_log_abort_6")); DBUG_PRINT("ib_log", ("After innodb_log_abort_6"));
ut_ad(!buf_pool_check_no_pending_io()); ut_ad(!buf_pool_check_no_pending_io());
...@@ -1031,8 +1032,8 @@ static lsn_t srv_prepare_to_delete_redo_log_file(bool old_exists) ...@@ -1031,8 +1032,8 @@ static lsn_t srv_prepare_to_delete_redo_log_file(bool old_exists)
if (flushed_lsn != log_sys.get_flushed_lsn()) { if (flushed_lsn != log_sys.get_flushed_lsn()) {
log_write_up_to(flushed_lsn, false); log_write_up_to(flushed_lsn, false);
}
log_sys.log.flush_data_only(); log_sys.log.flush_data_only();
}
ut_ad(flushed_lsn == log_get_lsn()); ut_ad(flushed_lsn == log_get_lsn());
...@@ -1528,15 +1529,6 @@ dberr_t srv_start(bool create_new_db) ...@@ -1528,15 +1529,6 @@ dberr_t srv_start(bool create_new_db)
err = recv_recovery_from_checkpoint_start(flushed_lsn); err = recv_recovery_from_checkpoint_start(flushed_lsn);
recv_sys.close_files(); recv_sys.close_files();
if (recv_sys.remove_extra_log_files) {
auto log_files_found = recv_sys.files_size();
recv_sys.close_files();
for (size_t i = 1; i < log_files_found; i++) {
delete_log_file(std::to_string(i).c_str());
}
recv_sys.remove_extra_log_files = false;
}
recv_sys.dblwr.pages.clear(); recv_sys.dblwr.pages.clear();
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
......
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