diff options
author | Alfranio Correia <alfranio.correia@sun.com> | 2010-06-01 15:40:54 +0100 |
---|---|---|
committer | Alfranio Correia <alfranio.correia@sun.com> | 2010-06-01 15:40:54 +0100 |
commit | 678f515c5078a497a704d578875991c773147cf1 (patch) | |
tree | e28ee37e4523a3cca352abf47a6aa02f28944d9a | |
parent | 8f5165906aba4e30dc78b7cb0548610d19aeaaac (diff) | |
parent | 76fafacebc5367765ca371ea22aad4b30a3f70dd (diff) | |
download | mariadb-git-678f515c5078a497a704d578875991c773147cf1.tar.gz |
auto-merge mysql-trunk-bugfixing (local) --> mysql-trunk-bugfixing.merge
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_temp_temporary.result | 27 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_temp_temporary.test | 33 | ||||
-rw-r--r-- | sql/sql_parse.cc | 4 |
3 files changed, 56 insertions, 8 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_temp_temporary.result b/mysql-test/suite/rpl/r/rpl_temp_temporary.result index 19b36da2800..548c95385f3 100644 --- a/mysql-test/suite/rpl/r/rpl_temp_temporary.result +++ b/mysql-test/suite/rpl/r/rpl_temp_temporary.result @@ -193,8 +193,6 @@ Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. INSERT INTO t_innodb VALUES(1); COMMIT; -DROP TABLE t_myisam; -DROP TABLE t_innodb; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam @@ -214,8 +212,29 @@ master-bin.000001 # Query # # use `test`; INSERT INTO tmp1 VALUES(1) master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1) master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1) master-bin.000001 # Xid # # COMMIT /* XID */ -master-bin.000001 # Query # # use `test`; DROP TABLE t_myisam -master-bin.000001 # Query # # use `test`; DROP TABLE t_innodb +######################################################################## +# VERIFY ITEM 8 +######################################################################## +SET BINLOG_FORMAT=MIXED; +BEGIN; +CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb; +INSERT INTO t_innodb VALUES(1); +INSERT INTO t_innodb VALUES(1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb +master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1) +master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1) +master-bin.000001 # Query # # ROLLBACK ################################################################################### # CHECK CONSISTENCY ################################################################################### +################################################################################### +# CLEAN UP +################################################################################### +DROP TABLE t_myisam; +DROP TABLE t_innodb; diff --git a/mysql-test/suite/rpl/t/rpl_temp_temporary.test b/mysql-test/suite/rpl/t/rpl_temp_temporary.test index a7234c53655..4eb2d16b91e 100644 --- a/mysql-test/suite/rpl/t/rpl_temp_temporary.test +++ b/mysql-test/suite/rpl/t/rpl_temp_temporary.test @@ -34,10 +34,13 @@ # the CREATE TEMPORARY is not logged and the DROP TEMPORARY is extended with # the IF EXISTS clause. # -# 7 - It also verifies if the CONNECTION_ID along with a non-transactional +# 7 - It verifies if the CONNECTION_ID along with a non-transactional # table is written outside the transaction boundaries and is not classified # as unsafe. See BUG#53075. # +# 8 - It verifies if OPTION_KEEP_LOG is set and thus forcing to write the +# trx-cache to the binary log when an rollback is issued and only trx-tables +# were updated. See BUG#53421. ################################################################################ source include/master-slave.inc; @@ -186,18 +189,40 @@ INSERT INTO t_innodb VALUES(1); INSERT INTO t_myisam VALUES(CONNECTION_ID()); INSERT INTO t_innodb VALUES(1); COMMIT; -DROP TABLE t_myisam; -DROP TABLE t_innodb; +source include/show_binlog_events.inc; + +--echo ######################################################################## +--echo # VERIFY ITEM 8 +--echo ######################################################################## +# +# Before the patch for BUG#53421, nothing were written to the binary log on +# behalf of the transaction presented below: +# +SET BINLOG_FORMAT=MIXED; +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +BEGIN; +CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb; +INSERT INTO t_innodb VALUES(1); +INSERT INTO t_innodb VALUES(1); +ROLLBACK; source include/show_binlog_events.inc; --echo ################################################################################### --echo # CHECK CONSISTENCY --echo ################################################################################### -connection master; sync_slave_with_master; +connection master; --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql --diff_files $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql +--echo ################################################################################### +--echo # CLEAN UP +--echo ################################################################################### +connection master; +DROP TABLE t_myisam; +DROP TABLE t_innodb; + +sync_slave_with_master; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ed4390a23cb..90d0a52d40d 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2670,6 +2670,10 @@ case SQLCOM_PREPARE: */ lex->unlink_first_table(&link_to_local); + /* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */ + if (create_info.options & HA_LEX_CREATE_TMP_TABLE) + thd->variables.option_bits|= OPTION_KEEP_LOG; + /* select_create is currently not re-execution friendly and needs to be created for every execution of a PS/SP. |