summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-12-14 20:09:56 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2021-12-15 18:11:20 +0200
commite62fa7df3823f554c24c2444df93ce480dd26d53 (patch)
tree7dcf6fa113e7a107e6f3192634026c4f7b53e745
parentdf498117e1d0ad37d798b56da3b34213abf942f4 (diff)
downloadmariadb-git-preview-10.8-MDEV-14425-concurrency-friendly-log-format.tar.gz
Starting with MDEV-14425, we require ib_logfile0 to exist unless innodb_force_recovery=6. With innodb_force_recovery=6, InnoDB will start in read-only mode, allowing the contents of a possibly corrupted database to be dumped. The only purpose of the field FIL_PAGE_FILE_FLUSH_LSN was to store the log sequence number for a new ib_logfile0 when the InnoDB redo log was missing at startup. Because FIL_PAGE_FILE_FLUSH_LSN no longer serves any purpose, we will stop updating it. The writes of that field were inherently risky, because they were not covered by neither the redo log nor the doublewrite buffer.
-rw-r--r--storage/innobase/fil/fil0fil.cc42
-rw-r--r--storage/innobase/handler/ha_innodb.cc3
-rw-r--r--storage/innobase/include/fil0fil.h9
-rw-r--r--storage/innobase/log/log0log.cc9
-rw-r--r--storage/innobase/srv/srv0start.cc12
5 files changed, 2 insertions, 73 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index cf69c71ac7c..c365b6dc0c8 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -1382,48 +1382,6 @@ void fil_set_max_space_id_if_bigger(uint32_t max_id)
mysql_mutex_unlock(&fil_system.mutex);
}
-/** Write the flushed LSN to the page header of the first page in the
-system tablespace.
-@param[in] lsn flushed LSN
-@return DB_SUCCESS or error number */
-dberr_t
-fil_write_flushed_lsn(
- lsn_t lsn)
-{
- byte* buf;
- ut_ad(!srv_read_only_mode);
-
- if (!fil_system.sys_space->acquire()) {
- return DB_ERROR;
- }
-
- buf = static_cast<byte*>(aligned_malloc(srv_page_size, srv_page_size));
-
- auto fio = fil_system.sys_space->io(IORequestRead, 0, srv_page_size,
- buf);
-
- if (fio.err == DB_SUCCESS) {
- mach_write_to_8(buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION,
- lsn);
-
- uint32_t fsp_flags = mach_read_from_4(
- buf + FSP_HEADER_OFFSET + FSP_SPACE_FLAGS);
-
- if (fil_space_t::full_crc32(fsp_flags)) {
- buf_flush_assign_full_crc32_checksum(buf);
- }
-
- fio = fil_system.sys_space->io(IORequestWrite,
- 0, srv_page_size, buf);
- fil_flush_file_spaces();
- } else {
- fil_system.sys_space->release();
- }
-
- aligned_free(buf);
- return fio.err;
-}
-
/** Acquire a tablespace reference.
@param id tablespace identifier
@return tablespace
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 3373d380fc2..063c226b323 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -18255,9 +18255,6 @@ checkpoint_now_set(THD*, st_mysql_sys_var*, void*, const void *save)
log_sys.log.flush();
}
- if (dberr_t err= fil_write_flushed_lsn(lsn))
- sql_print_warning("innodb_checkpoint_now_set failed: %d", err);
-
mysql_mutex_lock(&LOCK_global_system_variables);
}
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index b6bab2acd98..0628a52acac 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -1593,15 +1593,6 @@ Sets the max tablespace id counter if the given number is bigger than the
previous value. */
void fil_set_max_space_id_if_bigger(uint32_t max_id);
-/** Write the flushed LSN to the page header of the first page in the
-system tablespace.
-@param[in] lsn flushed LSN
-@return DB_SUCCESS or error number */
-dberr_t
-fil_write_flushed_lsn(
- lsn_t lsn)
-MY_ATTRIBUTE((warn_unused_result));
-
MY_ATTRIBUTE((warn_unused_result))
/** Delete a tablespace and associated .ibd file.
@param id tablespace identifier
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index 9b22a5cfb60..f40dbcc2b62 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -1166,15 +1166,6 @@ wait_suspend_loop:
srv_shutdown_lsn = lsn;
- if (!srv_read_only_mode) {
- dberr_t err = fil_write_flushed_lsn(lsn);
-
- if (err != DB_SUCCESS) {
- ib::error() << "Writing flushed lsn " << lsn
- << " failed; error=" << err;
- }
- }
-
/* Make some checks that the server really is quiet */
ut_ad(!srv_any_background_activity());
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 31ede9658dc..68255bdb57a 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -1304,11 +1304,7 @@ dberr_t srv_start(bool create_new_db)
buf_flush_sync();
- const lsn_t lsn{log_sys.get_lsn()};
- err = fil_write_flushed_lsn(lsn);
- if (err == DB_SUCCESS) {
- err = create_log_file_rename(lsn, logfile0);
- }
+ err = create_log_file_rename(log_sys.get_lsn(), logfile0);
if (err != DB_SUCCESS) {
return(srv_init_abort(err));
@@ -1504,15 +1500,11 @@ dberr_t srv_start(bool create_new_db)
/* Close the redo log file, so that we can replace it */
log_sys.log.close_file();
- err = fil_write_flushed_lsn(lsn);
-
DBUG_EXECUTE_IF("innodb_log_abort_5",
return(srv_init_abort(DB_ERROR)););
DBUG_PRINT("ib_log", ("After innodb_log_abort_5"));
- if (err == DB_SUCCESS) {
- err = create_log_file(false, lsn, logfile0);
- }
+ err = create_log_file(false, lsn, logfile0);
if (err == DB_SUCCESS) {
err = create_log_file_rename(lsn, logfile0);