From: Bjorn Munch Date: May 13 2011 9:22am Subject: bzr push into mysql-trunk branch (bjorn.munch:3079 to 3080) List-Archive: http://lists.mysql.com/commits/137298 Message-Id: <201105130922.p4D9MkXf019903@khepri15.norway.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3080 Bjorn Munch 2011-05-13 fix Tree name after accidental push modified: .bzr-mysql/default.conf 3079 Alfranio Correia 2011-05-12 [merge] BUG#11763471 BUG#56184 Rolled back transaction without non-transactional table updated was binlogged BUG#11763126 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 the transaction. Example: BEGIN INSERT INTO trans-table; INSERT INTO non-trans-table; ROLLBACK This 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 diverge. After this patch, SQL thread will not retry to execute a transaction which cannot be rolled back safely if temporary error is encountered. ADDITIONAL CHANGES ------------------ Some refactoring related to THD_TRANS::modified_non_trans_table and binlog_cache_data was also done. @ mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc Improved the test case to cover the following cases: . beging (drop/create temporary table) (failed statement on T, N) commit/rollback @ mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test Improved the test case to cover the following cases: . beging (drop/create temporary table) (failed statement on T, N) commit/rollback @ mysql-test/suite/rpl/r/rpl_DML_error.result Fixed typo. @ mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result Improved the test case to cover the following cases: . beging (drop/create temporary table) (failed statement on T, N) commit/rollback @ mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result Improved the test case to cover the following cases: . beging (drop/create temporary table) (failed statement on T, N) commit/rollback @ mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result Improved the test case to cover the following cases: . beging (drop/create temporary table) (failed statement on T, N) commit/rollback @ sql/binlog.cc Fixed error in the binary log. @ sql/ha_ndbcluster.cc Wrote a comment because we are not able to evaluate if all.mark_modified_non_trans_table is really necessary. @ sql/handler.h Moved both Ha_trx_info and THD_TRANS to sql_class.h. @ sql/sql_class.h Moved both Ha_trx_info and THD_TRANS to sql_class.h and and changed modified_non_trans_table to mark_modified_non_trans_table. @ sql/sql_table.cc Fixed the error while dropping temporary tables with IF EXISTS. 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_drop_create_temp_table.test 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_reporting.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 === modified file '.bzr-mysql/default.conf' --- a/.bzr-mysql/default.conf 2011-05-12 13:49:50 +0000 +++ b/.bzr-mysql/default.conf 2011-05-13 09:22:01 +0000 @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@stripped" post_push_to = "commits@stripped" -tree_name = "mysql-trunk-mtr" +tree_name = "mysql-trunk" No bundle (reason: useless for push emails).