• Nirbhay Choubey's avatar
    Bug#12809202 61854: MYSQLDUMP --SINGLE-TRANSACTION · 5e487124
    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.
    
    
    client/mysqldump.c:
      Bug#12809202 61854: MYSQLDUMP --SINGLE-TRANSACTION
                   --FLUSH-LOG BREAKS CONSISTENCY
      
      Added logic to make sure that, if flush-log option
      is specified, mysql_refresh() is never executed after
      the transaction has started.
      
      Added verbose messages for all the executions of
      mysql_refresh() in order to track its invocation.
    mysql-test/r/mysqldump.result:
      Added test case for Bug#12809202.
    mysql-test/t/mysqldump.test:
      Added test case for Bug#12809202.
    5e487124
mysqldump.result 201 KB