• Nirbhay Choubey's avatar
    Bug#12809202 61854: MYSQLDUMP --SINGLE-TRANSACTION · a4343d56
    Nirbhay Choubey authored
                 --FLUSH-LOG BREAKS CONSISTENCY
    
    The transaction started by mysqldump gets committed
    implicitly when flush-log is specified along with
    single-transaction option, and hence can break
    consistency.
    
    This is because, COM_REFRESH is executed in order
    to flush logs and starting from 5.5 this command
    performs an implicit commit.
    
    Fixed by making sure that COM_REFRESH is executed
    before the transaction has started and not after it.
    
    Note : This patch triggers following behavioral
           changes in mysqldump :
    
    1) After this patch we no longer flush logs before
       dumping each database if --single-transaction
       option is given like it was done before (in the
       absence of --lock-all-tables and --master-data
       options).
    
    2) Also, after this patch, we start acquiring
       FTWRL before flushing logs in cases when only
       --single-transaction and --flush-logs are given.
       It becomes safe to use mysqldump with these two
       options and without --master-data parameter for
       backups.
    a4343d56
mysqldump.c 163 KB