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

RBR failure on concurrent ANALYZE TABLE and DELETE from a statistical table

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.0.1
    • None
    • None
    • None

    Description

      Patch to set a debug sync point (on 10.0-base igor@askmonty.org-20130113101122-zlycez54xirrq9z6 revno 3468):

      === modified file 'sql/sql_admin.cc'
      --- sql/sql_admin.cc	2012-12-14 07:05:12 +0000
      +++ sql/sql_admin.cc	2013-01-13 22:54:12 +0000
      @@ -1092,6 +1092,7 @@
           /*
             Presumably, ANALYZE and binlog writing doesn't require synchronization
           */
      +    DEBUG_SYNC(thd,"analyze_before_write_bin_log");
           res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
         }
         m_lex->select_lex.table_list.first= first_table;

      Test case:

      --source include/master-slave.inc
      --source include/have_binlog_format_row.inc
       
      SET use_stat_tables = PREFERABLY;
       
      CREATE TABLE t1 (i INT) ENGINE=MyISAM;
       
      SET DEBUG_SYNC="analyze_before_write_bin_log SIGNAL ready_to_binlog WAIT_FOR write";
       
      --send 
      ANALYZE TABLE t1;
       
      --connection master1
      SET DEBUG_SYNC="now WAIT_FOR ready_to_binlog";
      DELETE FROM mysql.table_stats;
      SET DEBUG_SYNC="now SIGNAL write";
       
      --connection master
      --reap
      --sync_slave_with_master

      Indication of the failure – slave complains

      Could not execute Delete_rows event on table mysql.table_stats; Can't find record in 'table_stats', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos 557

      and MTR prints a lot of stuff, including the error above and events from binary logs.

      Problem:
      First thread runs ANALYZE, writes a record into the stat table, but not yet into the binary log. At this time another thread runs DELETE, finds the record and immediately writes it to the binary log. Then the first thread finally writes ANALYZE into the binary log.
      Slave reads the delete event first, attempts to find the requested row, fails (because there was no ANALYZE on the slave yet), SQL thread aborts.

      Attachments

        Activity

          People

            Unassigned Unassigned
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.