From: Alfranio Correia Date: August 27 2009 12:09am Subject: bzr commit into mysql-5.1 branch (alfranio.correia:3083) Bug#46864 List-Archive: http://lists.mysql.com/commits/81651 X-Bug: 46864 Message-Id: <0KP000GYNDS1IUD0@fe-emea-10.sun.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary_(ID_KFqcMi77U0Wzjxd5ZatbbQ)" --Boundary_(ID_KFqcMi77U0Wzjxd5ZatbbQ) MIME-version: 1.0 Content-type: text/plain; CHARSET=US-ASCII Content-transfer-encoding: 7BIT Content-disposition: inline #At file:///home/acorreia/workspace.sun/repository.mysql/bzrwork/bug-46864/mysql-5.1-bugteam/ based on revid:alfranio.correia@stripped 3083 Alfranio Correia 2009-08-27 BUG#46864 Incorrect update of InnoDB table on slave when using trigger with myisam table Slave does not correctly handle "expected errors" leading to inconsistencies between the mater and slave. Specifically, when a statement changes both transactional and non-transactional tables, the transactional changes are automatically rolled back on the master but the slave ignores the error and does not rollback them thus leading to inconsistencies. To fix the problem, we automatically rollback a statement that fails on the slave but note that the transaction is not rolled back unless a "rollback" command is in the relay log file. @ mysql-test/extra/rpl_tests/rpl_mixing_engines.test Enabled item 13.e which was disabled because of the bug fixed by the current and removed item 14 which was introduced by mistake. modified: mysql-test/extra/rpl_tests/rpl_mixing_engines.test mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result sql/log_event.cc === modified file 'mysql-test/extra/rpl_tests/rpl_mixing_engines.test' --- a/mysql-test/extra/rpl_tests/rpl_mixing_engines.test 2009-08-26 23:13:03 +0000 +++ b/mysql-test/extra/rpl_tests/rpl_mixing_engines.test 2009-08-27 00:09:31 +0000 @@ -562,21 +562,21 @@ let $binlog_start= query_get_value("SHOW --echo # There is a bug in the slave that needs to be fixed before enabling --echo # this part of the test. A bug report will be filed referencing this --echo # test case. -# -#BEGIN; -#INSERT INTO nt_3 VALUES ("new text -28", -28, ''); -#--error ER_DUP_ENTRY -#INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, ''); -#INSERT INTO tt_1 VALUES ("new text -27", -27, ''); -#COMMIT; -# -#BEGIN; -#INSERT INTO tt_4 VALUES ("new text -28", -28, ''); -#--error ER_DUP_ENTRY -#INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, ''); -#INSERT INTO tt_1 VALUES ("new text -28", -28, ''); -#COMMIT; -# + +BEGIN; +INSERT INTO nt_3 VALUES ("new text -28", -28, ''); +--error ER_DUP_ENTRY +INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, ''); +INSERT INTO tt_1 VALUES ("new text -27", -27, ''); +COMMIT; + +BEGIN; +INSERT INTO tt_4 VALUES ("new text -28", -28, ''); +--error ER_DUP_ENTRY +INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, ''); +INSERT INTO tt_1 VALUES ("new text -28", -28, ''); +COMMIT; + --source include/show_binlog_events.inc --echo @@ -683,23 +683,6 @@ ROLLBACK; --source include/show_binlog_events.inc ---echo ---echo ---echo ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); ---echo # ---echo #14) "B M T R" with error in M generates in the binlog the "B M T R" entries. ---echo # - -BEGIN; -INSERT INTO tt_4 VALUES ("new text -32", -32, ''); -TRUNCATE TABLE tt_4; -INSERT INTO tt_4 VALUES ("new text -33", -33, ''); -ROLLBACK; - ---source include/show_binlog_events.inc - connection master; sync_slave_with_master; === modified file 'mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result' --- a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result 2009-08-26 23:13:03 +0000 +++ b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result 2009-08-27 00:09:31 +0000 @@ -652,8 +652,30 @@ master-bin.000001 # Xid # # COMMIT /* XI # There is a bug in the slave that needs to be fixed before enabling # this part of the test. A bug report will be filed referencing this # test case. +BEGIN; +INSERT INTO nt_3 VALUES ("new text -28", -28, ''); +INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, ''); +ERROR 23000: Duplicate entry '-28' for key 'PRIMARY' +INSERT INTO tt_1 VALUES ("new text -27", -27, ''); +COMMIT; +BEGIN; +INSERT INTO tt_4 VALUES ("new text -28", -28, ''); +INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, ''); +ERROR 23000: Duplicate entry '-28' for key 'PRIMARY' +INSERT INTO tt_1 VALUES ("new text -28", -28, ''); +COMMIT; show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO nt_3 VALUES ("new text -28", -28, '') +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, '') +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -27", -27, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -28", -28, '') +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, '') +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -28", -28, '') +master-bin.000001 # Xid # # COMMIT /* XID */ @@ -832,29 +854,6 @@ master-bin.000001 # Query # # use `test` master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text -29", -29, ''), ("new text -30", -30, '') master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -31", -31, '') master-bin.000001 # Query # # ROLLBACK - - - - -# -#14) "B M T R" with error in M generates in the binlog the "B M T R" entries. -# -BEGIN; -INSERT INTO tt_4 VALUES ("new text -32", -32, ''); -TRUNCATE TABLE tt_4; -INSERT INTO tt_4 VALUES ("new text -33", -33, ''); -ROLLBACK; -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -32", -32, '') -master-bin.000001 # Xid # # COMMIT /* XID */ -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_4 -master-bin.000001 # Xid # # COMMIT /* XID */ -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -33", -33, '') -master-bin.000001 # Xid # # COMMIT /* XID */ ################################################################################### # CLEAN ################################################################################### === modified file 'sql/log_event.cc' --- a/sql/log_event.cc 2009-08-24 09:24:52 +0000 +++ b/sql/log_event.cc 2009-08-27 00:09:31 +0000 @@ -3202,6 +3202,15 @@ Default database: '%s'. Query: '%s'", DBUG_PRINT("info",("error ignored")); clear_all_errors(thd, const_cast(rli)); thd->killed= THD::NOT_KILLED; + /* + When an error is expected and matches the actual error the + slave does not report any error and by consequence changes + on transactional tables are not rolled back in the function + close_thread_tables(). For that reason, we explicitly roll + them back here. + */ + if (expected_error) + ha_autocommit_or_rollback(thd, TRUE); } /* If we expected a non-zero error code and get nothing and, it is a concurrency --Boundary_(ID_KFqcMi77U0Wzjxd5ZatbbQ) MIME-version: 1.0 Content-type: text/bzr-bundle; CHARSET=US-ASCII; name*0="bzr/alfranio.correia@stripped"; name*1=931-xz166ajxlues9hnh.bundle Content-transfer-encoding: 7BIT Content-disposition: inline; filename*0="bzr/alfranio.correia@stripped"; filename*1=931-xz166ajxlues9hnh.bundle # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: alfranio.correia@stripped\ # xz166ajxlues9hnh # target_branch: file:///home/acorreia/workspace.sun/repository.mysql\ # /bzrwork/bug-46864/mysql-5.1-bugteam/ # testament_sha1: 2826953dbb6f6f0ce4f2a194c29ffa4c22d2c9b6 # timestamp: 2009-08-27 01:09:36 +0100 # base_revision_id: alfranio.correia@stripped\ # rkikj1bn2cdrbu2c # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWaI5UW0ABQ7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