Commit b3171607 authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent 3e1d0ff5
...@@ -546,7 +546,10 @@ extern my_bool srv_purge_view_update_only_debug; ...@@ -546,7 +546,10 @@ extern my_bool srv_purge_view_update_only_debug;
/** Value of MySQL global used to disable master thread. */ /** Value of MySQL global used to disable master thread. */
extern my_bool srv_master_thread_disabled_debug; extern my_bool srv_master_thread_disabled_debug;
/** InnoDB system tablespace to set during recovery */
extern uint srv_sys_space_size_debug; 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 */ #endif /* UNIV_DEBUG */
#define SRV_SEMAPHORE_WAIT_EXTENSION 7200 #define SRV_SEMAPHORE_WAIT_EXTENSION 7200
......
...@@ -2806,7 +2806,24 @@ recv_scan_log_recs( ...@@ -2806,7 +2806,24 @@ recv_scan_log_recs(
scanned_lsn += data_len; 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) { if (scanned_lsn > recv_sys->scanned_lsn) {
ut_ad(!srv_log_files_created);
if (!recv_needed_recovery) { if (!recv_needed_recovery) {
recv_needed_recovery = true; recv_needed_recovery = true;
...@@ -3244,7 +3261,11 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) ...@@ -3244,7 +3261,11 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
there is something wrong we will print a message to the there is something wrong we will print a message to the
user about recovery: */ 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) { if (checkpoint_lsn + SIZE_OF_MLOG_CHECKPOINT < flush_lsn) {
ib::warn() << " Are you sure you are using the" ib::warn() << " Are you sure you are using the"
......
...@@ -147,6 +147,8 @@ UNIV_INTERN bool srv_undo_sources; ...@@ -147,6 +147,8 @@ UNIV_INTERN bool srv_undo_sources;
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/** InnoDB system tablespace to set during recovery */ /** InnoDB system tablespace to set during recovery */
UNIV_INTERN uint srv_sys_space_size_debug; 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 */ #endif /* UNIV_DEBUG */
/** Bit flags for tracking background thread creation. They are used to /** Bit flags for tracking background thread creation. They are used to
...@@ -526,6 +528,9 @@ create_log_files_rename( ...@@ -526,6 +528,9 @@ create_log_files_rename(
we need to explicitly flush the log buffers. */ we need to explicitly flush the log buffers. */
fil_flush(SRV_LOG_SPACE_FIRST_ID); 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_EXECUTE_IF("innodb_log_abort_9", return(DB_ERROR););
DBUG_PRINT("ib_log", ("After innodb_log_abort_9")); DBUG_PRINT("ib_log", ("After innodb_log_abort_9"));
......
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