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

Errorred-out CREATE-or-REPLACE-SELECT does not log DROP table into binlog

Details

    Description

      CREATE-or-REPLACE-SELECT additionally to MDEV-35207 had
      a specific issue to missed DROP TABLE logging into the binary log.
      How to reproduce is described in a while loop of the following mtr test (to be committed with this + MDEV-35207 fixes).

      --source include/have_binlog_format_row.inc
      --source include/have_innodb.inc
       
      --connection default
      set @max_binlog_cache_size         = @@global.max_binlog_cache_size;
      set @binlog_cache_size             = @@global.binlog_cache_size;
      set @@global.max_binlog_cache_size = 4096;
      set @@global.    binlog_cache_size = 4096;
       
      --echo #
      --echo # MDEV-35207
      --echo #
      # fixate the current (write) binlog position
      --let $binlog_file_0= query_get_value(SHOW MASTER STATUS, File, 1)
      --let $binlog_start_0 = query_get_value(SHOW MASTER STATUS, Position, 1)
       
      # use a separate connection also to validate its close will be clean
      connect (conn_err,localhost,root,,);
       
      call mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage");
      --error ER_TRANS_CACHE_FULL
      create table t engine=myisam select repeat ('a',4096*3) AS a;
       
      --error ER_TRANS_CACHE_FULL
      create table t engine=innodb select repeat ('a',4096*3) AS a;
       
      --error ER_DUP_ENTRY
      create table t (a int unique, b char) select 1 AS a, 'b' as b union select 1 as a, 'c' as b;
      --error ER_NO_SUCH_TABLE
      select * from t;
       
      --disconnect conn_err
       
      --connection default
      --let $binlog_file_1= query_get_value(SHOW MASTER STATUS, File, 1)
      --let $binlog_start_1= query_get_value(SHOW MASTER STATUS, Position, 1)
       
      --let $cmp = `select strcmp('$binlog_file_1', '$binlog_file_0') <> 0 OR $binlog_start_1 <> $binlog_start_0` 
      if (!$cmp)
      {
         --echo *** Error: unexpected advance of binlog position
         --die
      }
       
      --echo
      --echo #
      --echo # MDEV-CoRS errored CoRS does not DROP table in binlog
      --echo #
      --let $i = 2
      while ($i)
      {
        --let $engine=`select if($i % 2, "myisam", "innodb")`
        --echo #
        --echo # Engine = $engine
        --echo #
        set statement binlog_format=statement for create table t (a int) select 1 as a;
        --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
        --let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
        --error ER_DUP_ENTRY
        --eval set statement binlog_format=row for create or replace table t (a int primary key, b char) engine=$engine select 1 AS a, 'b' as b union select 1 as a, 'c' as b
        --error ER_NO_SUCH_TABLE
        select * from t;
        --echo #
        --echo # Prove an expected lonely `DROP table t'
        --source include/show_binlog_events.inc
       
        # error before stmt commit
        set statement binlog_format=statement for create table t (a int) select 1 as a;
        --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
        --let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
        --error ER_TRANS_CACHE_FULL
        --eval set statement binlog_format=row for create or replace table t (a text) engine=$engine select repeat ('a',1024) AS a union select repeat ('a',3*4096) AS a union select repeat ('a',3*4096) AS a
        --error ER_NO_SUCH_TABLE
        select * from t;
        --echo #
        --echo # Prove an expected lonely `DROP table t'
        --source include/show_binlog_events.inc
       
        # error at stmt commit
        set statement binlog_format=statement for create table t (a int) select 1 as a;
        --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
        --let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
        --error ER_TRANS_CACHE_FULL
        --eval set statement binlog_format=row for create or replace table t (a text) engine=$engine select repeat ('a',4096*3) AS a;
        --error ER_NO_SUCH_TABLE
        select * from t;
        --echo #
        --echo # Prove an expected lonely `DROP table t'
        --source include/show_binlog_events.inc
       
      --dec $i
      }
       
      SET @@global.max_binlog_cache_size = @max_binlog_cache_size;
      SET @@global.    binlog_cache_size = @binlog_cache_size;
      
      

      Attachments

        Issue Links

          Activity

            Elkin Andrei Elkin created issue -
            Elkin Andrei Elkin made changes -
            Field Original Value New Value
            Affects Version/s 10.5 [ 23123 ]
            Elkin Andrei Elkin made changes -
            Fix Version/s 10.5 [ 23123 ]
            Elkin Andrei Elkin made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            Elkin Andrei Elkin added a comment -

            The fixes are in bb-10.6-MDEV-35207.

            Elkin Andrei Elkin added a comment - The fixes are in bb-10.6- MDEV-35207 .
            Elkin Andrei Elkin made changes -
            Assignee Andrei Elkin [ elkin ] Brandon Nesterenko [ JIRAUSER48702 ]
            Status In Progress [ 3 ] In Review [ 10002 ]

            Kristian reviewed, reassigning to Andrei.

            bnestere Brandon Nesterenko added a comment - Kristian reviewed, reassigning to Andrei.
            bnestere Brandon Nesterenko made changes -
            Assignee Brandon Nesterenko [ JIRAUSER48702 ] Andrei Elkin [ elkin ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            Elkin Andrei Elkin made changes -
            Description CREATE-or-REPLACE-SELECT additionally to MDEV-35207 had
            a "personal" issue to miss DROP TABLE logging into the binary log.
            How to reproduce is described in a while loop of the following mtr test (to be committed with this + MDEV-35207 fixes).


            {code:java}
            --source include/have_binlog_format_row.inc
            --source include/have_innodb.inc

            --connection default
            set @max_binlog_cache_size = @@global.max_binlog_cache_size;
            set @binlog_cache_size = @@global.binlog_cache_size;
            set @@global.max_binlog_cache_size = 4096;
            set @@global. binlog_cache_size = 4096;

            --echo #
            --echo # MDEV-35207
            --echo #
            # fixate the current (write) binlog position
            --let $binlog_file_0= query_get_value(SHOW MASTER STATUS, File, 1)
            --let $binlog_start_0 = query_get_value(SHOW MASTER STATUS, Position, 1)

            # use a separate connection also to validate its close will be clean
            connect (conn_err,localhost,root,,);

            call mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage");
            --error ER_TRANS_CACHE_FULL
            create table t engine=myisam select repeat ('a',4096*3) AS a;

            --error ER_TRANS_CACHE_FULL
            create table t engine=innodb select repeat ('a',4096*3) AS a;

            --error ER_DUP_ENTRY
            create table t (a int unique, b char) select 1 AS a, 'b' as b union select 1 as a, 'c' as b;
            --error ER_NO_SUCH_TABLE
            select * from t;

            --disconnect conn_err

            --connection default
            --let $binlog_file_1= query_get_value(SHOW MASTER STATUS, File, 1)
            --let $binlog_start_1= query_get_value(SHOW MASTER STATUS, Position, 1)

            --let $cmp = `select strcmp('$binlog_file_1', '$binlog_file_0') <> 0 OR $binlog_start_1 <> $binlog_start_0`
            if (!$cmp)
            {
               --echo *** Error: unexpected advance of binlog position
               --die
            }

            --echo
            --echo #
            --echo # TODO: MDEV-CoRS errored CoRS does not DROP table in binlog
            --echo #
            --let $i = 2
            while ($i)
            {
              --let $engine=`select if($i % 2, "myisam", "innodb")`
              --echo #
              --echo # Engine = $engine
              --echo #
              set statement binlog_format=statement for create table t (a int) select 1 as a;
              --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
              --let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
              --error ER_DUP_ENTRY
              --eval set statement binlog_format=row for create or replace table t (a int primary key, b char) engine=$engine select 1 AS a, 'b' as b union select 1 as a, 'c' as b
              --error ER_NO_SUCH_TABLE
              select * from t;
              --echo #
              --echo # Prove an expected lonely `DROP table t'
              --source include/show_binlog_events.inc

              # error before stmt commit
              set statement binlog_format=statement for create table t (a int) select 1 as a;
              --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
              --let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
              --error ER_TRANS_CACHE_FULL
              --eval set statement binlog_format=row for create or replace table t (a text) engine=$engine select repeat ('a',1024) AS a union select repeat ('a',3*4096) AS a union select repeat ('a',3*4096) AS a
              --error ER_NO_SUCH_TABLE
              select * from t;
              --echo #
              --echo # Prove an expected lonely `DROP table t'
              --source include/show_binlog_events.inc

              # error at stmt commit
              set statement binlog_format=statement for create table t (a int) select 1 as a;
              --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
              --let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
              --error ER_TRANS_CACHE_FULL
              --eval set statement binlog_format=row for create or replace table t (a text) engine=$engine select repeat ('a',4096*3) AS a;
              --error ER_NO_SUCH_TABLE
              select * from t;
              --echo #
              --echo # Prove an expected lonely `DROP table t'
              --source include/show_binlog_events.inc

            --dec $i
            }

            SET @@global.max_binlog_cache_size = @max_binlog_cache_size;
            SET @@global. binlog_cache_size = @binlog_cache_size;

            {code}
            CREATE-or-REPLACE-SELECT additionally to MDEV-35207 had
            a specific issue to missed DROP TABLE logging into the binary log.
            How to reproduce is described in a while loop of the following mtr test (to be committed with this + MDEV-35207 fixes).


            {code:java}
            --source include/have_binlog_format_row.inc
            --source include/have_innodb.inc

            --connection default
            set @max_binlog_cache_size = @@global.max_binlog_cache_size;
            set @binlog_cache_size = @@global.binlog_cache_size;
            set @@global.max_binlog_cache_size = 4096;
            set @@global. binlog_cache_size = 4096;

            --echo #
            --echo # MDEV-35207
            --echo #
            # fixate the current (write) binlog position
            --let $binlog_file_0= query_get_value(SHOW MASTER STATUS, File, 1)
            --let $binlog_start_0 = query_get_value(SHOW MASTER STATUS, Position, 1)

            # use a separate connection also to validate its close will be clean
            connect (conn_err,localhost,root,,);

            call mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage");
            --error ER_TRANS_CACHE_FULL
            create table t engine=myisam select repeat ('a',4096*3) AS a;

            --error ER_TRANS_CACHE_FULL
            create table t engine=innodb select repeat ('a',4096*3) AS a;

            --error ER_DUP_ENTRY
            create table t (a int unique, b char) select 1 AS a, 'b' as b union select 1 as a, 'c' as b;
            --error ER_NO_SUCH_TABLE
            select * from t;

            --disconnect conn_err

            --connection default
            --let $binlog_file_1= query_get_value(SHOW MASTER STATUS, File, 1)
            --let $binlog_start_1= query_get_value(SHOW MASTER STATUS, Position, 1)

            --let $cmp = `select strcmp('$binlog_file_1', '$binlog_file_0') <> 0 OR $binlog_start_1 <> $binlog_start_0`
            if (!$cmp)
            {
               --echo *** Error: unexpected advance of binlog position
               --die
            }

            --echo
            --echo #
            --echo # MDEV-CoRS errored CoRS does not DROP table in binlog
            --echo #
            --let $i = 2
            while ($i)
            {
              --let $engine=`select if($i % 2, "myisam", "innodb")`
              --echo #
              --echo # Engine = $engine
              --echo #
              set statement binlog_format=statement for create table t (a int) select 1 as a;
              --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
              --let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
              --error ER_DUP_ENTRY
              --eval set statement binlog_format=row for create or replace table t (a int primary key, b char) engine=$engine select 1 AS a, 'b' as b union select 1 as a, 'c' as b
              --error ER_NO_SUCH_TABLE
              select * from t;
              --echo #
              --echo # Prove an expected lonely `DROP table t'
              --source include/show_binlog_events.inc

              # error before stmt commit
              set statement binlog_format=statement for create table t (a int) select 1 as a;
              --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
              --let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
              --error ER_TRANS_CACHE_FULL
              --eval set statement binlog_format=row for create or replace table t (a text) engine=$engine select repeat ('a',1024) AS a union select repeat ('a',3*4096) AS a union select repeat ('a',3*4096) AS a
              --error ER_NO_SUCH_TABLE
              select * from t;
              --echo #
              --echo # Prove an expected lonely `DROP table t'
              --source include/show_binlog_events.inc

              # error at stmt commit
              set statement binlog_format=statement for create table t (a int) select 1 as a;
              --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
              --let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
              --error ER_TRANS_CACHE_FULL
              --eval set statement binlog_format=row for create or replace table t (a text) engine=$engine select repeat ('a',4096*3) AS a;
              --error ER_NO_SUCH_TABLE
              select * from t;
              --echo #
              --echo # Prove an expected lonely `DROP table t'
              --source include/show_binlog_events.inc

            --dec $i
            }

            SET @@global.max_binlog_cache_size = @max_binlog_cache_size;
            SET @@global. binlog_cache_size = @binlog_cache_size;

            {code}
            Elkin Andrei Elkin made changes -
            Summary Errorred-out CREATE-or-REPLACE-SELECT does not DROP table in binlog Errorred-out CREATE-or-REPLACE-SELECT does not log DROP table into binlog
            Elkin Andrei Elkin made changes -
            Elkin Andrei Elkin made changes -
            Status Stalled [ 10000 ] In Progress [ 3 ]
            Elkin Andrei Elkin added a comment -

            Fixed along with MDEV-35207 commit.

            Elkin Andrei Elkin added a comment - Fixed along with MDEV-35207 commit.
            Elkin Andrei Elkin made changes -
            Fix Version/s 10.11.12 [ 29998 ]
            Fix Version/s 11.2.7 [ 29955 ]
            Fix Version/s 11.4.6 [ 29999 ]
            Fix Version/s 11.8.2 [ 30001 ]
            Fix Version/s 10.5 [ 23123 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 11.2.7 [ 29955 ]

            People

              Elkin Andrei Elkin
              Elkin Andrei Elkin
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.