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

LP:1003679 - Wrong binlog order on concurrent DROP schema and CREATE function

Details

    • 10.1.13, 10.1.14

    Description

      Also filed as http://bugs.mysql.com/bug.php?id=65428

      Concurrent execution of DROP DATABASE and CREATE FUNCTION | PROCEDURE | EVENT causes a wrong order of events in the binary log and, consequently, replication failure.

      Provided MTR test case is non-deterministic, so I am also adding an RQG grammar to reproduce.
      The problem is that on master CREATE FUNCTION gets executed without an error, but in the binlog DROP DATABASE is written before CREATE FUNCTION.

      Reproducible on maria/5.5 revno 3413, mysql-5.5 revno 3737, mysql-trunk revno 3827.
      Could not reproduce on maria/5.3, although due to the non-deterministic nature of the test there is no guarantee the problem is not present there.

      # MTR test case t1.test
      # run as perl ./mtr --mysqld=--binlog-format=mixed t1
       
      --source include/master-slave.inc
       
      DROP DATABASE IF EXISTS db1;
       
      CREATE DATABASE db1;
      CREATE FUNCTION db1.f1() RETURNS INT RETURN 1;
      --send
      DROP DATABASE db1;
       
      --connection master1
      --error 0,ER_BAD_DB_ERROR
      CREATE FUNCTION db1.f2() RETURNS INT RETURN 1;
       
      --connection master
      --reap
      SHOW BINLOG EVENTS;
       
      --sync_slave_with_master
       

      # Binlog contents:
       
      Log_name        Pos     Event_type      Server_id       End_log_pos     Info
      slave-relay-bin.000002  4       Format_desc     2       245     Server ver: 5.5.23-MariaDB-debug-log, Binlog ver: 4
      slave-relay-bin.000002  245     Rotate  1       0       master-bin.000001;pos=4
      slave-relay-bin.000002  289     Format_desc     1       245     Server ver: 5.5.23-MariaDB-debug-log, Binlog ver: 4
      slave-relay-bin.000002  530     Query   1       334     DROP DATABASE IF EXISTS db1
      slave-relay-bin.000002  619     Query   1       415     CREATE DATABASE db1
      slave-relay-bin.000002  700     Query   1       574     use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db1`.`f1`() RETURNS int(11)
      RETURN 1
      slave-relay-bin.000002  859     Query   1       653     DROP DATABASE db1
      slave-relay-bin.000002  938     Query   1       812     use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db1`.`f2`() RETURNS int(11)
      RETURN 1

      # RQG grammar t1.yy
       
      query:
           CREATE DATABASE IF NOT EXISTS db1; CREATE FUNCTION db1.f1() RETURNS INT RETURN 1; DROP DATABASE db1;
       
      thread1:
           CREATE FUNCTION db1.f2() RETURNS INT RETURN 1; DROP FUNCTION db1.f2;
       

      # RQG command line:
       
      perl runall.pl \
      --queries=100M \
      --threads=2 \
      --duration=600 \
      --grammar=t1.yy \
      --rpl_mode=mixed \
      --basedir1=<your basedir> \
      --vardir1=<your vardir>

      Attachments

        Activity

          elenst Elena Stepanova created issue -
          ratzpo Rasmus Johansson (Inactive) made changes -
          Field Original Value New Value
          Labels Launchpad
          ratzpo Rasmus Johansson (Inactive) made changes -
          Fix Version/s Maria 5.5 [ 11303 ]
          Labels Launchpad Launchpad MariaDB_5.5
          ratzpo Rasmus Johansson (Inactive) made changes -
          Key IMT-6576 MDEV-717
          Project ImportTest [ 10200 ] MariaDB Development [ 10000 ]
          Workflow jira [ 20225 ] defaullt [ 21561 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.29 [ 11701 ]
          serg Sergei Golubchik made changes -
          Labels Launchpad MariaDB_5.5 Launchpad
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.29 [ 12102 ]
          Fix Version/s 5.5.28a [ 11701 ]
          serg Sergei Golubchik made changes -
          Priority Trivial [ 5 ] Minor [ 4 ]
          serg Sergei Golubchik made changes -
          Labels Launchpad Launchpad upstream
          serg Sergei Golubchik made changes -
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.30 [ 11800 ]
          Fix Version/s 5.5.29 [ 12102 ]
          knielsen Kristian Nielsen made changes -
          Fix Version/s 5.5.31 [ 12700 ]
          Fix Version/s 5.5.30 [ 11800 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.32 [ 13000 ]
          Fix Version/s 5.5.31 [ 12700 ]
          knielsen Kristian Nielsen made changes -
          Priority Minor [ 4 ] Trivial [ 5 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.33 [ 13300 ]
          Fix Version/s 5.5.32 [ 13000 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.34 [ 13500 ]
          Fix Version/s 5.5.33 [ 13300 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.34 [ 13700 ]
          Fix Version/s 5.5.33a [ 13500 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.35 [ 14000 ]
          Fix Version/s 5.5.34 [ 13700 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.36 [ 14600 ]
          Fix Version/s 5.5.35 [ 14000 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.37 [ 15000 ]
          Fix Version/s 5.5.36 [ 14600 ]
          elenst Elena Stepanova made changes -
          Fix Version/s 5.5.37 [ 15000 ]
          Affects Version/s 5.5.36 [ 14600 ]
          Affects Version/s 10.0.10 [ 14500 ]
          Assignee Kristian Nielsen [ knielsen ]
          Description Also filed as http://bugs.mysql.com/bug.php?id=65428

          Concurrent execution of DROP DATABASE and CREATE FUNCTION | PROCEDURE | EVENT causes a wrong order of events in the binary log and, consequently, replication failure.

          Provided MTR test case is non-deterministic, so I am also adding an RQG grammar to reproduce.
          The problem is that on master CREATE FUNCTION gets executed without an error, but in the binlog DROP DATABASE is written before CREATE FUNCTION.

          Reproducible on maria/5.5 revno 3413, mysql-5.5 revno 3737, mysql-trunk revno 3827.
          Could not reproduce on maria/5.3, although due to the non-deterministic nature of the test there is no guarantee the problem is not present there.

          # MTR test case t1.test
          # run as perl ./mtr --mysqld=--binlog-format=mixed t1

          --source include/master-slave.inc

          DROP DATABASE IF EXISTS db1;

          CREATE DATABASE db1;
          CREATE FUNCTION db1.f1() RETURNS INT RETURN 1;
          --send
          DROP DATABASE db1;

          --connection master1
          --error 0,ER_BAD_DB_ERROR
          CREATE FUNCTION db1.f2() RETURNS INT RETURN 1;

          --connection master
          --reap
          SHOW BINLOG EVENTS;

          --sync_slave_with_master

          # End of MTR test case

          # Binlog contents:

          Log_name Pos Event_type Server_id End_log_pos Info
          slave-relay-bin.000002 4 Format_desc 2 245 Server ver: 5.5.23-MariaDB-debug-log, Binlog ver: 4
          slave-relay-bin.000002 245 Rotate 1 0 master-bin.000001;pos=4
          slave-relay-bin.000002 289 Format_desc 1 245 Server ver: 5.5.23-MariaDB-debug-log, Binlog ver: 4
          slave-relay-bin.000002 530 Query 1 334 DROP DATABASE IF EXISTS db1
          slave-relay-bin.000002 619 Query 1 415 CREATE DATABASE db1
          slave-relay-bin.000002 700 Query 1 574 use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db1`.`f1`() RETURNS int(11)
          RETURN 1
          slave-relay-bin.000002 859 Query 1 653 DROP DATABASE db1
          slave-relay-bin.000002 938 Query 1 812 use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db1`.`f2`() RETURNS int(11)
          RETURN 1

          # RQG grammar t1.yy

          query:
               CREATE DATABASE IF NOT EXISTS db1; CREATE FUNCTION db1.f1() RETURNS INT RETURN 1; DROP DATABASE db1;

          thread1:
               CREATE FUNCTION db1.f2() RETURNS INT RETURN 1; DROP FUNCTION db1.f2;

          # End of RQG grammar

          # RQG command line:

          perl runall.pl \
          --queries=100M \
          --threads=2 \
          --duration=600 \
          --grammar=t1.yy \
          --rpl_mode=mixed \
          --basedir1=<your basedir> \
          --vardir1=<your vardir>
          Also filed as http://bugs.mysql.com/bug.php?id=65428

          Concurrent execution of DROP DATABASE and CREATE FUNCTION | PROCEDURE | EVENT causes a wrong order of events in the binary log and, consequently, replication failure.

          Provided MTR test case is non-deterministic, so I am also adding an RQG grammar to reproduce.
          The problem is that on master CREATE FUNCTION gets executed without an error, but in the binlog DROP DATABASE is written before CREATE FUNCTION.

          Reproducible on maria/5.5 revno 3413, mysql-5.5 revno 3737, mysql-trunk revno 3827.
          Could not reproduce on maria/5.3, although due to the non-deterministic nature of the test there is no guarantee the problem is not present there.

          {code:sql}
          # MTR test case t1.test
          # run as perl ./mtr --mysqld=--binlog-format=mixed t1

          --source include/master-slave.inc

          DROP DATABASE IF EXISTS db1;

          CREATE DATABASE db1;
          CREATE FUNCTION db1.f1() RETURNS INT RETURN 1;
          --send
          DROP DATABASE db1;

          --connection master1
          --error 0,ER_BAD_DB_ERROR
          CREATE FUNCTION db1.f2() RETURNS INT RETURN 1;

          --connection master
          --reap
          SHOW BINLOG EVENTS;

          --sync_slave_with_master

          {code}

          {noformat}
          # Binlog contents:

          Log_name Pos Event_type Server_id End_log_pos Info
          slave-relay-bin.000002 4 Format_desc 2 245 Server ver: 5.5.23-MariaDB-debug-log, Binlog ver: 4
          slave-relay-bin.000002 245 Rotate 1 0 master-bin.000001;pos=4
          slave-relay-bin.000002 289 Format_desc 1 245 Server ver: 5.5.23-MariaDB-debug-log, Binlog ver: 4
          slave-relay-bin.000002 530 Query 1 334 DROP DATABASE IF EXISTS db1
          slave-relay-bin.000002 619 Query 1 415 CREATE DATABASE db1
          slave-relay-bin.000002 700 Query 1 574 use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db1`.`f1`() RETURNS int(11)
          RETURN 1
          slave-relay-bin.000002 859 Query 1 653 DROP DATABASE db1
          slave-relay-bin.000002 938 Query 1 812 use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db1`.`f2`() RETURNS int(11)
          RETURN 1
          {noformat}

          {noformat}
          # RQG grammar t1.yy

          query:
               CREATE DATABASE IF NOT EXISTS db1; CREATE FUNCTION db1.f1() RETURNS INT RETURN 1; DROP DATABASE db1;

          thread1:
               CREATE FUNCTION db1.f2() RETURNS INT RETURN 1; DROP FUNCTION db1.f2;

          {noformat}

          {noformat}
          # RQG command line:

          perl runall.pl \
          --queries=100M \
          --threads=2 \
          --duration=600 \
          --grammar=t1.yy \
          --rpl_mode=mixed \
          --basedir1=<your basedir> \
          --vardir1=<your vardir>
          {noformat}

          serg Sergei Golubchik made changes -
          Workflow defaullt [ 21561 ] MariaDB v2 [ 44252 ]
          elenst Elena Stepanova made changes -
          Component/s OTHER [ 10125 ]
          Fix Version/s 10.1 [ 16100 ]
          Affects Version/s 10.0 [ 16000 ]
          Affects Version/s 5.5 [ 15800 ]
          Affects Version/s 10.0.10 [ 14500 ]
          Affects Version/s 5.5.36 [ 14600 ]
          Labels Launchpad upstream Launchpad upstream-fixed
          Priority Trivial [ 5 ] Major [ 3 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB v2 [ 44252 ] MariaDB v3 [ 65223 ]
          holyfoot Alexey Botchkov made changes -
          Assignee Alexey Botchkov [ holyfoot ]
          holyfoot Alexey Botchkov made changes -
          Sprint 10.1.13 [ 42 ]
          holyfoot Alexey Botchkov made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          holyfoot Alexey Botchkov made changes -
          Assignee Alexey Botchkov [ holyfoot ] Sergei Golubchik [ serg ]
          Status In Progress [ 3 ] In Review [ 10002 ]
          serg Sergei Golubchik made changes -
          Assignee Sergei Golubchik [ serg ] Alexey Botchkov [ holyfoot ]
          Status In Review [ 10002 ] Stalled [ 10000 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Sprint 10.1.13 [ 42 ] 10.1.13, 10.1.14 [ 42, 51 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Rank Ranked lower
          holyfoot Alexey Botchkov made changes -
          Status Stalled [ 10000 ] In Progress [ 3 ]
          holyfoot Alexey Botchkov made changes -
          Assignee Alexey Botchkov [ holyfoot ] Sergei Golubchik [ serg ]
          Status In Progress [ 3 ] In Review [ 10002 ]
          serg Sergei Golubchik made changes -
          Assignee Sergei Golubchik [ serg ] Alexey Botchkov [ holyfoot ]
          Status In Review [ 10002 ] Stalled [ 10000 ]
          holyfoot Alexey Botchkov made changes -
          issue.field.resolutiondate 2016-05-05 07:43:01.0 2016-05-05 07:43:01.807
          holyfoot Alexey Botchkov made changes -
          Fix Version/s 10.1.16 [ 22019 ]
          Fix Version/s 10.1 [ 16100 ]
          Resolution Fixed [ 1 ]
          Status Stalled [ 10000 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Component/s Data Definition - Procedure [ 10119 ]
          Component/s Replication [ 10100 ]
          Component/s OTHER [ 10125 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 65223 ] MariaDB v4 [ 145042 ]

          People

            holyfoot Alexey Botchkov
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.