From b2dbc781c7c7d5638c5e7b3640656cb63543deb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 25 Apr 2019 17:26:23 +0300 Subject: [PATCH] Implement --debug=d,ib_log_checkpoint_avoid Normally, the InnoDB master thread executes InnoDB log checkpoints so frequently that bugs in crash recovery or redo logging can be hard to reproduce. This is because crash recovery would start replaying the log only from the latest checkpoint. Because the InnoDB redo log format only allows saving information for at most 2 latest checkpoints, and because the log files are written in a circular fashion, it would be challenging to implement a debug option that would start the redo log apply from the very start of the redo log file. --- storage/innobase/srv/srv0srv.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 1adf1f137d6..58596175681 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -2244,6 +2244,16 @@ srv_master_do_active_tasks(void) MONITOR_SRV_DICT_LRU_MICROSECOND, counter_time); } + /* The periodic log_checkpoint() call here makes it harder to + reproduce bugs in crash recovery or mariabackup --prepare, or + in code that writes the redo log records. Omitting the call + here should not affect correctness, because log_free_check() + should still be invoking checkpoints when needed. In a + production server, those calls could cause "furious flushing" + and stall the server. Normally we want to perform checkpoints + early and often to avoid those situations. */ + DBUG_EXECUTE_IF("ib_log_checkpoint_avoid", return;); + if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { return; } @@ -2323,6 +2333,16 @@ srv_master_do_idle_tasks(void) MONITOR_INC_TIME_IN_MICRO_SECS( MONITOR_SRV_LOG_FLUSH_MICROSECOND, counter_time); + /* The periodic log_checkpoint() call here makes it harder to + reproduce bugs in crash recovery or mariabackup --prepare, or + in code that writes the redo log records. Omitting the call + here should not affect correctness, because log_free_check() + should still be invoking checkpoints when needed. In a + production server, those calls could cause "furious flushing" + and stall the server. Normally we want to perform checkpoints + early and often to avoid those situations. */ + DBUG_EXECUTE_IF("ib_log_checkpoint_avoid", return;); + if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { return; }