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

IO Thread Can Write Gtid_list_log_event Mid-transaction into Relay Log

    XMLWordPrintable

Details

    Description

      If the IO thread received ignored events (say by IGNORE_DOMAIN_IDS from CHANGE MASTER TO), if the IO thread is stopped while actively logging a transaction to the relay log (i.e. the transaction start event was logged, but no end event), the function write_ignored_events_info_to_relay_log() in the IO thread's stop logic will write a Gtid_list_log_event. There is a DBUG_ASSERT which tries to catch this, but uses the wrong condition, and it should also be updated:

      diff --git a/sql/slave.cc b/sql/slave.cc
      index f4d76e447cd..b4f3e829070 100644
      --- a/sql/slave.cc
      +++ b/sql/slave.cc
      @@ -2687,7 +2687,7 @@ static void write_ignored_events_info_to_relay_log(THD *thd, Master_info *mi)
           }
           if (rli->ign_gtids.count())
           {
      -      DBUG_ASSERT(!rli->is_in_group());         // Ensure no active transaction
      +      DBUG_ASSERT(!mi->events_queued_since_last_gtid);         // Ensure no active transaction
             glev= new Gtid_list_log_event(&rli->ign_gtids,
                                           Gtid_list_log_event::FLAG_IGN_GTIDS);
             rli->ign_gtids.reset();
      

      A couple suggested fixes from Andrei are

      Anything that would cause SQL thread to stop, and retry later from the beginning of the group.
      Maybe Incident.

      Should be converted to an error.
      The Glle should not be logged, and perhaps the right way is to log a ROLLBACK instead in this case.

      Attachments

        Issue Links

          Activity

            People

              bnestere Brandon Nesterenko
              bnestere Brandon Nesterenko
              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.