Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-28185

InnoDB generates redundant log checkpoints

    XMLWordPrintable

Details

    Description

      The function log_checkpoint() or log_checkpoint_low() tries to avoid redundant writes. Here is the 10.3 version of log_checkpoint():

      	if (oldest_lsn
      	    > log_sys.last_checkpoint_lsn + SIZE_OF_MLOG_CHECKPOINT) {
      		/* Some log has been written since the previous checkpoint. */
      	} else if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
      		/* MariaDB 10.3 startup expects the redo log file to be
      		logically empty (not even containing a MLOG_CHECKPOINT record)
      		after a clean shutdown. Perform an extra checkpoint at
      		shutdown. */
      	} else {
      		/* Do nothing, because nothing was logged (other than
      		a MLOG_CHECKPOINT marker) since the previous checkpoint. */
      		log_mutex_exit();
      		return(true);
      	}
      ...
      	if (fil_names_clear(flush_lsn, do_write)) {
      

      This logic fails to take two things into account:

      1. The function fil_names_clear() may write some file names before the checkpoint record.
      2. Before MDEV-14425, the checkpoint record may be interrupted by 4+12 or 8+12 bytes of log block trailer and header.

      In either case, the difference of oldest_lsn and log_sys.last_checkpoint_lsn could be more than the size of the checkpoint record.

      The simplest way to fix this could be to avoid writing a new checkpoint if oldest_lsn did not change since the previous checkpoint.

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.