GIF89a; Mini Shell

Mini Shell

Direktori : /usr/share/mysql-test/suite/binlog/t/
Upload File :
Current File : //usr/share/mysql-test/suite/binlog/t/binlog_format_switch_in_tmp_table.test

#
# Bug #45855 row events in binlog after switch from binlog_fmt=mix to stmt with open tmp tbl
# Bug #45856 can't switch from binlog_format=row to mix with open tmp tbl
# This test verfies if the program will generate ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
# error and forbid switching @@SESSION.binlog_format from MIXED or ROW to
# STATEMENT when there are open temp tables and we are logging in row format.
# There is no error in any other case.
#

source include/have_binlog_format_mixed.inc;

SELECT @@SESSION.binlog_format;
CREATE TABLE t1 (a VARCHAR(100));
CREATE TEMPORARY TABLE t2 (a VARCHAR(100));

--echo # Test allow switching @@SESSION.binlog_format from MIXED to STATEMENT
--echo # when there are open temp tables and we are logging in statement based format.
SET SESSION binlog_format = STATEMENT;
SELECT @@SESSION.binlog_format;

--echo # Test allow switching @@SESSION.binlog_format from STATEMENT to
--echo # STATEMENT when there are open temp tables.
SET SESSION binlog_format = STATEMENT;
SELECT @@SESSION.binlog_format;

INSERT INTO t1 VALUES ('statement based');
SELECT @@SESSION.binlog_format;
--echo # Test allow switching @@SESSION.binlog_format from STATEMENT to
--echo # MIXED when there are open temp tables.
SET SESSION binlog_format = MIXED;
SELECT @@SESSION.binlog_format;

--echo # Test allow switching @@SESSION.binlog_format from MIXED to MIXED
--echo # when there are open temp tables.
SET SESSION binlog_format = MIXED;
SELECT @@SESSION.binlog_format;

INSERT INTO t2 VALUES (UUID());
SELECT @@SESSION.binlog_format;

--echo # Test forbit switching @@SESSION.binlog_format from MIXED to STATEMENT 
--echo # when there are open temp tables and we are logging in row based format.
--ERROR ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
SET SESSION binlog_format = STATEMENT;
SELECT @@SESSION.binlog_format;

SET SESSION binlog_format = ROW;
SELECT @@SESSION.binlog_format;

INSERT INTO t1 VALUES ('row based');
--echo # Test allow switching @@SESSION.binlog_format from ROW to MIXED 
--echo # when there are open temp tables.
SET SESSION binlog_format = MIXED;
SELECT @@SESSION.binlog_format;

INSERT INTO t1 VALUES ('row based');
--echo # Test allow switching @@SESSION.binlog_format from MIXED to ROW
--echo # when there are open temp tables.
SET SESSION binlog_format = ROW;
SELECT @@SESSION.binlog_format;

--echo # Test allow switching @@SESSION.binlog_format from ROW to ROW
--echo # when there are open temp tables.
SET SESSION binlog_format = ROW;
SELECT @@SESSION.binlog_format;

INSERT INTO t1 VALUES ('row based');
--echo # Test forbit switching @@SESSION.binlog_format from ROW to STATEMENT
--echo # when there are open temp tables.
--ERROR ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
SET SESSION binlog_format = STATEMENT;
SELECT @@SESSION.binlog_format;

DROP TEMPORARY TABLE t2;
DROP TABLE t1;


./BlackJoker Mini Shell 1.0