Browse Source

Avoid InnoDB messages about recovery after creating redo logs

srv_log_files_created: A debug flag to ensure that InnoDB redo log
files can only be created once in the server lifetime, and that
after log files have been created, no crash recovery will take place.

recv_scan_log_recs(): Detect the special case where the log consists
of a sole MLOG_CHECKPOINT record, such as immediately after creating
the redo logs.

recv_recovery_from_checkpoint_start(): Skip the recovery message
if the redo log is logically empty.
pull/409/head
Marko Mäkelä 8 years ago
parent
commit
b3171607e3
  1. 3
      storage/innobase/include/srv0srv.h
  2. 23
      storage/innobase/log/log0recv.cc
  3. 5
      storage/innobase/srv/srv0start.cc

3
storage/innobase/include/srv0srv.h

@ -546,7 +546,10 @@ extern my_bool srv_purge_view_update_only_debug;
/** Value of MySQL global used to disable master thread. */
extern my_bool srv_master_thread_disabled_debug;
/** InnoDB system tablespace to set during recovery */
extern uint srv_sys_space_size_debug;
/** whether redo log files have been created at startup */
extern bool srv_log_files_created;
#endif /* UNIV_DEBUG */
#define SRV_SEMAPHORE_WAIT_EXTENSION 7200

23
storage/innobase/log/log0recv.cc

@ -2806,7 +2806,24 @@ recv_scan_log_recs(
scanned_lsn += data_len;
if (data_len == LOG_BLOCK_HDR_SIZE + SIZE_OF_MLOG_CHECKPOINT
&& scanned_lsn == checkpoint_lsn + SIZE_OF_MLOG_CHECKPOINT
&& log_block[LOG_BLOCK_HDR_SIZE] == MLOG_CHECKPOINT
&& checkpoint_lsn == mach_read_from_8(LOG_BLOCK_HDR_SIZE
+ 1 + log_block)) {
/* The redo log is logically empty. */
ut_ad(recv_sys->mlog_checkpoint_lsn == 0
|| recv_sys->mlog_checkpoint_lsn
== checkpoint_lsn);
recv_sys->mlog_checkpoint_lsn = checkpoint_lsn;
DBUG_PRINT("ib_log", ("found empty log; LSN=" LSN_PF,
scanned_lsn));
finished = true;
break;
}
if (scanned_lsn > recv_sys->scanned_lsn) {
ut_ad(!srv_log_files_created);
if (!recv_needed_recovery) {
recv_needed_recovery = true;
@ -3244,7 +3261,11 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
there is something wrong we will print a message to the
user about recovery: */
if (checkpoint_lsn != flush_lsn) {
if (flush_lsn == checkpoint_lsn + SIZE_OF_MLOG_CHECKPOINT
&& recv_sys->mlog_checkpoint_lsn == checkpoint_lsn) {
/* The redo log is logically empty. */
} else if (checkpoint_lsn != flush_lsn) {
ut_ad(!srv_log_files_created);
if (checkpoint_lsn + SIZE_OF_MLOG_CHECKPOINT < flush_lsn) {
ib::warn() << " Are you sure you are using the"

5
storage/innobase/srv/srv0start.cc

@ -147,6 +147,8 @@ UNIV_INTERN bool srv_undo_sources;
#ifdef UNIV_DEBUG
/** InnoDB system tablespace to set during recovery */
UNIV_INTERN uint srv_sys_space_size_debug;
/** whether redo log files have been created at startup */
UNIV_INTERN bool srv_log_files_created;
#endif /* UNIV_DEBUG */
/** Bit flags for tracking background thread creation. They are used to
@ -526,6 +528,9 @@ create_log_files_rename(
we need to explicitly flush the log buffers. */
fil_flush(SRV_LOG_SPACE_FIRST_ID);
ut_ad(!srv_log_files_created);
ut_d(srv_log_files_created = true);
DBUG_EXECUTE_IF("innodb_log_abort_9", return(DB_ERROR););
DBUG_PRINT("ib_log", ("After innodb_log_abort_9"));

Loading…
Cancel
Save