• Monty's avatar
    MDEV-22925 ALTER TABLE s3_table ENGINE=Aria can cause failure on slave · 60f08dd5
    Monty authored
    When converting a table (test.s3_table) from S3 to another engine, the
    following will be logged to the binary log:
    
    DROP TABLE IF EXISTS test.t1;
    CREATE OR REPLACE TABLE test.t1 (...) ENGINE=new_engine
    INSERT rows to test.t1 in binary-row-log-format
    
    The bug is that the above statements are logged one by one to the binary
    log. This means that a fast slave, configured to use the same S3 storage
    as the master, would be able to execute the DROP and CREATE from the
    binary log before the master has finished the ALTER TABLE.
    In this case the slave would ignore the DROP (as it's on a S3 table) but
    it will stop on CREATE of the local tale, as the table is still exists in
    S3. The REPLACE part will be ignored by the slave as it can't touch the
    S3 table.
    
    The fix is to ensure that all the above statements is written to binary
    log AFTER the table has been deleted from S3.
    60f08dd5
log.cc 330 KB