• Marko Mäkelä's avatar
    MDEV-14477 InnoDB update_time is wrongly updated after partial rollback or internal COMMIT · d8ada081
    Marko Mäkelä authored
    The non-persistent UPDATE_TIME for InnoDB tables was not being
    updated consistently at transaction commit.
    
    If a transaction is partly rolled back so that in the end it will
    not modify a table that it intended to modify, the update_time will
    be updated nevertheless. This will also happen when InnoDB fails
    to write an undo log record for the intended modification.
    
    If a transaction is committed internally in InnoDB, instead of
    being committed from the SQL interface, then the trx_t::mod_tables
    will not be applied to the update_time of the tables.
    
    trx_t::mod_tables: Replace the std::set<dict_table_t*>
    with std::map<dict_table_t*,undo_no_t>, so that the very first
    modification within the transaction is identified.
    
    trx_undo_report_row_operation(): Update mod_tables for every operation
    after the undo log record was successfully written.
    
    trx_rollback_to_savepoint_low(): After partial rollback, erase from
    trx_t::mod_tables any tables for which all changes were rolled back.
    
    trx_commit_in_memory(): Tighten some assertions and simplify conditions.
    Invoke trx_update_mod_tables_timestamp() if persistent tables were
    affected.
    
    trx_commit_for_mysql(): Remove the call to
    trx_update_mod_tables_timestamp(), as it is now invoked at the
    lower level, in trx_commit_in_memory().
    
    trx_rollback_finish(): Clear mod_tables before invoking trx_commit(),
    because the trx_commit_in_memory() would otherwise wrongly process
    mod_tables after a full ROLLBACK.
    d8ada081
ha_innodb.cc 626 KB