• guilhem@mysql.com's avatar
    2 minor edits, plus · 759a3c1e
    guilhem@mysql.com authored
    fix for BUG#1113 "INSERT into non-trans table SELECT ; ROLLBACK" does not send warning"
    and
    fix for BUG#873 "In transaction, INSERT to non-trans table is written too early to binlog".
    Now we don't always write the non-trans update immediately to the binlog;
    if there is something in the binlog cache we write it to the binlog cache
    (because the non-trans update could depend on a trans table which was modified
    earlier in the transaction); then in case of ROLLBACK, we write the binlog
    cache to the binlog, wrapped with BEGIN/ROLLBACK.
    This guarantees that the slave does the same updates.
    For ROLLBACK TO SAVEPOINT: when we execute a SAVEPOINT command we write it
    to the binlog cache. At ROLLBACK TO SAVEPOINT, if some non-trans table was updated,
    we write ROLLBACK TO SAVEPOINT to the binlog cache; when the transaction
    terminates (COMMIT/ROLLBACK), the binlog cache will be flushed to the binlog
    (because of the non-trans update) so we'll have SAVEPOINT and ROLLBACK TO
    SAVEPOINT in the binlog.
    
    Apart from this rare case of updates of mixed table types in transaction, the
    usual way is still clear the binlog cache at ROLLBACK, or chop it at
    ROLLBACK TO SAVEPOINT (meaning the SAVEPOINT command is also chopped, which
    is fine).
    Note that BUG#873 encompasses subbugs 1) and 2) of BUG#333 "3 binlogging bugs when doing INSERT with mixed InnoDB/MyISAM".
    759a3c1e
mix_innodb_myisam_binlog.test 3.57 KB