Skip to content
  • Venkatesh Duggirala's avatar
    112899f4
    BUG#19286708 REPLICATION BROKEN AFTER CREATION OF SCHEDULED EVENTS · 112899f4
    Venkatesh Duggirala authored
    Problem: In mixed replication, events that has unsafe functions
    (sysdate()) cannot be created.
    
    Analysis: DDL Statements (that change metadata) are always
    getting written in the binlog in STATEMENT format irrespective
    of binlog_format settings. And the changes to the metadata
    should not be replicated as the same statement when it is executed
    on Slave will update the metadata on slave side. Event based SQL
    commands (CREATE EVENT, ALTER EVENT and DROP EVENT) belong to
    the same category. Code was written to take care of changing the
    current_statement_binlog_format into 'statement' if it is 'row'
    in case of executing/replicating such statements. But in case of
    create event and alter event, after we are converting row format
    to statement format, while we are opening the tables server decides
    the binlogging format (in decide_binlog_format()) and the logic
    again changes binlog format to "row" if it sees the statement is
    unsafe and we are using mixed format.
    
    Fix: Reset the thd.variables.binlog_format to 'statement' before create/alter
    events work when we are clearning current_statement_binlog_format.
    And set it back to the original value at the end of the work.
    112899f4
    BUG#19286708 REPLICATION BROKEN AFTER CREATION OF SCHEDULED EVENTS
    Venkatesh Duggirala authored
    Problem: In mixed replication, events that has unsafe functions
    (sysdate()) cannot be created.
    
    Analysis: DDL Statements (that change metadata) are always
    getting written in the binlog in STATEMENT format irrespective
    of binlog_format settings. And the changes to the metadata
    should not be replicated as the same statement when it is executed
    on Slave will update the metadata on slave side. Event based SQL
    commands (CREATE EVENT, ALTER EVENT and DROP EVENT) belong to
    the same category. Code was written to take care of changing the
    current_statement_binlog_format into 'statement' if it is 'row'
    in case of executing/replicating such statements. But in case of
    create event and alter event, after we are converting row format
    to statement format, while we are opening the tables server decides
    the binlogging format (in decide_binlog_format()) and the logic
    again changes binlog format to "row" if it sees the statement is
    unsafe and we are using mixed format.
    
    Fix: Reset the thd.variables.binlog_format to 'statement' before create/alter
    events work when we are clearning current_statement_binlog_format.
    And set it back to the original value at the end of the work.
Loading