• Alfranio Correia's avatar
    BUG#47287 RBR: replication diff on basic case with txn- and non-txn tables in a statement · 14d19094
    Alfranio Correia authored
    Let
      - T be a transactional table and N non-transactional table.
      - B be begin, C commit and R rollback.
      - M be a mixed statement, i.e. a statement that updates both T and N.
      - M* be a mixed statement that fails while updating either T or N.
    
    This patch restore the behavior presented in 5.1.37 for rows either produced in
    the RBR or MIXED modes, when a M* statement that happened early in a transaction
    had their changes written to the binary log outside the boundaries of the
    transaction and wrapped in a BEGIN/ROLLBACK. This was done to keep the slave
    consistent with with the master as the rollback would keep the changes on N and
    undo them on T. In particular, we do what follows:
    
      . B M* T C would log - B M* R B T C.
    
    Note that, we are not preserving history from the master as we are introducing a
    rollback that never happened. However, this seems to be more acceptable than
    making the slave diverge. We do not fix the following case:
    
      . B T M* C would log B T M* C.
    
    The slave will diverge as the changes on T tables that originated from the M
    statement are rolled back on the master but not on the slave. Unfortunately, we
    cannot simply rollback the transaction as this would undo any uncommitted
    changes on T tables.
    
    SBR is not considered in this patch because a failing statement is written to
    the binary along with the error code and a slave executes and then rolls back
    the statement when it has an associated error code, thus undoing the effects
    on T. In RBR and MBR, a full-fledged fix will be pushed after the WL 2687.
    14d19094
binlog_mixed_failure_mixing_engines.test 143 Bytes