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

Binlog recovery fails when binlog rotation happens through FLUSH LOGS

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.1, 10.2, 10.3, 10.4
    • 10.4
    • Replication
    • None

    Description

      binlog based recovery works only in a case where prepared transaction is present in the active binary log at the time of crash.

      For example in the following test 'INSERT INTO t VALUES (20)' is in prepared state and 'master-bin.000002' is

      active log. Server crashed here. Upon recovery two records are found in table.

      Test case:
      ======
      --source include/have_innodb.inc
      --source include/have_log_bin.inc
      --source include/have_debug.inc
      --source include/have_binlog_format_statement.inc

      RESET MASTER;

      CREATE TABLE t ( f INT ) ENGINE=INNODB;
      INSERT INTO t VALUES (10);
      FLUSH LOGS;

      1. Hold insert after write to binlog and before "run_commit_ordered" in engine
        connect(con1,localhost,root,,);
        SET DEBUG_SYNC= "commit_after_release_LOCK_log SIGNAL con1_ready WAIT_FOR con1_go";
        send INSERT INTO t VALUES (20);

      --connection default
      SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
      #FLUSH LOGS;
      #FLUSH LOGS;

      --source include/kill_and_restart_mysqld.inc

      --connection default
      SELECT * FROM t;
      --source include/show_binlog_events.inc
      DROP TABLE t;

      Bug case:

      In the above test if "FLUSH LOGS" are uncommented the active binary log will be 'master-bin.000004'.

      Prepared transaction will be in 'master-bin.000002'. Now upon restart table has only one row with value '10'.

      Binlog recovery doesn't work in this case.

      Attachments

        Activity

          People

            Elkin Andrei Elkin
            sujatha.sivakumar Sujatha Sivakumar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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