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

Auto-generated DELETE from HEAP table can break replication

    XMLWordPrintable

    Details

      Description

      After server restart, a DELETE query is written into the binary log for every HEAP table to reflect the restart emptying them. It is written unconditionally, regardless whether it's actually executable or not. If it is not, it causes replication abort.

      In the example test case below DELETE causes an error because the table has a DELETE trigger which refers to a non-existing table.

      --source include/master-slave.inc
       
      reset master;
       
      create table t (a int) engine=MEMORY;
      create trigger tr after delete on t for each row update t2 set a = 1;
      insert into t values (1);
       
      --let $rpl_server_number= 1
      --source include/rpl_restart_server.inc
       
      check table t;
       
      --sync_slave_with_master
       
      # Cleanup
      --connection master
      drop table t;
      --source include/rpl_end.inc
      

      10.2 e788738e

      master-bin.000002	4	Format_desc	1	256	Server ver: 10.2.38-MariaDB-debug-log, Binlog ver: 4
      master-bin.000002	256	Gtid_list	1	299	[0-1-3]
      master-bin.000002	299	Binlog_checkpoint	1	343	master-bin.000002
      master-bin.000002	343	Gtid	1	385	GTID 0-1-4
      master-bin.000002	385	Query	1	474	DELETE FROM `test`.`t`
      

      Last_Errno	1146
      Last_Error	Error 'Table 'test.t2' doesn't exist' on query. Default database: 'test'. Query: 'DELETE FROM `test`.`t`'
      

        Attachments

          Activity

            People

            Assignee:
            Elkin Andrei Elkin
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated: