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

S3 storage engine: delayed slave can drop the table

    XMLWordPrintable

    Details

      Description

      The s3_slave_ignore_updates option is supposed to allow running a master-slave setup where both master and slave are pointed at the same S3 storage. Yet, in some scenarios, slave will drop the table, destroying the data that the master has put there.

      Put this into suite/s3/rpl_a.cnf:

      !include ../rpl/my.cnf
      !include ./my.cnf
      !include ./slave.cnf
       
      [mysqld.2]
      s3_slave_ignore_updates=1
       
      [mysqld.1]
      s3_replicate_alter_as_create_select=1
      

      Put this into suite/s3/rpl_a.test:

      --source include/have_s3.inc
      --source include/have_innodb.inc
       
      --source include/have_binlog_format_mixed.inc
      --source include/master-slave.inc
      
      

      --disable_warnings
      drop table if exists ten, t100, t101;
      --enable_warnings
       
      create table ten(a int primary key);
      insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
       
      connection slave;
      stop slave;
      connection master;
      

       
      #
      # Create version 1 of the table
      #
      create /*or replace*/ table t100 (
        pk varchar(100)
      ) engine = 'innodb';
       
      insert into t100 values ('old data');
      alter table t100 engine=s3;
      
      

      #
      # Create version 2 of the table
      #
      drop table t100;
      create /*or replace*/ table t100 (
        pk varchar(100)
      ) engine= innodb;
      insert into t100 select 'new data' from ten;
      alter table t100 engine=s3;
       
      select *, 'before slave start' from t100;
      
      

      #
      #  Now, start the slave
      #
      connection slave;
      start slave;
      connection master;
       
      --sync_slave_with_master
      connection master;
       
      flush tables;
      select *, 'after slave start' from t100;
       
      --sync_slave_with_master
       
      # This will fail with an error:
      # mysqltest: At line 49: query 'select *, 'after slave start' from 
      # t100' failed: 1146: Table 'test.t100' doesn't exist
      select * from t100;
      

        Attachments

          Activity

            People

            Assignee:
            monty Michael Widenius
            Reporter:
            psergei Sergei Petrunia
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration