Skip to content

Commit

Permalink
MDEV-27817 InnoDB recovery of recently created files is not crash-safe
Browse files Browse the repository at this point in the history
Before commit 86dc7b4 (MDEV-24626)
all tablespace ID that needed recovery were known already in
recv_init_crash_recovery_spaces().

recv_sys_t::recover_deferred(): Invoke fil_names_dirty(space) on
the newly initialized tablespace. In this way, if the next log
checkpoint occurs at some LSN that is after the initialization of
the tablespace and before the last recovered LSN, a FILE_MODIFY
record will be written, so that a subsequent recovery will succeed.

The recovery was broken when
commit 0261eac merged the 10.5
commit f443cd1 (MDEV-27022).
  • Loading branch information
dr-m committed Feb 13, 2022
1 parent f1e08ea commit 7b89100
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion storage/innobase/log/log0recv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ bool recv_sys_t::recover_deferred(recv_sys_t::map::iterator &p,
node->deferred= true;
if (!space->acquire())
goto fail;
fil_names_dirty(space);
const bool is_compressed= fil_space_t::is_compressed(flags);
#ifdef _WIN32
const bool is_sparse= is_compressed;
Expand Down Expand Up @@ -4224,7 +4225,6 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
err = recv_rename_files();
}
mysql_mutex_unlock(&recv_sys.mutex);
mysql_mutex_unlock(&log_sys.mutex);

recv_lsn_checks_on = true;

Expand All @@ -4236,6 +4236,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
err = DB_CORRUPTION;
}

mysql_mutex_unlock(&log_sys.mutex);
return err;
}

Expand Down

0 comments on commit 7b89100

Please sign in to comment.