List:Commits« Previous MessageNext Message »
From:Li-Bing.Song Date:December 29 2010 8:24am
Subject:bzr commit into mysql-trunk-bugfixing branch (Li-Bing.Song:3426) Bug#55798
Bug#56184
View as plain text  
#At file:///home/anders/Work/bzrwork/wt3/mysql-trunk-bugfixing/ based on revid:ramil@stripped

 3426 Li-Bing.Song@stripped	2010-12-29
      Bug#56184 Rolled back transaction without non-trasactional table updated was binlogged
      Bug#55798 Slave SQL retry on transaction inserts extra data into non-transaction table
      
      Bug#56184
      The transaction modified non-transactional table will be binlogged with ROLLBACK if it
      rolls back on master. It includes the case that all statements which modified
      non-transactional table are binlogged outside(before) the transaction. 
      Example:
        BEGIN
        INSERT INTO trans-table;
        INSERT INOT non-trans-table;
        ROLLBACK
      it will be binlogged as:
        BEGIN
        INSERT INTO non-trans-table;
        COMMIT
        BEGIN
        INSERT INTO trans-table;
        ROLLBACK;
      All statements in the second binlogged transaction modify only transactional tables and
      are rolled back safely on master. So the second transaction should not be binlogged.
      
      After 5.5, there are two caches for binary logs, a transactional cache 
      and a statement cache. When executing a transaction, statements that 
      modified only transactional tables are always put in transactional 
      cache. Statements that modified non-transactional tables can be put in 
      either transactional or non-transactional cache depending on different 
      situations. In this patch, a flag is added to mark if there is any 
      statement that modified non-transactional table in transactional cache. 
      When rolling back a transaction on master, transactional cache should 
      not be flushed to binary log, if there is no statement in it that 
      modified a non-transactional table. Otherwise, it should be flushed into 
      binary log followed by 'ROLLBACK' statement.
      
      BUG#55798
      When a temporary error(eg. Lock timeout) happens, Slave SQL thread will rollback the
      transaction and retry it again. But it is possible that the transaction cannot be
      rolled back safely. For example a non-transactional table has been modified by the
      transaction. It will make master and slave diversely.
      
      After this patch, SQL thread will not retry to execute a transaction which can not be rolled
      back safely if temporary error is encountered.
      ******
      Post patch for BUG#56184
      ******
      BUG#56184 Rolled back transaction without non-trasactional table updated was binlogged
      Post patch.
      Removed all.modified_non_trans_table() from sql_update.cc and sql_insert.cc
      Corrected some comments.
      Refactoring binlog_cache_data and binlog_trx_cache_data. Moved functions supported
      only by transactional cache from binlog_cache_data to binlog_trx_cache_data.
      Modified test result file effected by the patch for this bug.
     @ mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
        Updated test affected by this patch.
        Masked the new error's error number for easier merging.
     @ mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc
        Updated test affected by this patch.
        Masked the new error's error number for easier merging.
     @ mysql-test/extra/rpl_tests/rpl_innodb.test
        Updated test affected by this patch.
        Masked the new error's error number for easier merging.
     @ mysql-test/extra/rpl_tests/rpl_mixing_engines.inc
        Updated test affected by this patch.
        Masked the new error's error number for easier merging.
     @ mysql-test/extra/rpl_tests/rpl_temp_error.test
        An auxaliary file for causing temporary error on slave SQL thread
     @ mysql-test/r/read_only_innodb.result
        Updated test result affected by this patch.
     @ mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
        Updated test result affected by this patch.
     @ mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
        Updated test result affected by this patch.
     @ mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result
        Updated test result affected by this patch.
     @ mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result
        Updated test result affected by this patch.
     @ mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result
        Updated test result affected by this patch.
     @ mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result
        Updated test result affected by this patch.
     @ mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result
        Updated test result affected by this patch.
     @ mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result
        Updated test result affected by this patch.
     @ mysql-test/suite/rpl/r/rpl_row_mixing_engines.result
        Updated test result affected by this patch.
     @ mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result
        Updated test result affected by this patch.
     @ mysql-test/suite/rpl/r/rpl_stm_innodb.result
        Updated test result affected by this patch.
     @ mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
        Updated test result affected by this patch.
     @ mysql-test/suite/rpl/t/rpl_DML_error.test
        Added test to verify this patch.
     @ mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test
        Add test to verify this patch.
     @ sql/binlog.cc
        Refactor reset_cache, it is divided into reset_trx_cache() and reset_stmt_cache().
        Added new class binlog_trx_cache_data, moved m_trx_cache_cannot_rollback to binlog_trx_cache_data.
        Add code to fix this bug.
     @ sql/binlog.h
        Removed trans_has_updated_non_trans_table() and stmt_has_updated_non_trans_table().
        Added stmt_cannot_safe_rollback();
        See also handler.h.
     @ sql/ha_ndbcluster.cc
        Refactoring modified_non_trans_table.
     @ sql/ha_ndbcluster_binlog.cc
        Refactoring modified_non_trans_table.
     @ sql/handler.cc
        Refactoring modified_non_trans_table.
        Call push_unsafe_rollback_warnings() to print detail unsafe rollback warnings.
     @ sql/handler.h
        Use unsafe_rollback_flags to replace modified_non_trans_table.
        At present, not only change of non-transactional table but also
        creation and drop of temporary table cannot be rolled back.
        So unsafe_rollback_flags is a suitable name to express the meaning
        and can store more detail information, as it was defined as a set of
        flags.
     @ sql/log_event.cc
        Refactoring modified_non_trans_table.
     @ sql/rpl_slave.cc
        OPTION_KEEP_LOG is replaced by stmt.cannot_safe_rollback().
        Remove OPTION_KEEP_LOG from all code.
     @ sql/share/errmsg-utf8.txt
        Added two warnings.
     @ sql/sp_head.cc
        Refactoring modified_non_trans_table.
     @ sql/sql_class.cc
        Refactoring modified_non_trans_table.
     @ sql/sql_class.h
        Refactoring modified_non_trans_table.
        Added THD::st_transactions::push_unsafe_rollback_warnings
        to print detail unsafe rollback information.
     @ sql/sql_delete.cc
        Refactoring modified_non_trans_table.
        Removed the code to set thd->transaction.all.modified_non_trans_table,
        it will be set in trans_commit_stmt and trans_rollback_stmt.
     @ sql/sql_insert.cc
        Refactoring modified_non_trans_table.
        Removed the code to set thd->transaction.all.modified_non_trans_table,
        it will be set in trans_commit_stmt and trans_rollback_stmt.
     @ sql/sql_lex.h
        Removed stmt_accessed_non_trans_temp_table();
        It is useless after this patch.
     @ sql/sql_load.cc
        Refactoring modified_non_trans_table.
        Removed the code to set thd->transaction.all.modified_non_trans_table,
        it will be set in trans_commit_stmt and trans_rollback_stmt.
     @ sql/sql_parse.cc
        OPTION_KEEP_LOG is replaced by stmt.cannot_safe_rollback().
        Remove OPTION_KEEP_LOG from all code.
     @ sql/sql_priv.h
        Removed OPTION_KEEP_LOG.
     @ sql/sql_table.cc
        Call stmt.created_temp_table() after a temporary table has been created.
        Call stmt.dropped_temp_table() after a temporary table has been dropped.
     @ sql/sql_truncate.cc
        Refactoring modified_non_trans_table.
     @ sql/sql_update.cc
        Refactoring modified_non_trans_table.
        Removed the code to set thd->transaction.all.modified_non_trans_table,
        it will be set in trans_commit_stmt and trans_rollback_stmt.
     @ sql/sys_vars.cc
        OPTION_KEEP_LOG is replaced by stmt.unsafe_rollback_flags.
        Remove OPTION_KEEP_LOG from all code.
     @ sql/transaction.cc
        OPTION_KEEP_LOG is replaced by stmt.unsafe_rollback_flags.
        Remove OPTION_KEEP_LOG from all code.
        Added code in trans_commit_stmt and trans_rollback_stmt to
        merge statement's unsafe_rollback_flags into
        transactional unsafe_rollback_flags.

    added:
      mysql-test/extra/rpl_tests/rpl_temp_error.test
      mysql-test/suite/rpl/r/rpl_DML_error.result
      mysql-test/suite/rpl/t/rpl_DML_error.test
    modified:
      mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
      mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc
      mysql-test/extra/rpl_tests/rpl_innodb.test
      mysql-test/extra/rpl_tests/rpl_mixing_engines.inc
      mysql-test/r/read_only_innodb.result
      mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
      mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
      mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result
      mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result
      mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result
      mysql-test/suite/rpl/r/rpl_row_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result
      mysql-test/suite/rpl/r/rpl_stm_innodb.result
      mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
      mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test
      sql/binlog.cc
      sql/binlog.h
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster_binlog.cc
      sql/handler.cc
      sql/handler.h
      sql/log_event.cc
      sql/rpl_slave.cc
      sql/share/errmsg-utf8.txt
      sql/sp_head.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_delete.cc
      sql/sql_insert.cc
      sql/sql_lex.h
      sql/sql_load.cc
      sql/sql_parse.cc
      sql/sql_priv.h
      sql/sql_table.cc
      sql/sql_truncate.cc
      sql/sql_update.cc
      sql/sys_vars.cc
      sql/transaction.cc

Diff too large for email (10331 lines, the limit is 10000).
No bundle (reason: no diff => no bundle).
Thread
bzr commit into mysql-trunk-bugfixing branch (Li-Bing.Song:3426) Bug#55798Bug#56184Li-Bing.Song29 Dec