• unknown's avatar
    Bug #51839 mixup of DDL causes slave to stop · 164ff447
    unknown authored
    Stored routine DDL statements use statement-based replication
    regardless of the current binlog format. The problem here was
    that if a DDL statement failed during metadata lock acquisition
    or opening of mysql.proc, the binlog format would not be reset
    before returning. So the following DDL or DML statements are 
    binlogged with a wrong binlog format, which causes the slave 
    to stop.
    
    The problem can be resolved by grabbing an exclusive MDL lock firstly
    instead of clearing the current binlog format. So that the binlog
    format will not be affected when the lock grab returns directly with
    an error. The same way is taken to open a proc table for update.
    
    
    mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result:
      Test Result for bug#51839
    mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test:
      Added test to make sure the binlog format is not changed
      after a execution of DDL with a table locked.
    sql/sp.cc:
      Grab an exclusive MDL lock and open a proc table for update firstly
      instead of clearing the current binlog format.
    164ff447
sp.cc 63.5 KB