Commit 5da6bd7b authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-11027 InnoDB log recovery is too noisy

Provide more useful progress reporting of crash recovery.

recv_sys_t::progress_time: The time of the last report.

recv_sys_t::report(ib_time_t): Determine whether progress should
be reported.

recv_scan_print_counter: Remove.

log_group_read_log_seg(): After after each I/O request, invoke
recv_sys_t::report() and report progress if needed.

recv_apply_hashed_log_recs(): Change the return type back to void
(DB_SUCCESS was always returned), and rename the parameter to last_batch.
At the start of each batch, if there are pages to be recovered,
issue a message.
parent 0b1abc2f
...@@ -66,7 +66,8 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES ...@@ -66,7 +66,8 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb' WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED'); AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND /InnoDB: Log scan progressed past the checkpoint lsn 1213964/ in mysqld.1.err FOUND /InnoDB: Starting crash recovery from checkpoint LSN=1213964/ in mysqld.1.err
FOUND /InnoDB: MLOG_FILE_NAME incorrect:bogus/ in mysqld.1.err
FOUND /InnoDB: ############### CORRUPT LOG RECORD FOUND ##################/ in mysqld.1.err FOUND /InnoDB: ############### CORRUPT LOG RECORD FOUND ##################/ in mysqld.1.err
FOUND /InnoDB: Log record type 55, page 151:488\. Log parsing proceeded successfully up to 1213973\. Previous log record type 56, is multi 0 Recv offset 9, prev 0/ in mysqld.1.err FOUND /InnoDB: Log record type 55, page 151:488\. Log parsing proceeded successfully up to 1213973\. Previous log record type 56, is multi 0 Recv offset 9, prev 0/ in mysqld.1.err
FOUND /len 22. hex 38000000000012860cb7809781e80006626f67757300. asc 8 bogus / in mysqld.1.err FOUND /len 22. hex 38000000000012860cb7809781e80006626f67757300. asc 8 bogus / in mysqld.1.err
...@@ -83,6 +84,7 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES ...@@ -83,6 +84,7 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb' WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED'); AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND /InnoDB: MLOG_FILE_NAME incorrect:bigot/ in mysqld.1.err
FOUND /len 22; hex 38000000000012860cb7809781e800066269676f7400; asc 8 bigot ;/ in mysqld.1.err FOUND /len 22; hex 38000000000012860cb7809781e800066269676f7400; asc 8 bigot ;/ in mysqld.1.err
# missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT # missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT
SELECT * FROM INFORMATION_SCHEMA.ENGINES SELECT * FROM INFORMATION_SCHEMA.ENGINES
......
...@@ -66,7 +66,8 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES ...@@ -66,7 +66,8 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb' WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED'); AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND /InnoDB: Log scan progressed past the checkpoint lsn 1213964/ in mysqld.1.err FOUND /InnoDB: Starting crash recovery from checkpoint LSN=1213964/ in mysqld.1.err
FOUND /InnoDB: MLOG_FILE_NAME incorrect:bogus/ in mysqld.1.err
FOUND /InnoDB: ############### CORRUPT LOG RECORD FOUND ##################/ in mysqld.1.err FOUND /InnoDB: ############### CORRUPT LOG RECORD FOUND ##################/ in mysqld.1.err
FOUND /InnoDB: Log record type 55, page 151:488\. Log parsing proceeded successfully up to 1213973\. Previous log record type 56, is multi 0 Recv offset 9, prev 0/ in mysqld.1.err FOUND /InnoDB: Log record type 55, page 151:488\. Log parsing proceeded successfully up to 1213973\. Previous log record type 56, is multi 0 Recv offset 9, prev 0/ in mysqld.1.err
FOUND /len 22. hex 38000000000012860cb7809781e80006626f67757300. asc 8 bogus / in mysqld.1.err FOUND /len 22. hex 38000000000012860cb7809781e80006626f67757300. asc 8 bogus / in mysqld.1.err
...@@ -83,6 +84,7 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES ...@@ -83,6 +84,7 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb' WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED'); AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND /InnoDB: MLOG_FILE_NAME incorrect:bigot/ in mysqld.1.err
FOUND /len 22; hex 38000000000012860cb7809781e800066269676f7400; asc 8 bigot ;/ in mysqld.1.err FOUND /len 22; hex 38000000000012860cb7809781e800066269676f7400; asc 8 bigot ;/ in mysqld.1.err
# missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT # missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT
SELECT * FROM INFORMATION_SCHEMA.ENGINES SELECT * FROM INFORMATION_SCHEMA.ENGINES
......
...@@ -262,7 +262,9 @@ EOF ...@@ -262,7 +262,9 @@ EOF
--source include/start_mysqld.inc --source include/start_mysqld.inc
eval $check_no_innodb; eval $check_no_innodb;
--source include/shutdown_mysqld.inc --source include/shutdown_mysqld.inc
let SEARCH_PATTERN=InnoDB: Log scan progressed past the checkpoint lsn 1213964; let SEARCH_PATTERN=InnoDB: Starting crash recovery from checkpoint LSN=1213964;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN=InnoDB: MLOG_FILE_NAME incorrect:bogus;
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
let SEARCH_PATTERN=InnoDB: ############### CORRUPT LOG RECORD FOUND ##################; let SEARCH_PATTERN=InnoDB: ############### CORRUPT LOG RECORD FOUND ##################;
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
...@@ -314,6 +316,8 @@ EOF ...@@ -314,6 +316,8 @@ EOF
--source include/start_mysqld.inc --source include/start_mysqld.inc
eval $check_no_innodb; eval $check_no_innodb;
--source include/shutdown_mysqld.inc --source include/shutdown_mysqld.inc
let SEARCH_PATTERN=InnoDB: MLOG_FILE_NAME incorrect:bigot;
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= len 22; hex 38000000000012860cb7809781e800066269676f7400; asc 8 bigot ; --let SEARCH_PATTERN= len 22; hex 38000000000012860cb7809781e800066269676f7400; asc 8 bigot ;
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
......
...@@ -73,15 +73,13 @@ let SEARCH_PATTERN= syntax error in innodb_log_group_home_dir; ...@@ -73,15 +73,13 @@ let SEARCH_PATTERN= syntax error in innodb_log_group_home_dir;
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE --error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1; SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records; let SEARCH_PATTERN= InnoDB: Starting crash recovery from checkpoint LSN=;
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
--let $restart_parameters= --debug=d,innodb_log_abort_3 --let $restart_parameters= --debug=d,innodb_log_abort_3
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE --error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1; SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
--let $restart_parameters= --innodb-read-only --let $restart_parameters= --innodb-read-only
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
...@@ -95,8 +93,6 @@ let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery; ...@@ -95,8 +93,6 @@ let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE --error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1; SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages; let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
...@@ -104,8 +100,6 @@ let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages; ...@@ -104,8 +100,6 @@ let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE --error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1; SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages; let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
...@@ -121,8 +115,6 @@ let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery; ...@@ -121,8 +115,6 @@ let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
--error ER_UNKNOWN_STORAGE_ENGINE --error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1; SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages; let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
......
...@@ -105,20 +105,12 @@ Reset the state of the recovery system variables. */ ...@@ -105,20 +105,12 @@ Reset the state of the recovery system variables. */
void void
recv_sys_var_init(void); recv_sys_var_init(void);
/*===================*/ /*===================*/
/*******************************************************************//**
Empties the hash table of stored log records, applying them to appropriate /** Apply the hash table of stored log records to persistent data pages.
pages. */ @param[in] last_batch whether the change buffer merge will be
dberr_t performed as part of the operation */
recv_apply_hashed_log_recs( void
/*=======================*/ recv_apply_hashed_log_recs(bool last_batch);
ibool allow_ibuf) /*!< in: if TRUE, also ibuf operations are
allowed during the application; if FALSE,
no ibuf operations are allowed, and after
the application all file pages are flushed to
disk and invalidated in buffer pool: this
alternative means that no new log records
can be generated during the application */
__attribute__((warn_unused_result));
/** Block of log record data */ /** Block of log record data */
struct recv_data_t{ struct recv_data_t{
...@@ -244,6 +236,8 @@ struct recv_sys_t{ ...@@ -244,6 +236,8 @@ struct recv_sys_t{
lsn_t mlog_checkpoint_lsn; lsn_t mlog_checkpoint_lsn;
/*!< the LSN of a MLOG_CHECKPOINT /*!< the LSN of a MLOG_CHECKPOINT
record, or 0 if none was parsed */ record, or 0 if none was parsed */
/** the time when progress was last reported */
ib_time_t progress_time;
mem_heap_t* heap; /*!< memory heap of log records and file mem_heap_t* heap; /*!< memory heap of log records and file
addresses*/ addresses*/
hash_table_t* addr_hash;/*!< hash table of file addresses of pages */ hash_table_t* addr_hash;/*!< hash table of file addresses of pages */
...@@ -251,6 +245,20 @@ struct recv_sys_t{ ...@@ -251,6 +245,20 @@ struct recv_sys_t{
addresses in the hash table */ addresses in the hash table */
recv_dblwr_t dblwr; recv_dblwr_t dblwr;
/** Determine whether redo log recovery progress should be reported.
@param[in] time the current time
@return whether progress should be reported
(the last report was at least 15 seconds ago) */
bool report(ib_time_t time)
{
if (time - progress_time < 15) {
return false;
}
progress_time = time;
return true;
}
}; };
/** The recovery system */ /** The recovery system */
......
...@@ -1515,7 +1515,6 @@ log_preflush_pool_modified_pages( ...@@ -1515,7 +1515,6 @@ log_preflush_pool_modified_pages(
bool success; bool success;
if (recv_recovery_on) { if (recv_recovery_on) {
dberr_t err = DB_SUCCESS;
/* If the recovery is running, we must first apply all /* If the recovery is running, we must first apply all
log records to their respective file pages to get the log records to their respective file pages to get the
right modify lsn values to these pages: otherwise, there right modify lsn values to these pages: otherwise, there
...@@ -1524,13 +1523,7 @@ log_preflush_pool_modified_pages( ...@@ -1524,13 +1523,7 @@ log_preflush_pool_modified_pages(
not know how up-to-date the disk version of the database is, not know how up-to-date the disk version of the database is,
and we could not make a new checkpoint on the basis of the and we could not make a new checkpoint on the basis of the
info on the buffer pool only. */ info on the buffer pool only. */
recv_apply_hashed_log_recs(true);
err = recv_apply_hashed_log_recs(TRUE);
if (err != DB_SUCCESS) {
ib::warn() << "recv_apply_hashed_log_recs failed err: "
<< err << " file: " << __FILE__ << " line: " << __LINE__;
}
} }
if (new_oldest == LSN_MAX if (new_oldest == LSN_MAX
...@@ -1775,14 +1768,7 @@ log_checkpoint( ...@@ -1775,14 +1768,7 @@ log_checkpoint(
os_thread_sleep(360000000);); os_thread_sleep(360000000););
if (recv_recovery_is_on()) { if (recv_recovery_is_on()) {
dberr_t err = DB_SUCCESS; recv_apply_hashed_log_recs(true);
err = recv_apply_hashed_log_recs(TRUE);
if (err != DB_SUCCESS) {
ib::warn() << "recv_apply_hashed_log_recs failed err: "
<< err << " file: " << __FILE__ << " line: " << __LINE__;
}
} }
#ifndef _WIN32 #ifndef _WIN32
......
This diff is collapsed.
...@@ -2225,7 +2225,7 @@ innobase_start_or_create_for_mysql(void) ...@@ -2225,7 +2225,7 @@ innobase_start_or_create_for_mysql(void)
return(srv_init_abort(err)); return(srv_init_abort(err));
} }
/* This must precede recv_apply_hashed_log_recs(TRUE). */ /* This must precede recv_apply_hashed_log_recs(true). */
purge_queue = trx_sys_init_at_db_start(); purge_queue = trx_sys_init_at_db_start();
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
...@@ -2233,14 +2233,9 @@ innobase_start_or_create_for_mysql(void) ...@@ -2233,14 +2233,9 @@ innobase_start_or_create_for_mysql(void)
respective file pages, for the last batch of respective file pages, for the last batch of
recv_group_scan_log_recs(). */ recv_group_scan_log_recs(). */
err = recv_apply_hashed_log_recs(TRUE); recv_apply_hashed_log_recs(true);
DBUG_PRINT("ib_log", ("apply completed")); DBUG_PRINT("ib_log", ("apply completed"));
if (err != DB_SUCCESS) {
UT_DELETE(purge_queue);
return(srv_init_abort(err));
}
if (recv_needed_recovery) { if (recv_needed_recovery) {
trx_sys_print_mysql_binlog_offset(); trx_sys_print_mysql_binlog_offset();
} }
......
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