From: Date: December 17 2008 5:23pm Subject: bzr commit into mysql-5.1-bugteam branch (aelkin:2737) Bug#41183 List-Archive: http://lists.mysql.com/commits/61883 X-Bug: 41183 Message-Id: <200812171623.mBHGNQMQ015848@mysql1000.dsl.inet.fi> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit #At file:///home/andrei/MySQL/BZR/FIXES/5.1-bt-bug41183-circular_rpl_cluster/ based on revid:zhou.li@stripped 2737 Andrei Elkin 2008-12-17 Bug #41183 rpl_ndb_circular, rpl_ndb_circular_simplex need maintenance, crash The bug happened because filtering-out a STMT_END_F-flagged event so that COMMIT operations find traces of not-complete statement commit. Fixed with deploying an additional call cleanup_context() at executing of COMMIT event. The not-committed statement can happen only with NDB and that one can be only for the first query of the transaction. Moreover, in the case of filtering out per SERVER_ID all following group of events will be filtered-out without creating a statement to execute on the slave. Hence, the commit time clean-up can deal only with one non-committed statement to prove safety. modified: mysql-test/suite/rpl_ndb/t/disabled.def sql/log_event.cc per-file messages: mysql-test/suite/rpl_ndb/t/disabled.def re-enabling the tests to prove the bug is getting fixed. sql/log_event.cc Adding the statement cleanup to execute at the transaction commit time. The statement might not be ended with execution of STMT_END_F-flagged event because of the event was filtered out by SERVER_ID rules. === modified file 'mysql-test/suite/rpl_ndb/t/disabled.def' --- a/mysql-test/suite/rpl_ndb/t/disabled.def 2008-12-08 14:36:42 +0000 +++ b/mysql-test/suite/rpl_ndb/t/disabled.def 2008-12-17 16:23:16 +0000 @@ -10,7 +10,4 @@ # ############################################################################## -rpl_ndb_circular : Bug#41183 rpl_ndb_circular, rpl_ndb_circular_simplex need maintenance, crash -rpl_ndb_circular_simplex : Bug#41183 rpl_ndb_circular, rpl_ndb_circular_simplex need maintenance, crash - # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open === modified file 'sql/log_event.cc' --- a/sql/log_event.cc 2008-10-20 18:50:08 +0000 +++ b/sql/log_event.cc 2008-12-17 16:23:16 +0000 @@ -2893,7 +2893,19 @@ int Query_log_event::do_apply_event(Rela DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos)); clear_all_errors(thd, const_cast(rli)); - const_cast(rli)->clear_tables_to_lock(); + if (strcmp("COMMIT", query) == 0 && rli->tables_to_lock) + { + /* + Cleaning-up the last statement context: + the last statement was not completed. That can happen if + a previous STMT_END_F event got filtered out. + */ + const_cast(rli)->cleanup_context(thd, 0); + } + else + { + const_cast(rli)->clear_tables_to_lock(); + } /* Note: We do not need to execute reset_one_shot_variables() if this @@ -2905,6 +2917,7 @@ int Query_log_event::do_apply_event(Rela ::do_apply_event(), then the companion SET also have so we don't need to reset_one_shot_variables(). */ + if (rpl_filter->db_ok(thd->db)) { thd->set_time((time_t)when);