Commit 7d7bdd4a authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-28185 InnoDB generates redundant log checkpoints

The comparison on the checkpoint age (number of log bytes
written since the previous checkpoint) is inaccurate, because
the previous FILE_CHECKPOINT record could span two 512-byte
log blocks, which will cause the LSN to increase by the size of the
log block header and footer.

We will still generate a redudant checkpoint if the previous
checkpoint wrote some FILE_MODIFY records before the FILE_CHECKPOINT
record.
parent d875c50b
......@@ -1774,9 +1774,16 @@ static bool log_checkpoint_low(lsn_t oldest_lsn, lsn_t end_lsn)
ut_ad(!recv_no_log_write);
ut_ad(oldest_lsn >= log_sys.last_checkpoint_lsn);
const lsn_t age= oldest_lsn - log_sys.last_checkpoint_lsn;
if (oldest_lsn > log_sys.last_checkpoint_lsn + SIZE_OF_FILE_CHECKPOINT)
if (age > SIZE_OF_FILE_CHECKPOINT + log_sys.framing_size())
/* Some log has been written since the previous checkpoint. */;
else if (age > SIZE_OF_FILE_CHECKPOINT &&
!((log_sys.log.calc_lsn_offset(oldest_lsn) ^
log_sys.log.calc_lsn_offset(log_sys.last_checkpoint_lsn)) &
~lsn_t{OS_FILE_LOG_BLOCK_SIZE - 1}))
/* Some log has been written to the same log block. */;
else if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED)
/* MariaDB startup expects the redo log file to be logically empty
(not even containing a FILE_CHECKPOINT record) after a clean shutdown.
......
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