From: Date: June 10 2008 4:14pm Subject: bzr push into mysql-6.0-falcon:mysql-6.0-falcon branch (mats:2687 to 2697) Bug#36745, Bug#37221 List-Archive: http://lists.mysql.com/commits/47688 X-Bug: 37221 Message-Id: <20080610141439.4AA6B5BE04@mats-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 2697 Mats Kindahl 2008-06-10 [merge] Merging. modified: storage/falcon/Gopher.cpp storage/falcon/SRLDropTableSpace.cpp storage/falcon/SerialLog.h storage/falcon/SerialLogTransaction.cpp storage/falcon/SerialLogTransaction.h storage/falcon/TableSpaceManager.cpp storage/falcon/TableSpaceManager.h 2696 Mats Kindahl 2008-06-10 BUG#37221: SET AUTOCOMMIT=1 does not commit binary log Adding comment to Falcon regression test for the bug. modified: mysql-test/suite/falcon/t/rpl_falcon_bug_37221.test 2695 Mats Kindahl 2008-06-09 Bug #37221: SET AUTOCOMMIT=1 does not commit binary log When setting AUTOCOMMIT=1 after starting a transaction, the binary log did not commit the outstanding transaction. The reason was that the binary log commit function saw the values of the new settings, deciding that there were nothing to commit. Fixed the problem by moving the implicit commit to before the thread option flags were changed, so that the binary log sees the old values of the flags instead of the values they will take after the statement. added: mysql-test/extra/binlog_tests/implicit.test mysql-test/suite/binlog/r/binlog_implicit_commit.result mysql-test/suite/binlog/t/binlog_implicit_commit.test mysql-test/suite/falcon/r/rpl_falcon_bug_37221.result mysql-test/suite/falcon/t/rpl_falcon_bug_37221.test modified: sql/set_var.cc 2694 Olav Sandstaa 2008-06-08 Fix to the second of the memory alignment issues in Bug#36745 falcon crash on solaris The problem that caused crashes on SPARC running in 64 bit mode was due a memory aligment issue when "nodes" were allocated in the DeferredIndex::initialSpace. Memory is allocated in the initialSpace starting from the end of the memory area. Since the end of the initialSpace was not aligned on an address boundary this resulted in that memory allocated from it was not aligned and thus crashed on Solaris when running in 64 bit mot on SPARC. Fixed this by ensuring that the size of the initialSpace is "8 byte memory aligned" (increased the size of it from 500 bytes to 512 bytes). modified: storage/falcon/DeferredIndex.h 2693 Olav Sandstaa 2008-06-07 [merge] Committing the result of last merge into local repository. Should this really be necessary? added: storage/falcon/SectorBuffer.cpp storage/falcon/SectorBuffer.h storage/falcon/SectorCache.cpp storage/falcon/SectorCache.h modified: .bzr-mysql/default.conf storage/falcon/Backup.cpp storage/falcon/CMakeLists.txt storage/falcon/Cache.cpp storage/falcon/Cache.h storage/falcon/Makefile.am 2692 Olav Sandstaa 2008-06-06 Fix to one of the memory alignment issues in Bug#36745 falcon crash on solaris The problem was a memory alignment issue in SymbolManager.cpp that caused a crash when running in 64 bit mode on Solaris on SPARC. Fixed this by ensuring the symbol objects are allocated at 8 byte boundaries when compiling for 64 bit systems. modified: storage/falcon/SymbolManager.cpp 2691 Jim Starkey 2008-06-03 Continue to phase out SectionPage::isFull in favor of a bit flag. modified: storage/falcon/Section.cpp 2690 Jim Starkey 2008-06-03 Revert to more stable version -- recovering from bk to bzr cutover problems. modified: storage/falcon/PageInventoryPage.cpp storage/falcon/SectionPage.h 2689 Jim Starkey 2008-06-03 Reflect change from SectionPage::flags to SectionPage::isFull (which I'm not at all sure was wise!). modified: storage/falcon/PageInventoryPage.cpp 2688 Jim Starkey 2008-06-03 Picked up update to SectionPage.h to sync with SectionPage.cpp. 2687 Jim Starkey 2008-06-03 Picked up update to SectionPage.h to sync with SectionPage.cpp. === added file 'mysql-test/extra/binlog_tests/implicit.test' --- a/mysql-test/extra/binlog_tests/implicit.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/extra/binlog_tests/implicit.test 2008-06-09 19:32:42 +0000 @@ -0,0 +1,28 @@ +# First part: outside a transaction +RESET MASTER; +eval $prepare; + +INSERT INTO t1 VALUES (1); +source include/show_binlog_events.inc; +eval $statement; +source include/show_binlog_events.inc; +if (`select '$cleanup' != ''`) { + eval $cleanup; +} + +# Second part: inside a transaction +RESET MASTER; +eval $prepare; +BEGIN; +INSERT INTO t1 VALUES (2); +source include/show_binlog_events.inc; +eval $statement; +source include/show_binlog_events.inc; +INSERT INTO t1 VALUES (3); +source include/show_binlog_events.inc; +COMMIT; +source include/show_binlog_events.inc; +if (`select '$cleanup' != ''`) { + eval $cleanup; +} + === added file 'mysql-test/suite/binlog/r/binlog_implicit_commit.result' --- a/mysql-test/suite/binlog/r/binlog_implicit_commit.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/binlog/r/binlog_implicit_commit.result 2008-06-09 19:32:42 +0000 @@ -0,0 +1,345 @@ +CREATE TABLE t1 (id INT) ENGINE = InnoDB; +SET BINLOG_FORMAT = STATEMENT; +RESET MASTER; +SET AUTOCOMMIT = 0; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 0; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Xid # # COMMIT /* XID */ +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 0; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 0; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +SET BINLOG_FORMAT = ROW; +RESET MASTER; +SET AUTOCOMMIT = 0; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 0; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 0; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 0; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 0; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +LOCK TABLES t1 WRITE; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +UNLOCK TABLES; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +DROP TABLE t1; === added file 'mysql-test/suite/binlog/t/binlog_implicit_commit.test' --- a/mysql-test/suite/binlog/t/binlog_implicit_commit.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/binlog/t/binlog_implicit_commit.test 2008-06-09 19:32:42 +0000 @@ -0,0 +1,63 @@ +# The purpose of this test is to test that setting autocommit does a +# commit of outstanding transactions and nothing is left pending in +# the transaction cache. + +source include/have_log_bin.inc; +source include/have_innodb.inc; + +# We need a transactional engine, so let's use InnoDB +CREATE TABLE t1 (id INT) ENGINE = InnoDB; + +# Testing SET AUTOCOMMIT +SET BINLOG_FORMAT = STATEMENT; + +let $cleanup = COMMIT; + +let $prepare = SET AUTOCOMMIT = 0; +let $statement = SET AUTOCOMMIT = 1; +source extra/binlog_tests/implicit.test; + +let $prepare = SET AUTOCOMMIT = 1; +let $statement = SET AUTOCOMMIT = 1; +source extra/binlog_tests/implicit.test; + +let $prepare = SET AUTOCOMMIT = 0; +let $statement = SET AUTOCOMMIT = 0; +source extra/binlog_tests/implicit.test; + +let $prepare = SET AUTOCOMMIT = 1; +let $statement = SET AUTOCOMMIT = 0; +source extra/binlog_tests/implicit.test; + +SET BINLOG_FORMAT = ROW; +let $prepare = SET AUTOCOMMIT = 0; +let $statement = SET AUTOCOMMIT = 1; +source extra/binlog_tests/implicit.test; + +let $prepare = SET AUTOCOMMIT = 1; +let $statement = SET AUTOCOMMIT = 1; +source extra/binlog_tests/implicit.test; + +let $prepare = SET AUTOCOMMIT = 0; +let $statement = SET AUTOCOMMIT = 0; +source extra/binlog_tests/implicit.test; + +let $prepare = SET AUTOCOMMIT = 1; +let $statement = SET AUTOCOMMIT = 0; +source extra/binlog_tests/implicit.test; + +RESET MASTER; +SET AUTOCOMMIT = 0; +INSERT INTO t1 VALUES (1); +source include/show_binlog_events.inc; +LOCK TABLES t1 WRITE; +source include/show_binlog_events.inc; +INSERT INTO t1 VALUES (2); +source include/show_binlog_events.inc; +UNLOCK TABLES; +source include/show_binlog_events.inc; +COMMIT; +source include/show_binlog_events.inc; + +# Cleaning up +DROP TABLE t1; === added file 'mysql-test/suite/falcon/r/rpl_falcon_bug_37221.result' --- a/mysql-test/suite/falcon/r/rpl_falcon_bug_37221.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/falcon/r/rpl_falcon_bug_37221.result 2008-06-09 19:32:42 +0000 @@ -0,0 +1,38 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +[master] +SET BINLOG_FORMAT = 'ROW'; +CREATE TABLE IF NOT EXISTS t1 (id INT) ENGINE = Falcon; +SET AUTOCOMMIT=0; +INSERT INTO t1 VALUES (1); +SET AUTOCOMMIT=1; +SELECT * FROM t1; +id +1 +[slave] +SELECT * FROM t1; +id +1 +[master] +BEGIN; +INSERT INTO t1 VALUES (2); +SET AUTOCOMMIT=1; +[slave] +SELECT * FROM t1 /* Should not contain 2 */; +id +1 +[master] +INSERT INTO t1 VALUES (3); +COMMIT; +[slave] +SELECT * FROM t1 /* Should contain 2 and 3 */; +id +1 +2 +3 +[master] +DROP TABLE t1; === added file 'mysql-test/suite/falcon/t/rpl_falcon_bug_37221.test' --- a/mysql-test/suite/falcon/t/rpl_falcon_bug_37221.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/falcon/t/rpl_falcon_bug_37221.test 2008-06-10 12:39:13 +0000 @@ -0,0 +1,53 @@ +# BUG#37221: SET AUTOCOMMIT=1 does not commit binary log + +# Regression test to ensure that the bug does not re-appear. The test +# is using the Falcon engine, but the problem is a generic case. See +# binlog_implicit_commit.test for a more elaborate test. + +source include/master-slave.inc; + +--echo [master] +connection master; +SET BINLOG_FORMAT = 'ROW'; + +CREATE TABLE IF NOT EXISTS t1 (id INT) ENGINE = Falcon; + +# When switching to AUTOCOMMIT=1, there is an implicit commit if we +# are outside a real transaction. + +SET AUTOCOMMIT=0; +INSERT INTO t1 VALUES (1); +SET AUTOCOMMIT=1; +SELECT * FROM t1; +--echo [slave] +sync_slave_with_master; +SELECT * FROM t1; + +# When inside a transaction, AUTOCOMMIT=1 should not commit the +# transaction. This is hard to test for sure (since delays might cause +# the transaction to not propagate fast enough), but it will not cause +# any false negatives (just false positives). + +--echo [master] +connection master; +BEGIN; +INSERT INTO t1 VALUES (2); +SET AUTOCOMMIT=1; + +--echo [slave] +connection slave; +SELECT * FROM t1 /* Should not contain 2 */; + +--echo [master] +connection master; +INSERT INTO t1 VALUES (3); +COMMIT; + +--echo [slave] +sync_slave_with_master; +SELECT * FROM t1 /* Should contain 2 and 3 */; + +--echo [master] +connection master; +DROP TABLE t1; +sync_slave_with_master; === modified file 'sql/set_var.cc' --- a/sql/set_var.cc 2008-05-21 10:17:29 +0000 +++ b/sql/set_var.cc 2008-06-09 19:32:42 +0000 @@ -2970,6 +2970,15 @@ static bool set_option_autocommit(THD *t ulonglong org_options= thd->options; + /* + If we are setting AUTOCOMMIT=1 and it was not already 1, then we + need to commit any outstanding transactions. + */ + if (var->save_result.ulong_value != 0 && + (thd->options & OPTION_NOT_AUTOCOMMIT) && + ha_commit(thd)) + return 1; + if (var->save_result.ulong_value != 0) thd->options&= ~((sys_var_thd_bit*) var->var)->bit_flag; else @@ -2983,8 +2992,6 @@ static bool set_option_autocommit(THD *t thd->options&= ~(ulonglong) (OPTION_BEGIN | OPTION_KEEP_LOG); thd->transaction.all.modified_non_trans_table= FALSE; thd->server_status|= SERVER_STATUS_AUTOCOMMIT; - if (ha_commit(thd)) - return 1; } else {