1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-36099 Ensure that creation and usage of temporary tables in replication is predictable

MDEV-36563 Assertion `!mysql_bin_log.is_open()' failed in
           THD::mark_tmp_table_as_free_for_reuse

The purpose of this commit is to ensure that creation and changes of
temporary tables are properly and predicable logged to the binary
log.  It also fixes some bugs where ROW logging was used in MIXED mode,
when STATEMENT would be a better (and expected) choice.

In this comment STATEMENT stands for logging to binary log in
STATEMENT format, MIXED stands for MIXED binlog format and ROW for ROW
binlog format.

New rules for logging of temporary tables
- CREATE of temporary tables are now by default binlogged only if
  STATEMENT binlog format is used. If it is binlogged, 1 is stored in
  TABLE_SHARE->table_creation_was_logged. The user can change this
  behavior by setting create_temporary_table_binlog_formats to
  MIXED,STATEMENT in which case the create is logged in statement
  format also in MIXED mode (as before).
- Changes to temporary tables are only binlogged if and only if
  the CREATE was logged. The logging happens under STATEMENT or MIXED.
  If binlog_format=ROW, temporary table changes are not binlogged. A
  temporary table that are changed under ROW are marked as 'not up to
  date in binlog' and no future row changes are logged.  Any usage of
  this temporary table will force row logging of other tables in any
  future statements using the temporary table to be row logged.
- DROP TEMPORARY is binlogged only of the CREATE was binlogged.

Changes done:
- Row logging is forced for any statement using temporary tables that
  are not up to date in the binary log.
  (Before the row logging was forced if the user has a temporary table)
- If there is any changes to the temporary table that is not binlogged,
  the table is marked as not up to date.
- TABLE_SHARE->table_creation_was_logged has a new definition for
  temporary tables:
  0  Table creating was not logged to binary log
  1  Table creating was logged to binary log and table is up to date.
  2  Table creating was logged to binary log but some changes where
     not logged to binary log.
  Table is not up to date in binary log is defined as value 0 or 2.
- If a multi-table-update or multi-table-delete fails then
  all updated temporary tables are marked as not up to date.
- Enforce row logging if the query is using temporary tables
  that are not up to date.
  Before row logging was enforced if the user had any
  temporary tables.
- When dropping temporary tables use IF EXISTS. This ensures
  that slave will not stop if it had crashed and lost the
  temporary tables.
- Remove comment and version from DROP /*!4000 TEMPORARY.. generated when
  a connection closes that has open temporary tables. Added 'generated by
  server' at the end of the DROP.

Bugs fixed:
- When using temporary tables with commands that forced row based,
  like INSERT INTO temporary_table VALUES (UUID()), this was never
  logged which causes the temporary table to be inconsistent on
  master and slave.
- Used binlog format is now clearly defined. It is now only depending
  on the current binlog_format and the tables used.
  Before it was depending on the user had ANY temporary tables and
  the state of 'current_stmt_binlog_format' set by previous queries.
  This also caused temporary tables to be logged to binary log in
  some cases.
- CREATE TABLE t1 LIKE not_logged_temporary_table caused replication
  to stop.
- Rename of not binlogged temporary tables where binlogged to binary log
  which caused replication to stop.

Changes in behavior:

- By default create_temporary_table_binlog_formats=STATEMENT, which
  means that CREATE TEMPORARY is not logged to binary log under MIXED
  binary logging. This can be changed by setting
  create_temporary_table_binlog_formats to MIXED,STATEMENT.
- Using temporary tables that was not logged to the binary log will
  cause any query using them for updating other tables to be logged in
  ROW format. Before all queries was logged in ROW format if the user had
  any temporary tables, even if they were not used by the query.
- Generated DROP TEMPORARY TABLE is now always using IF EXISTS and
  has a "generated by server" comment in the binary log.

The consequences of the above is that manipulations of a lot of rows
through temporary tables will by default be be slower in mixed mode.

For example:
  BEGIN;
  CREATE TEMPORARY TABLE tmp AS SELECT a, b, c FROM
  large_table1 JOIN large_table2 ON ...;
  INSERT INTO other_table SELECT b, c FROM tmp WHERE a <100;
  DROP TEMPORARY TABLE tmp;
  COMMIT;

By default this will create a huge entry in the binary log, compared
to just a few hundred bytes in statement mode. However the change in
this commit will make usage of temporary tables more reliable and
predicable and is thus worth it. Using statement mode or
create_temporary_table_binlog_formats can be used to avoid this issue.
This commit is contained in:
Monty
2025-02-15 14:08:11 +02:00
parent a9bdfccbc6
commit f8ba5ced55
98 changed files with 4669 additions and 744 deletions

View File

@@ -55,7 +55,8 @@ connection default;
# DROP TEMPORARY TABLE statement will be not be written to binary log upon # DROP TEMPORARY TABLE statement will be not be written to binary log upon
# session closure. # session closure.
if (!`SELECT @@BINLOG_FORMAT = 'ROW'`) { if (`SELECT FIND_IN_SET(@@BINLOG_FORMAT,@@CREATE_TMP_TABLE_BINLOG_FORMATS) > 0`)
{
--let $wait_condition= SELECT variable_value > $before_drop_pos FROM information_schema.global_status WHERE variable_name = 'binlog_snapshot_position' --let $wait_condition= SELECT variable_value > $before_drop_pos FROM information_schema.global_status WHERE variable_name = 'binlog_snapshot_position'
--source include/wait_condition.inc --source include/wait_condition.inc
} }

View File

@@ -11,6 +11,10 @@ set sql_mode=no_engine_substitution;
eval set default_storage_engine = $engine_type; eval set default_storage_engine = $engine_type;
set autocommit=1; set autocommit=1;
# The tests of number of commits assumes that temporary tables will be
# logged to binary log.
set @@create_tmp_table_binlog_formats="mixed";
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
drop table if exists t2; drop table if exists t2;

View File

@@ -1,4 +1,4 @@
--source include/have_binlog_format_mixed_or_statement.inc --source include/have_binlog_format_statement.inc
# #
# Tests involving locks and binlog # Tests involving locks and binlog

View File

@@ -2,6 +2,7 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
set sql_mode=no_engine_substitution; set sql_mode=no_engine_substitution;
set default_storage_engine = InnoDB; set default_storage_engine = InnoDB;
set autocommit=1; set autocommit=1;
set @@create_tmp_table_binlog_formats="mixed";
drop table if exists t1; drop table if exists t1;
drop table if exists t2; drop table if exists t2;
drop table if exists t3; drop table if exists t3;

View File

@@ -1,14 +1,14 @@
--- main/mysqld--help.result --- a/mysql-test/main/mysqld--help.result
+++ main/mysqld--help,win.reject +++ b/mysql-test/main/mysqld--help.result
@@ -228,6 +228,7 @@ @@ -223,6 +223,7 @@
--console Write error output on screen; don't remove the console --console Write error output on screen; don't remove the console
window on Windows window on Windows
--core-file Write core on crashes --core-file Write core on crashes
+ (Defaults to on; use --skip-core-file to disable.) + (Defaults to on; use --skip-core-file to disable.)
-h, --datadir=name Path to the database root directory --create-tmp-table-binlog-formats=name
--deadlock-search-depth-long=# The binary logging formats under which the master will
Long search depth for the two-step deadlock detection log CREATE TEMPORARY statments to the binary log. If
@@ -738,6 +739,7 @@ @@ -766,6 +767,7 @@
Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME, Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME,
DATETIME, TIMESTAMP columns DATETIME, TIMESTAMP columns
(Defaults to on; use --skip-mysql56-temporal-format to disable.) (Defaults to on; use --skip-mysql56-temporal-format to disable.)
@@ -16,7 +16,7 @@
--net-buffer-length=# --net-buffer-length=#
Buffer length for TCP/IP and socket communication Buffer length for TCP/IP and socket communication
--net-read-timeout=# --net-read-timeout=#
@@ -1451,6 +1453,10 @@ @@ -1479,6 +1481,10 @@
Alias for log_slow_query_file. Log slow queries to given Alias for log_slow_query_file. Log slow queries to given
log file. Defaults logging to 'hostname'-slow.log. Must log file. Defaults logging to 'hostname'-slow.log. Must
be enabled to activate other slow log options be enabled to activate other slow log options
@@ -27,7 +27,7 @@
--socket=name Socket file to use for connection --socket=name Socket file to use for connection
--sort-buffer-size=# --sort-buffer-size=#
Each thread that needs to do a sort allocates a buffer of Each thread that needs to do a sort allocates a buffer of
@@ -1475,6 +1481,7 @@ @@ -1503,6 +1509,7 @@
deleting or updating every row in a table deleting or updating every row in a table
--stack-trace Print a symbolic stack trace on failure --stack-trace Print a symbolic stack trace on failure
(Defaults to on; use --skip-stack-trace to disable.) (Defaults to on; use --skip-stack-trace to disable.)
@@ -35,7 +35,7 @@
--standard-compliant-cte --standard-compliant-cte
Allow only CTEs compliant to SQL standard Allow only CTEs compliant to SQL standard
(Defaults to on; use --skip-standard-compliant-cte to disable.) (Defaults to on; use --skip-standard-compliant-cte to disable.)
@@ -1554,6 +1561,12 @@ @@ -1582,6 +1589,12 @@
--thread-pool-max-threads=# --thread-pool-max-threads=#
Maximum allowed number of worker threads in the thread Maximum allowed number of worker threads in the thread
pool pool
@@ -48,7 +48,7 @@
--thread-pool-oversubscribe=# --thread-pool-oversubscribe=#
How many additional active worker threads in a group are How many additional active worker threads in a group are
allowed allowed
@@ -1595,8 +1608,8 @@ @@ -1623,8 +1636,8 @@
background for binlogging by user threads are placed in a background for binlogging by user threads are placed in a
separate location (see `binlog_large_commit_threshold` separate location (see `binlog_large_commit_threshold`
option). Several paths may be specified, separated by a option). Several paths may be specified, separated by a
@@ -59,7 +59,7 @@
--transaction-alloc-block-size=# --transaction-alloc-block-size=#
Allocation block size for transactions to be stored in Allocation block size for transactions to be stored in
binary log binary log
@@ -1826,6 +1839,7 @@ @@ -1861,6 +1874,7 @@
myisam-stats-method NULLS_UNEQUAL myisam-stats-method NULLS_UNEQUAL
myisam-use-mmap FALSE myisam-use-mmap FALSE
mysql56-temporal-format TRUE mysql56-temporal-format TRUE
@@ -67,7 +67,7 @@
net-buffer-length 16384 net-buffer-length 16384
net-read-timeout 30 net-read-timeout 30
net-retry-count 10 net-retry-count 10
@@ -2002,6 +2016,7 @@ @@ -2037,6 +2051,7 @@
slave-type-conversions slave-type-conversions
slow-launch-time 2 slow-launch-time 2
slow-query-log FALSE slow-query-log FALSE
@@ -75,7 +75,7 @@
sort-buffer-size 2097152 sort-buffer-size 2097152
sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql-safe-updates FALSE sql-safe-updates FALSE
@@ -2029,6 +2044,8 @@ @@ -2064,6 +2079,8 @@
thread-pool-exact-stats FALSE thread-pool-exact-stats FALSE
thread-pool-idle-timeout 60 thread-pool-idle-timeout 60
thread-pool-max-threads 65536 thread-pool-max-threads 65536

View File

@@ -228,6 +228,13 @@ The following specify which files/extra groups are read (specified before remain
--console Write error output on screen; don't remove the console --console Write error output on screen; don't remove the console
window on Windows window on Windows
--core-file Write core on crashes --core-file Write core on crashes
--create-tmp-table-binlog-formats=name
The binary logging formats under which the master will
log CREATE TEMPORARY statments to the binary log. If
CREATE TEMPORARY is not logged, all usage of the
temporary table will be logged in ROW format. Allowed
values are STATEMENT or MIXED,STATEMENT, or ALL to set
all combinations
-h, --datadir=name Path to the database root directory -h, --datadir=name Path to the database root directory
--deadlock-search-depth-long=# --deadlock-search-depth-long=#
Long search depth for the two-step deadlock detection Long search depth for the two-step deadlock detection
@@ -1699,6 +1706,7 @@ completion-type NO_CHAIN
concurrent-insert AUTO concurrent-insert AUTO
console TRUE console TRUE
core-file TRUE core-file TRUE
create-tmp-table-binlog-formats STATEMENT
deadlock-search-depth-long 15 deadlock-search-depth-long 15
deadlock-search-depth-short 4 deadlock-search-depth-short 4
deadlock-timeout-long 50000000 deadlock-timeout-long 50000000

View File

@@ -1278,7 +1278,7 @@ Table Op Msg_type Msg_text
mysql.column_stats analyze error Invalid argument mysql.column_stats analyze error Invalid argument
ANALYZE TABLE mysql.column_stats; ANALYZE TABLE mysql.column_stats;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
mysql.column_stats analyze status OK mysql.column_stats analyze status Table is already up to date
SELECT * FROM mysql.table_stats; SELECT * FROM mysql.table_stats;
db_name table_name cardinality db_name table_name cardinality
SELECT * FROM mysql.column_stats; SELECT * FROM mysql.column_stats;

View File

@@ -1569,7 +1569,7 @@ Table Op Msg_type Msg_text
mysql.column_stats analyze error Invalid argument mysql.column_stats analyze error Invalid argument
ANALYZE TABLE mysql.column_stats; ANALYZE TABLE mysql.column_stats;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
mysql.column_stats analyze status OK mysql.column_stats analyze status Table is already up to date
SELECT * FROM mysql.table_stats; SELECT * FROM mysql.table_stats;
db_name table_name cardinality db_name table_name cardinality
SELECT * FROM mysql.column_stats; SELECT * FROM mysql.column_stats;

View File

@@ -0,0 +1,31 @@
#
# MDEV-36563 Assertion `!mysql_bin_log.is_open()' failed in
# THD::mark_tmp_table_as_free_for_reuse upon REPAIR
#
CREATE TEMPORARY TABLE t1 (c INT);
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
DROP TABLE t1;
CREATE TEMPORARY TABLE t1 (c INT) engine=innodb;
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
DROP TABLE t1;
set sql_mode='strict_all_tables';
SET @@session.binlog_format=statement;
CREATE TEMPORARY TABLE t1(a CHAR(3));
insert into t1 values ("a"),("abcd"),("b");
ERROR 22001: Data too long for column 'a' at row 2
select * from t1;
a
a
drop table t1;
set sql_mode=default;
CREATE TABLE t1 (c CHAR(3));
INSERT INTO t1 VALUES ("a"),("a");
CREATE TEMPORARY TABLE t2 (c CHAR(1) primary key);
INSERT INTO t2 (c) VALUES ('b');
INSERT INTO t2 (c) VALUES ('b');
ERROR 23000: Duplicate entry 'b' for key 'PRIMARY'
drop table t1,t2;

View File

@@ -0,0 +1,33 @@
--source include/have_binlog_format_statement.inc
--source include/have_innodb.inc
--echo #
--echo # MDEV-36563 Assertion `!mysql_bin_log.is_open()' failed in
--echo # THD::mark_tmp_table_as_free_for_reuse upon REPAIR
--echo #
CREATE TEMPORARY TABLE t1 (c INT);
REPAIR TABLE t1;
DROP TABLE t1;
CREATE TEMPORARY TABLE t1 (c INT) engine=innodb;
REPAIR TABLE t1;
DROP TABLE t1;
set sql_mode='strict_all_tables';
SET @@session.binlog_format=statement;
CREATE TEMPORARY TABLE t1(a CHAR(3));
--error ER_DATA_TOO_LONG
insert into t1 values ("a"),("abcd"),("b");
select * from t1;
drop table t1;
set sql_mode=default;
CREATE TABLE t1 (c CHAR(3));
INSERT INTO t1 VALUES ("a"),("a");
CREATE TEMPORARY TABLE t2 (c CHAR(1) primary key);
INSERT INTO t2 (c) VALUES ('b');
--error ER_DUP_ENTRY
INSERT INTO t2 (c) VALUES ('b');
drop table t1,t2;

View File

@@ -261,6 +261,7 @@ create table t1 (a int);
create table if not exists t2 select * from t1; create table if not exists t2 select * from t1;
# bug#22762 # bug#22762
select @@binlog_format;
create temporary table tt1 (a int); create temporary table tt1 (a int);
create table if not exists t3 like tt1; create table if not exists t3 like tt1;

View File

@@ -1,6 +1,8 @@
source include/have_log_bin.inc; source include/have_log_bin.inc;
source include/not_embedded.inc; source include/not_embedded.inc;
select @@binlog_format, @@create_tmp_table_binlog_formats;
# Checking that the drop of a database does not replicate anything in # Checking that the drop of a database does not replicate anything in
# addition to the drop of the database # addition to the drop of the database
@@ -22,10 +24,11 @@ reset master;
create temporary table tt1 (a int); create temporary table tt1 (a int);
create table t1 (a int); create table t1 (a int);
insert into t1 values (1); insert into t1 values (1);
insert into tt1 values (2);
disable_warnings; disable_warnings;
drop database if exists mysqltest1; drop database if exists mysqltest1;
enable_warnings; enable_warnings;
insert into t1 values (1); insert into t1 select * from tt1;
drop table tt1, t1; drop table tt1, t1;
source include/show_binlog_events.inc; source include/show_binlog_events.inc;

View File

@@ -4,6 +4,9 @@
DROP DATABASE IF EXISTS `drop-temp+table-test`; DROP DATABASE IF EXISTS `drop-temp+table-test`;
--enable_warnings --enable_warnings
select @@session.binlog_format;
select @@session.create_tmp_table_binlog_formats;
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
connection con1; connection con1;
@@ -95,7 +98,8 @@ SELECT @@session.binlog_format;
--disconnect con1 --disconnect con1
-- connection default -- connection default
if (!`SELECT @@BINLOG_FORMAT = 'ROW'`) { if (`SELECT FIND_IN_SET(@@BINLOG_FORMAT,@@CREATE_TMP_TABLE_BINLOG_FORMATS) > 0`)
{
--let $wait_binlog_event= DROP --let $wait_binlog_event= DROP
--source include/wait_for_binlog_event.inc --source include/wait_for_binlog_event.inc
} }

View File

@@ -1,4 +1,7 @@
set binlog_format=statement; set binlog_format=statement;
select @@binlog_format, @@create_tmp_table_binlog_formats;
@@binlog_format @@create_tmp_table_binlog_formats
STATEMENT STATEMENT
reset master; reset master;
create database testing_1; create database testing_1;
use testing_1; use testing_1;
@@ -28,8 +31,9 @@ reset master;
create temporary table tt1 (a int); create temporary table tt1 (a int);
create table t1 (a int); create table t1 (a int);
insert into t1 values (1); insert into t1 values (1);
insert into tt1 values (2);
drop database if exists mysqltest1; drop database if exists mysqltest1;
insert into t1 values (1); insert into t1 select * from tt1;
drop table tt1, t1; drop table tt1, t1;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
@@ -40,13 +44,16 @@ master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t1 values (1) master-bin.000001 # Query # # use `test`; insert into t1 values (1)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into tt1 values (2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # drop database if exists mysqltest1 master-bin.000001 # Query # # drop database if exists mysqltest1
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t1 values (1) master-bin.000001 # Query # # use `test`; insert into t1 select * from tt1
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt1` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
FLUSH STATUS; FLUSH STATUS;
@@ -95,6 +102,9 @@ master-bin.000001 # Query # # use `db1`; DROP TABLE IF EXISTS `t1`
DROP TABLE t3; DROP TABLE t3;
DROP DATABASE db1; DROP DATABASE db1;
set binlog_format=mixed; set binlog_format=mixed;
select @@binlog_format, @@create_tmp_table_binlog_formats;
@@binlog_format @@create_tmp_table_binlog_formats
MIXED STATEMENT
reset master; reset master;
create database testing_1; create database testing_1;
use testing_1; use testing_1;
@@ -124,8 +134,108 @@ reset master;
create temporary table tt1 (a int); create temporary table tt1 (a int);
create table t1 (a int); create table t1 (a int);
insert into t1 values (1); insert into t1 values (1);
insert into tt1 values (2);
drop database if exists mysqltest1; drop database if exists mysqltest1;
insert into t1 select * from tt1;
drop table tt1, t1;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # drop database if exists mysqltest1
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # insert into t1 select * from tt1
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
FLUSH STATUS;
# 'DROP TABLE IF EXISTS <deleted tables>' is binlogged
# when 'DROP DATABASE' fails and at least one table is deleted
# from the database.
RESET MASTER;
CREATE DATABASE testing_1;
USE testing_1;
CREATE TABLE t1(c1 INT);
CREATE TABLE t2(c1 INT);
# Create a file in the database directory
SELECT 'hello' INTO OUTFILE 'fake_file.FAKE_FILE';
# 'DROP DATABASE' will fail if there is any other file in the the
# database directory
DROP DATABASE testing_1;
ERROR HY000: Error dropping database (can't rmdir './testing_1', errno: 39 "Directory not empty")
# Remove the fake file.
# Now we can drop the database.
DROP DATABASE testing_1;
#
# Bug#11765416 58381: FAILED DROP DATABASE CAN BREAK STATEMENT
# BASED REPLICATION
#
USE test;
DROP DATABASE IF EXISTS db1;
DROP TABLE IF EXISTS t3;
CREATE DATABASE db1;
CREATE TABLE db1.t1 (a INT);
CREATE TABLE db1.t2 (b INT, KEY(b)) engine=innodb;
CREATE TABLE t3 (a INT, KEY (a), FOREIGN KEY(a) REFERENCES db1.t2(b))
engine=innodb;
RESET MASTER;
DROP DATABASE db1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
SHOW TABLES FROM db1;
Tables_in_db1
t2
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `db1`; DROP TABLE IF EXISTS `t1`
DROP TABLE t3;
DROP DATABASE db1;
set binlog_format=mixed;
SET @@create_tmp_table_binlog_formats="mixed";
select @@binlog_format, @@create_tmp_table_binlog_formats;
@@binlog_format @@create_tmp_table_binlog_formats
MIXED MIXED,STATEMENT
reset master;
create database testing_1;
use testing_1;
create table t1 (a int);
create function sf1 (a int) returns int return a+1;
create trigger tr1 before insert on t1 for each row insert into t2 values (2*new.a);
create procedure sp1 (a int) insert into t1 values(a);
drop database testing_1;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # create database testing_1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `testing_1`; create table t1 (a int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost` FUNCTION `sf1`(a int) RETURNS int(11)
return a+1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost` trigger tr1 before insert on t1 for each row insert into t2 values (2*new.a)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`(a int)
insert into t1 values(a)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # drop database testing_1
use test;
reset master;
create temporary table tt1 (a int);
create table t1 (a int);
insert into t1 values (1); insert into t1 values (1);
insert into tt1 values (2);
drop database if exists mysqltest1;
insert into t1 select * from tt1;
drop table tt1, t1; drop table tt1, t1;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
@@ -136,13 +246,16 @@ master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t1 values (1) master-bin.000001 # Query # # use `test`; insert into t1 values (1)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into tt1 values (2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # drop database if exists mysqltest1 master-bin.000001 # Query # # drop database if exists mysqltest1
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t1 values (1) master-bin.000001 # Query # # use `test`; insert into t1 select * from tt1
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt1` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
FLUSH STATUS; FLUSH STATUS;
@@ -191,6 +304,9 @@ master-bin.000001 # Query # # use `db1`; DROP TABLE IF EXISTS `t1`
DROP TABLE t3; DROP TABLE t3;
DROP DATABASE db1; DROP DATABASE db1;
set binlog_format=row; set binlog_format=row;
select @@binlog_format, @@create_tmp_table_binlog_formats;
@@binlog_format @@create_tmp_table_binlog_formats
ROW MIXED,STATEMENT
reset master; reset master;
create database testing_1; create database testing_1;
use testing_1; use testing_1;
@@ -220,8 +336,9 @@ reset master;
create temporary table tt1 (a int); create temporary table tt1 (a int);
create table t1 (a int); create table t1 (a int);
insert into t1 values (1); insert into t1 values (1);
insert into tt1 values (2);
drop database if exists mysqltest1; drop database if exists mysqltest1;
insert into t1 values (1); insert into t1 select * from tt1;
drop table tt1, t1; drop table tt1, t1;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
@@ -235,7 +352,7 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # drop database if exists mysqltest1 master-bin.000001 # Query # # drop database if exists mysqltest1
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # insert into t1 values (1) master-bin.000001 # Annotate_rows # # insert into t1 select * from tt1
master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT

View File

@@ -17,6 +17,31 @@ ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction
CREATE TEMPORARY SEQUENCE seq_2; CREATE TEMPORARY SEQUENCE seq_2;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
XA ROLLBACK '3'; XA ROLLBACK '3';
DROP SEQUENCE seq_1;
DROP TABLE tmp_1;
# Proof of correct logging incl empty XA-PREPARE
include/show_binlog_events.inc
SET @@binlog_format="statement";
RESET MASTER;
CREATE TEMPORARY SEQUENCE seq_1;
XA START '3';
CREATE TEMPORARY TABLE tmp_1(c INT);
XA END '3';
XA PREPARE '3';
DROP TEMPORARY TABLE tmp_1;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
ALTER TABLE tmp_1 DROP COLUMN c;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
DROP TEMPORARY SEQUENCE seq_1;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
ALTER SEQUENCE seq_1 INCREMENT BY 1;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
CREATE TEMPORARY TABLE tmp_2(c INT);
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
CREATE TEMPORARY SEQUENCE seq_2;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
XA ROLLBACK '3';
SET @@binlog_format="mixed";
# Proof of correct logging incl empty XA-PREPARE # Proof of correct logging incl empty XA-PREPARE
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
@@ -89,9 +114,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE SEQUENCE s ENGINE=InnoDB master-bin.000001 # Query # # use `test`; CREATE SEQUENCE s ENGINE=InnoDB
@@ -132,9 +155,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE SEQUENCE s ENGINE=InnoDB master-bin.000001 # Query # # use `test`; CREATE SEQUENCE s ENGINE=InnoDB
@@ -155,9 +176,7 @@ master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
DROP TABLE t1; DROP TABLE t1;
connect con2,localhost,root,,; connect con2,localhost,root,,;
@@ -182,9 +201,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE SEQUENCE s ENGINE=InnoDB master-bin.000001 # Query # # use `test`; CREATE SEQUENCE s ENGINE=InnoDB
@@ -205,9 +222,7 @@ master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */

View File

@@ -6,9 +6,13 @@ CREATE TEMPORARY TABLE t2 (a VARCHAR(100));
# Test allow switching @@SESSION.binlog_format from MIXED to STATEMENT # Test allow switching @@SESSION.binlog_format from MIXED to STATEMENT
# when there are open temp tables and we are logging in statement based format. # when there are open temp tables and we are logging in statement based format.
SET SESSION binlog_format = STATEMENT; SET SESSION binlog_format = STATEMENT;
ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables
SELECT @@SESSION.binlog_format; SELECT @@SESSION.binlog_format;
@@SESSION.binlog_format @@SESSION.binlog_format
STATEMENT MIXED
DROP TABLE t2;
SET SESSION binlog_format = STATEMENT;
CREATE TEMPORARY TABLE t2 (a VARCHAR(100));
# Test allow switching @@SESSION.binlog_format from STATEMENT to # Test allow switching @@SESSION.binlog_format from STATEMENT to
# STATEMENT when there are open temp tables. # STATEMENT when there are open temp tables.
SET SESSION binlog_format = STATEMENT; SET SESSION binlog_format = STATEMENT;
@@ -31,6 +35,13 @@ SET SESSION binlog_format = MIXED;
SELECT @@SESSION.binlog_format; SELECT @@SESSION.binlog_format;
@@SESSION.binlog_format @@SESSION.binlog_format
MIXED MIXED
# Switching between mixed and row still works
SET SESSION binlog_format = STATEMENT;
SET SESSION binlog_format = MIXED;
# Ensure that usage of t2 uses statement logging
SET SESSION binlog_format = MIXED;
insert into t1 select * from t2;
# This will switch binlog format when using t2 to ROW
INSERT INTO t2 VALUES (UUID()); INSERT INTO t2 VALUES (UUID());
SELECT @@SESSION.binlog_format; SELECT @@SESSION.binlog_format;
@@SESSION.binlog_format @@SESSION.binlog_format
@@ -74,5 +85,42 @@ ERROR HY000: Cannot switch out of the row-based binary log format when the sessi
SELECT @@SESSION.binlog_format; SELECT @@SESSION.binlog_format;
@@SESSION.binlog_format @@SESSION.binlog_format
ROW ROW
# Ensure that usage of t2 uses row logging
SET SESSION binlog_format = MIXED;
insert into t1 select * from t2;
DROP TEMPORARY TABLE t2; DROP TEMPORARY TABLE t2;
DROP TABLE t1; DROP TABLE t1;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a VARCHAR(100))
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE t2 (a VARCHAR(100))
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('statement based')
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t1 select * from t2
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES ('row based')
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('row based')
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES ('row based')
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # insert into t1 select * from t2
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t2` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */

View File

@@ -0,0 +1,110 @@
DROP DATABASE IF EXISTS `drop-temp+table-test`;
select @@session.binlog_format;
@@session.binlog_format
MIXED
select @@session.create_tmp_table_binlog_formats;
@@session.create_tmp_table_binlog_formats
STATEMENT
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
RESET MASTER;
CREATE DATABASE `drop-temp+table-test`;
USE `drop-temp+table-test`;
CREATE TEMPORARY TABLE shortn1 (a INT);
CREATE TEMPORARY TABLE `table:name` (a INT);
CREATE TEMPORARY TABLE shortn2 (a INT);
CREATE TEMPORARY TABLE tmp(c1 int);
CREATE TEMPORARY TABLE tmp1(c1 int);
CREATE TEMPORARY TABLE tmp2(c1 int);
CREATE TEMPORARY TABLE tmp3(c1 int);
CREATE TABLE t(c1 int);
DROP TEMPORARY TABLE IF EXISTS tmp;
DROP TEMPORARY TABLE IF EXISTS tmp;
DROP TEMPORARY TABLE IF EXISTS tmp, tmp1;
DROP TEMPORARY TABLE tmp3;
DROP TABLE IF EXISTS tmp2, t;
DROP TABLE IF EXISTS tmp2, t;
SELECT GET_LOCK("a",10);
GET_LOCK("a",10)
1
USE test;
disconnect con1;
connection con2;
SELECT GET_LOCK("a",10);
GET_LOCK("a",10)
1
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # CREATE DATABASE `drop-temp+table-test`
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TABLE t(c1 int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `t` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `tmp2`,`t` /* generated by server */
DROP DATABASE `drop-temp+table-test`;
RESET MASTER;
CREATE TABLE t1 ( i text );
connect con1,localhost,root,,;
CREATE TEMPORARY TABLE ttmp1 ( i text );
SET @@session.binlog_format=ROW;
INSERT INTO t1 VALUES ('1');
SELECT @@session.binlog_format;
@@session.binlog_format
ROW
disconnect con1;
connection default;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 ( i text )
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES ('1')
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
RESET MASTER;
DROP TABLE t1;
#
# BUG#28642318: POINT IN TIME RECOVERY USING MYSQLBINLOG BROKEN
# WITH TEMPORARY TABLE -> ERRORS
# Test case for DELETE query.
RESET MASTER;
connect con1,localhost,root,,;
# Set up.
connection default;
SET @save_binlog_format= @@session.binlog_format;
SET @@session.binlog_format=STATEMENT;
CREATE TABLE t1 (a INT) ENGINE=INNODB;
connection con1;
SET @@session.binlog_format=STATEMENT;
CREATE TEMPORARY TABLE t1 (b BLOB) ENGINE=INNODB;
connection default;
DELETE d1, d2 FROM t1 AS d1, t1 AS d2 WHERE d1.a<>d2.a;
connection default;
DROP TABLE t1;
# DELETE query fails with table re-open error without patch.
# Clean up.
connection con1;
DROP TABLE IF EXISTS t1;
connection default;
DROP TABLE IF EXISTS t1;
RESET MASTER;
# Test case for DROP query.
connection default;
CREATE TABLE t2 (a INT) ENGINE=INNODB;
connection con1;
CREATE TEMPORARY TABLE t2 (b BLOB) ENGINE=INNODB;
connection default;
DROP TABLE t2;
connection con1;
DROP TABLE t2;
connection default;
# DROP table query fails with unknown table error without patch.
# Clean up
connection default;
SET @@session.binlog_format= @save_binlog_format;
RESET MASTER;
disconnect con1;

View File

@@ -0,0 +1,141 @@
set @@session.create_tmp_table_binlog_formats="MIXED";
set @@global.create_tmp_table_binlog_formats="MIXED";
DROP DATABASE IF EXISTS `drop-temp+table-test`;
select @@session.binlog_format;
@@session.binlog_format
MIXED
select @@session.create_tmp_table_binlog_formats;
@@session.create_tmp_table_binlog_formats
MIXED,STATEMENT
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
RESET MASTER;
CREATE DATABASE `drop-temp+table-test`;
USE `drop-temp+table-test`;
CREATE TEMPORARY TABLE shortn1 (a INT);
CREATE TEMPORARY TABLE `table:name` (a INT);
CREATE TEMPORARY TABLE shortn2 (a INT);
CREATE TEMPORARY TABLE tmp(c1 int);
CREATE TEMPORARY TABLE tmp1(c1 int);
CREATE TEMPORARY TABLE tmp2(c1 int);
CREATE TEMPORARY TABLE tmp3(c1 int);
CREATE TABLE t(c1 int);
DROP TEMPORARY TABLE IF EXISTS tmp;
DROP TEMPORARY TABLE IF EXISTS tmp;
DROP TEMPORARY TABLE IF EXISTS tmp, tmp1;
DROP TEMPORARY TABLE tmp3;
DROP TABLE IF EXISTS tmp2, t;
DROP TABLE IF EXISTS tmp2, t;
SELECT GET_LOCK("a",10);
GET_LOCK("a",10)
1
USE test;
disconnect con1;
connection con2;
SELECT GET_LOCK("a",10);
GET_LOCK("a",10)
1
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # CREATE DATABASE `drop-temp+table-test`
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE shortn1 (a INT)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE `table:name` (a INT)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE shortn2 (a INT)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE tmp(c1 int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE tmp1(c1 int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE tmp2(c1 int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE tmp3(c1 int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TABLE t(c1 int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp1` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp3` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp2` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `t` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `tmp2`,`t` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `shortn2`,`table:name`,`shortn1` /* generated by server */
DROP DATABASE `drop-temp+table-test`;
RESET MASTER;
CREATE TABLE t1 ( i text );
connect con1,localhost,root,,;
CREATE TEMPORARY TABLE ttmp1 ( i text );
SET @@session.binlog_format=ROW;
INSERT INTO t1 VALUES ('1');
SELECT @@session.binlog_format;
@@session.binlog_format
ROW
disconnect con1;
connection default;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 ( i text )
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE ttmp1 ( i text )
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES ('1')
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `ttmp1` /* generated by server */
RESET MASTER;
DROP TABLE t1;
#
# BUG#28642318: POINT IN TIME RECOVERY USING MYSQLBINLOG BROKEN
# WITH TEMPORARY TABLE -> ERRORS
# Test case for DELETE query.
RESET MASTER;
connect con1,localhost,root,,;
# Set up.
connection default;
SET @save_binlog_format= @@session.binlog_format;
SET @@session.binlog_format=STATEMENT;
CREATE TABLE t1 (a INT) ENGINE=INNODB;
connection con1;
SET @@session.binlog_format=STATEMENT;
CREATE TEMPORARY TABLE t1 (b BLOB) ENGINE=INNODB;
connection default;
DELETE d1, d2 FROM t1 AS d1, t1 AS d2 WHERE d1.a<>d2.a;
connection default;
DROP TABLE t1;
# DELETE query fails with table re-open error without patch.
# Clean up.
connection con1;
DROP TABLE IF EXISTS t1;
connection default;
DROP TABLE IF EXISTS t1;
RESET MASTER;
# Test case for DROP query.
connection default;
CREATE TABLE t2 (a INT) ENGINE=INNODB;
connection con1;
CREATE TEMPORARY TABLE t2 (b BLOB) ENGINE=INNODB;
connection default;
DROP TABLE t2;
connection con1;
DROP TABLE t2;
connection default;
# DROP table query fails with unknown table error without patch.
# Clean up
connection default;
SET @@session.binlog_format= @save_binlog_format;
RESET MASTER;
disconnect con1;
set @@global.create_tmp_table_binlog_formats=default;

View File

@@ -0,0 +1,86 @@
RESET MASTER;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
/* GTID */ INSERT INTO t1 VALUES (1,0);
/* GTID */ BEGIN;
/* GTID */ INSERT INTO t1 VALUES (2,0);
/* GTID */ ALTER TABLE t1 ADD c INT;
/* GTID */ INSERT INTO t1 VALUES (3,0,0);
/* GTID */ COMMIT;
/* GTID */ BEGIN;
/* GTID */ UPDATE t1 SET b=1, c=1 WHERE a=2;
/* GTID */ CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
/* GTID */ INSERT INTO t2 VALUES (4,10), (5,20);
/* GTID */ INSERT INTO t1 SELECT a, 2, b FROM t2;
/* GTID */ DROP TEMPORARY TABLE t2;
/* GTID */ INSERT INTO t1 VALUES (6, 3, 0);
/* GTID */ COMMIT;
/* GTID */ CREATE TEMPORARY TABLE t3 (a INT PRIMARY KEY) ENGINE=InnoDB;
/* GTID */ BEGIN;
/* GTID */ DELETE FROM t1 WHERE a=5;
/* GTID */ INSERT INTO t3 VALUES (7);
/* GTID */ INSERT INTO t1 SELECT a, 4, 0 FROM t3;
/* GTID */ UPDATE t1 SET c=1 WHERE a=7;
/* GTID */ DROP TEMPORARY TABLE t3;
/* GTID */ COMMIT;
/* GTID */ CREATE TEMPORARY TABLE t4 (a INT PRIMARY KEY) ENGINE=InnoDB;
/* GTID */ BEGIN;
/* GTID */ INSERT INTO t1 VALUES (8, 5, 0);
/* GTID */ ALTER TABLE t4 ADD b INT;
/* GTID */ INSERT INTO t1 VALUES (9, 5, 1);
/* GTID */ COMMIT;
connect tmp_con,localhost,root,,;
/* GTID */ INSERT INTO t1 VALUES (10, 6, 0);
/* GTID */ BEGIN;
/* GTID */ CREATE TEMPORARY TABLE t5 (a INT PRIMARY KEY) ENGINE=InnoDB;
/* GTID */ INSERT INTO t1 VALUES (11, 7, 0);
/* GTID */ COMMIT;
disconnect tmp_con;
connection default;
FLUSH LOGS;
# server id 1 end_log_pos # CRC32 0x######## GTID #-#-# trans thread_id=#
START TRANSACTION
/* GTID */ INSERT INTO t1 VALUES (1,0)
COMMIT/*!*/;
# server id 1 end_log_pos # CRC32 0x######## GTID #-#-# trans thread_id=#
START TRANSACTION
/* GTID */ INSERT INTO t1 VALUES (2,0)
COMMIT/*!*/;
# server id 1 end_log_pos # CRC32 0x######## GTID #-#-# ddl thread_id=#
/* GTID */ ALTER TABLE t1 ADD c INT
# server id 1 end_log_pos # CRC32 0x######## GTID #-#-# trans thread_id=#
START TRANSACTION
/* GTID */ INSERT INTO t1 VALUES (3,0,0)
COMMIT/*!*/;
# server id 1 end_log_pos # CRC32 0x######## GTID #-#-# trans thread_id=#
START TRANSACTION
/* GTID */ UPDATE t1 SET b=1, c=1 WHERE a=2
#Q> /* GTID */ INSERT INTO t1 SELECT a, 2, b FROM t2
# server id 1 end_log_pos # CRC32 0x######## Table_map: `test`.`t1` mapped to number #
# server id 1 end_log_pos # CRC32 0x######## Write_rows: table id # flags: STMT_END_F
/* GTID */ INSERT INTO t1 VALUES (6, 3, 0)
COMMIT/*!*/;
# server id 1 end_log_pos # CRC32 0x######## GTID #-#-# trans thread_id=#
START TRANSACTION
/* GTID */ DELETE FROM t1 WHERE a=5
#Q> /* GTID */ INSERT INTO t1 SELECT a, 4, 0 FROM t3
# server id 1 end_log_pos # CRC32 0x######## Table_map: `test`.`t1` mapped to number #
# server id 1 end_log_pos # CRC32 0x######## Write_rows: table id # flags: STMT_END_F
/* GTID */ UPDATE t1 SET c=1 WHERE a=7
COMMIT/*!*/;
# server id 1 end_log_pos # CRC32 0x######## GTID #-#-# trans thread_id=#
START TRANSACTION
/* GTID */ INSERT INTO t1 VALUES (8, 5, 0)
COMMIT/*!*/;
# server id 1 end_log_pos # CRC32 0x######## GTID #-#-# trans thread_id=#
START TRANSACTION
/* GTID */ INSERT INTO t1 VALUES (9, 5, 1)
COMMIT/*!*/;
# server id 1 end_log_pos # CRC32 0x######## GTID #-#-# trans thread_id=#
START TRANSACTION
/* GTID */ INSERT INTO t1 VALUES (10, 6, 0)
COMMIT/*!*/;
# server id 1 end_log_pos # CRC32 0x######## GTID #-#-# trans thread_id=#
START TRANSACTION
/* GTID */ INSERT INTO t1 VALUES (11, 7, 0)
COMMIT/*!*/;
DROP TABLE t1;

View File

@@ -57,7 +57,7 @@ START TRANSACTION
/* GTID */ CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB /* GTID */ CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB
/* GTID */ INSERT INTO t2 VALUES (4,10), (5,20) /* GTID */ INSERT INTO t2 VALUES (4,10), (5,20)
/* GTID */ INSERT INTO t1 SELECT a, 2, b FROM t2 /* GTID */ INSERT INTO t1 SELECT a, 2, b FROM t2
DROP TEMPORARY TABLE `t2` /* generated by server */ DROP TEMPORARY TABLE IF EXISTS `test`.`t2` /* generated by server */
/* GTID */ INSERT INTO t1 VALUES (6, 3, 0) /* GTID */ INSERT INTO t1 VALUES (6, 3, 0)
COMMIT/*!*/; COMMIT/*!*/;
# server id 1 end_log_pos # CRC32 0x######## GTID #-#-# ddl thread_id=# # server id 1 end_log_pos # CRC32 0x######## GTID #-#-# ddl thread_id=#
@@ -68,7 +68,7 @@ START TRANSACTION
/* GTID */ INSERT INTO t3 VALUES (7) /* GTID */ INSERT INTO t3 VALUES (7)
/* GTID */ INSERT INTO t1 SELECT a, 4, 0 FROM t3 /* GTID */ INSERT INTO t1 SELECT a, 4, 0 FROM t3
/* GTID */ UPDATE t1 SET c=1 WHERE a=7 /* GTID */ UPDATE t1 SET c=1 WHERE a=7
DROP TEMPORARY TABLE `t3` /* generated by server */ DROP TEMPORARY TABLE IF EXISTS `test`.`t3` /* generated by server */
COMMIT/*!*/; COMMIT/*!*/;
# server id 1 end_log_pos # CRC32 0x######## GTID #-#-# ddl thread_id=# # server id 1 end_log_pos # CRC32 0x######## GTID #-#-# ddl thread_id=#
/* GTID */ CREATE TEMPORARY TABLE t4 (a INT PRIMARY KEY) ENGINE=InnoDB /* GTID */ CREATE TEMPORARY TABLE t4 (a INT PRIMARY KEY) ENGINE=InnoDB
@@ -92,5 +92,5 @@ START TRANSACTION
/* GTID */ INSERT INTO t1 VALUES (11, 7, 0) /* GTID */ INSERT INTO t1 VALUES (11, 7, 0)
COMMIT/*!*/; COMMIT/*!*/;
# server id 1 end_log_pos # CRC32 0x######## GTID #-#-# ddl thread_id=# # server id 1 end_log_pos # CRC32 0x######## GTID #-#-# ddl thread_id=#
DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t5` DROP TEMPORARY TABLE IF EXISTS `t5` /* generated by server */
DROP TABLE t1; DROP TABLE t1;

View File

@@ -840,6 +840,9 @@ id
drop table t1; drop table t1;
create table t1 (a int); create table t1 (a int);
create table if not exists t2 select * from t1; create table if not exists t2 select * from t1;
select @@binlog_format;
@@binlog_format
ROW
create temporary table tt1 (a int); create temporary table tt1 (a int);
create table if not exists t3 like tt1; create table if not exists t3 like tt1;
USE mysql; USE mysql;

View File

@@ -1,4 +1,10 @@
DROP DATABASE IF EXISTS `drop-temp+table-test`; DROP DATABASE IF EXISTS `drop-temp+table-test`;
select @@session.binlog_format;
@@session.binlog_format
ROW
select @@session.create_tmp_table_binlog_formats;
@@session.create_tmp_table_binlog_formats
STATEMENT
connect con1,localhost,root,,; connect con1,localhost,root,,;
connect con2,localhost,root,,; connect con2,localhost,root,,;
connection con1; connection con1;

View File

@@ -359,11 +359,6 @@ COERCIBILITY(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) d2,
COERCIBILITY(s1) d3; COERCIBILITY(s1) d3;
DROP TEMPORARY TABLE tmp1; DROP TEMPORARY TABLE tmp1;
END END
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `bug39182`; CREATE TEMPORARY TABLE tmp1
SELECT * FROM t1 WHERE a LIKE CONCAT("%", NAME_CONST('s1',_utf8mb3'test' COLLATE 'utf8mb3_unicode_ci'), "%")
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `bug39182`; DROP TEMPORARY TABLE `tmp1` /* generated by server */
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP TABLE t1; DROP TABLE t1;
DROP DATABASE bug39182; DROP DATABASE bug39182;
@@ -446,6 +441,9 @@ id
drop table t1; drop table t1;
create table t1 (a int); create table t1 (a int);
create table if not exists t2 select * from t1; create table if not exists t2 select * from t1;
select @@binlog_format;
@@binlog_format
MIXED
create temporary table tt1 (a int); create temporary table tt1 (a int);
create table if not exists t3 like tt1; create table if not exists t3 like tt1;
USE mysql; USE mysql;
@@ -495,9 +493,9 @@ master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table if not exists t2 select * from t1 master-bin.000001 # Query # # use `test`; create table if not exists t2 select * from t1
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int) master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t3` (
master-bin.000001 # Gtid # # GTID #-#-# `a` int(11) DEFAULT NULL
master-bin.000001 # Query # # use `test`; create table if not exists t3 like tt1 ) ENGINE=MyISAM
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `mysql`; INSERT db SET host='localhost', user='@#@', db='Just a test' master-bin.000001 # Query # # use `mysql`; INSERT db SET host='localhost', user='@#@', db='Just a test'
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
@@ -507,7 +505,6 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `mysql`; DELETE FROM db WHERE host='localhost' AND user='@#@' master-bin.000001 # Query # # use `mysql`; DELETE FROM db WHERE host='localhost' AND user='@#@'
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Rotate # # master-bin.000002;pos=POS
drop table t1,t2,t3,tt1; drop table t1,t2,t3,tt1;
reset master; reset master;
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;

View File

@@ -1,4 +1,10 @@
DROP DATABASE IF EXISTS `drop-temp+table-test`; DROP DATABASE IF EXISTS `drop-temp+table-test`;
select @@session.binlog_format;
@@session.binlog_format
STATEMENT
select @@session.create_tmp_table_binlog_formats;
@@session.create_tmp_table_binlog_formats
STATEMENT
connect con1,localhost,root,,; connect con1,localhost,root,,;
connect con2,localhost,root,,; connect con2,localhost,root,,;
connection con1; connection con1;
@@ -53,7 +59,7 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-te
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp1` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE `tmp3` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp3` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp2` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
@@ -61,7 +67,7 @@ master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `tmp2`,`t` /* generated by server */ master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `tmp2`,`t` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1` master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `shortn2`,`table:name`,`shortn1` /* generated by server */
DROP DATABASE `drop-temp+table-test`; DROP DATABASE `drop-temp+table-test`;
RESET MASTER; RESET MASTER;
CREATE TABLE t1 ( i text ); CREATE TABLE t1 ( i text );
@@ -86,7 +92,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `ttmp1` master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `ttmp1` /* generated by server */
RESET MASTER; RESET MASTER;
DROP TABLE t1; DROP TABLE t1;
# #

View File

@@ -313,7 +313,7 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t2 (n int) engine=innodb master-bin.000001 # Query # # use `test`; create table t2 (n int) engine=innodb
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t1`,`ti` master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t1`,`ti` /* generated by server */
do release_lock("lock1"); do release_lock("lock1");
drop table t0,t2; drop table t0,t2;
set autocommit=0; set autocommit=0;
@@ -446,7 +446,7 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO t2 values (100,100) master-bin.000001 # Query # # use `test`; INSERT INTO t2 values (100,100)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `t2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t2` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
connect con4,localhost,root,,; connect con4,localhost,root,,;

View File

@@ -50,11 +50,13 @@ connect con2,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
connection con1; connection con1;
create database b51226; create database b51226;
use b51226; use b51226;
set @@binlog_format="statement";
create temporary table t1(i int); create temporary table t1(i int);
connection con2; connection con2;
use b51226; use b51226;
create temporary table t1(i int); create temporary table t1(i int);
connection con1; connection con1;
set @@binlog_format="statement";
create temporary table t1(i int); create temporary table t1(i int);
ERROR 42S01: Table 't1' already exists ERROR 42S01: Table 't1' already exists
disconnect con1; disconnect con1;

View File

@@ -9,6 +9,9 @@ set binlog_format=statement;
source include/database.test; source include/database.test;
set binlog_format=mixed; set binlog_format=mixed;
source include/database.test; source include/database.test;
set binlog_format=mixed;
SET @@create_tmp_table_binlog_formats="mixed";
source include/database.test;
set binlog_format=row; set binlog_format=row;
source include/database.test; source include/database.test;

View File

@@ -31,6 +31,43 @@ CREATE TEMPORARY SEQUENCE seq_2;
# Cleanup # Cleanup
XA ROLLBACK '3'; XA ROLLBACK '3';
DROP SEQUENCE seq_1;
DROP TABLE tmp_1;
--echo # Proof of correct logging incl empty XA-PREPARE
--source include/show_binlog_events.inc
SET @@binlog_format="statement";
RESET MASTER; # clear binlogs
# MDEV-22420 DDL on temporary object is prohibited when XA is in prepare state
# Temporary sequnce may not be created within a transaction
CREATE TEMPORARY SEQUENCE seq_1;
XA START '3';
CREATE TEMPORARY TABLE tmp_1(c INT);
XA END '3';
XA PREPARE '3';
--error ER_XAER_RMFAIL
DROP TEMPORARY TABLE tmp_1;
--error ER_XAER_RMFAIL
ALTER TABLE tmp_1 DROP COLUMN c;
--error ER_XAER_RMFAIL
DROP TEMPORARY SEQUENCE seq_1;
--error ER_XAER_RMFAIL
ALTER SEQUENCE seq_1 INCREMENT BY 1;
--error ER_XAER_RMFAIL
CREATE TEMPORARY TABLE tmp_2(c INT);
--error ER_XAER_RMFAIL
CREATE TEMPORARY SEQUENCE seq_2;
# Cleanup
XA ROLLBACK '3';
SET @@binlog_format="mixed";
--echo # Proof of correct logging incl empty XA-PREPARE --echo # Proof of correct logging incl empty XA-PREPARE
--source include/show_binlog_events.inc --source include/show_binlog_events.inc

View File

@@ -15,9 +15,14 @@ CREATE TEMPORARY TABLE t2 (a VARCHAR(100));
--echo # Test allow switching @@SESSION.binlog_format from MIXED to STATEMENT --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. --echo # when there are open temp tables and we are logging in statement based format.
--ERROR ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
SET SESSION binlog_format = STATEMENT; SET SESSION binlog_format = STATEMENT;
SELECT @@SESSION.binlog_format; SELECT @@SESSION.binlog_format;
DROP TABLE t2;
SET SESSION binlog_format = STATEMENT;
CREATE TEMPORARY TABLE t2 (a VARCHAR(100));
--echo # Test allow switching @@SESSION.binlog_format from STATEMENT to --echo # Test allow switching @@SESSION.binlog_format from STATEMENT to
--echo # STATEMENT when there are open temp tables. --echo # STATEMENT when there are open temp tables.
SET SESSION binlog_format = STATEMENT; SET SESSION binlog_format = STATEMENT;
@@ -35,6 +40,15 @@ SELECT @@SESSION.binlog_format;
SET SESSION binlog_format = MIXED; SET SESSION binlog_format = MIXED;
SELECT @@SESSION.binlog_format; SELECT @@SESSION.binlog_format;
--echo # Switching between mixed and row still works
SET SESSION binlog_format = STATEMENT;
SET SESSION binlog_format = MIXED;
--echo # Ensure that usage of t2 uses statement logging
SET SESSION binlog_format = MIXED;
insert into t1 select * from t2;
--echo # This will switch binlog format when using t2 to ROW
INSERT INTO t2 VALUES (UUID()); INSERT INTO t2 VALUES (UUID());
SELECT @@SESSION.binlog_format; SELECT @@SESSION.binlog_format;
@@ -71,6 +85,10 @@ INSERT INTO t1 VALUES ('row based');
SET SESSION binlog_format = STATEMENT; SET SESSION binlog_format = STATEMENT;
SELECT @@SESSION.binlog_format; SELECT @@SESSION.binlog_format;
--echo # Ensure that usage of t2 uses row logging
SET SESSION binlog_format = MIXED;
insert into t1 select * from t2;
DROP TEMPORARY TABLE t2; DROP TEMPORARY TABLE t2;
DROP TABLE t1; DROP TABLE t1;
source include/show_binlog_events.inc;

View File

@@ -0,0 +1,5 @@
# This is a wrapper for drop_table.test so that the same test case can be used
# For both statement and row based bin logs
-- source include/have_binlog_format_mixed.inc
-- source include/drop_temp_table.test

View File

@@ -0,0 +1,8 @@
# This is a wrapper for drop_table.test so that the same test case can be used
# For both statement and row based bin logs
-- source include/have_binlog_format_mixed.inc
set @@session.create_tmp_table_binlog_formats="MIXED";
set @@global.create_tmp_table_binlog_formats="MIXED";
-- source include/drop_temp_table.test
set @@global.create_tmp_table_binlog_formats=default;

View File

@@ -1,3 +1,3 @@
--source include/have_log_bin.inc --source include/have_log_bin.inc
--source include/have_binlog_format_mixed_or_statement.inc --source include/have_binlog_format_mixed.inc
--source include/binlog_parallel_replication_marks.test --source include/binlog_parallel_replication_marks.test

View File

@@ -0,0 +1,3 @@
--source include/have_log_bin.inc
--source include/have_binlog_format_statement.inc
--source include/binlog_parallel_replication_marks.test

View File

@@ -1,5 +1,7 @@
# This is a wrapper for drop_table.test so that the same test case can be used # This is a wrapper for drop_table.test so that the same test case can be used
# For both statement and row based bin logs # For both statement and row based bin logs
-- source include/have_binlog_format_mixed_or_statement.inc -- source include/have_binlog_format_statement.inc
-- source include/drop_table.test -- source include/drop_table.test

View File

@@ -1,5 +1,5 @@
# This is a wrapper for binlog.test so that the same test case can be used # This is a wrapper for binlog.test so that the same test case can be used
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/have_binlog_format_mixed_or_statement.inc -- source include/have_binlog_format_statement.inc
-- source include/drop_temp_table.test -- source include/drop_temp_table.test

View File

@@ -109,6 +109,7 @@ connect (con2,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
-- connection con1 -- connection con1
-- eval create database $dbname -- eval create database $dbname
-- eval use $dbname -- eval use $dbname
set @@binlog_format="statement";
create temporary table t1(i int); create temporary table t1(i int);
# #
@@ -130,6 +131,7 @@ create temporary table t1(i int);
# in its header). # in its header).
-- connection con1 -- connection con1
set @@binlog_format="statement";
-- error 1050 -- error 1050
create temporary table t1(i int); create temporary table t1(i int);
-- disconnect con1 -- disconnect con1

View File

@@ -1,5 +1,6 @@
SET sql_log_bin = 0; SET sql_log_bin = 0;
SET sql_log_bin = 1; SET sql_log_bin = 1;
set @@binlog_format="statement";
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
connection slave; connection slave;

View File

@@ -2,6 +2,14 @@
--source include/have_sequence.inc --source include/have_sequence.inc
--source include/no_valgrind_without_big.inc --source include/no_valgrind_without_big.inc
#
# Note that this test may fail with an error from check-mysqld_1
# where it complains that INNODB_LOG_FILE_BUFFERING changed from
# OFF to ON.
# This error happens if the disk used for storing the innodb log
# files gets full
#
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err; let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
SET GLOBAL innodb_log_file_size=4194304; SET GLOBAL innodb_log_file_size=4194304;

View File

@@ -958,6 +958,20 @@ while (`SELECT HEX(@commands) != HEX('')`)
# due to BUG#13692513. # due to BUG#13692513.
--connection server_1 --connection server_1
--source include/show_binlog_events.inc --source include/show_binlog_events.inc
connection master;
let $master_tt_xx_count=`select count(*) from tt_xx_1`;
let $master_nt_xx_count=`select count(*) from nt_xx_1`;
sync_slave_with_master;
let $slave_tt_xx_count=`select count(*) from tt_xx_1`;
let $slave_nt_xx_count=`select count(*) from nt_xx_1`;
if ($slave_tt_xx_count != $master_tt_xx_count)
{
--echo # Error: Data mismatch in tt_xx_1: Master: $master_tt_xx_count rows Slave: $slave_tt_xx_count rows
}
if ($slave_nt_xx_count != $master_nt_xx_count)
{
--echo # Error: Data mismatch in nt_xx_1: Master: $master_nt_xx_count rows Slave: $slave_nt_xx_count rows
}
--connection master --connection master
--echo -e-e-e-e-e-e-e-e-e-e-e- >> $commands << -e-e-e-e-e-e-e-e-e-e-e- --echo -e-e-e-e-e-e-e-e-e-e-e- >> $commands << -e-e-e-e-e-e-e-e-e-e-e-
--echo --echo
@@ -1038,6 +1052,8 @@ while (`SELECT HEX(@commands) != HEX('')`)
} }
--dec $n --dec $n
} }
truncate table tt_xx_1;
truncate table nt_xx_1;
--enable_warnings --enable_warnings
let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1); let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1);

View File

@@ -617,6 +617,26 @@ while ($commands != '')
# due to BUG#13692513. # due to BUG#13692513.
--connection server_1 --connection server_1
--source include/show_binlog_events.inc --source include/show_binlog_events.inc
sync_slave_with_master;
--let $n= $6
while ($n)
{
connection master;
let $master_tt_xx_count=`select count(*) from nt_$n`;
let $master_nt_xx_count=`select count(*) from tt_$n`;
connection server_2;
let $slave_tt_xx_count=`select count(*) from nt_$n`;
let $slave_nt_xx_count=`select count(*) from tt_$n`;
if ($slave_tt_xx_count != $master_tt_xx_count)
{
--echo # Error: Data mismatch in tt_$n: Master: $master_tt_xx_count rows Slave: $slave_tt_xx_count rows
}
if ($slave_nt_xx_count != $master_nt_xx_count)
{
--echo # Error: Data mismatch in nt_$n: Master: $master_nt_xx_count rows Slave: $slave_nt_xx_count rows
}
dec $n;
}
--connection master --connection master
--echo -e-e-e-e-e-e-e-e-e-e-e- >> $command << -e-e-e-e-e-e-e-e-e-e-e- --echo -e-e-e-e-e-e-e-e-e-e-e- >> $command << -e-e-e-e-e-e-e-e-e-e-e-
} }

View File

@@ -1,4 +1,15 @@
include/rpl_init.inc [topology=1->2] include/rpl_init.inc [topology=1->2]
select @@binlog_format, @@create_tmp_table_binlog_formats;
@@binlog_format @@create_tmp_table_binlog_formats
MIXED STATEMENT
connection server_2;
set @@global.create_tmp_table_binlog_formats='STATEMENT';
include/stop_slave.inc
include/start_slave.inc
connection server_1;
#
# Create help tables
#
create table t2 (a int) engine=myisam; create table t2 (a int) engine=myisam;
insert into t2 values (0),(1),(2),(2); insert into t2 values (0),(1),(2),(2);
create temporary table t3 (a_in_temporary int) engine=myisam; create temporary table t3 (a_in_temporary int) engine=myisam;
@@ -22,15 +33,15 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t2 values (0),(1),(2),(2) master-bin.000001 # Query # # use `test`; insert into t2 values (0),(1),(2),(2)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t3 (a_in_temporary int) engine=myisam
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 AS SELECT 1 AS f1 master-bin.000001 # Query # # use `test`; CREATE TABLE t1 AS SELECT 1 AS f1
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 AS SELECT 2 AS f1 master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 AS SELECT 2 AS f1
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t2 master-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t2
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t3 master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` (
`a_in_temporary` int(11) DEFAULT NULL
) ENGINE=MyISAM
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
connection server_2; connection server_2;
@@ -43,8 +54,6 @@ slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; insert into t2 values (0),(1),(2),(2) slave-bin.000001 # Query # # use `test`; insert into t2 values (0),(1),(2),(2)
slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create temporary table t3 (a_in_temporary int) engine=myisam
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (to_be_deleted int) slave-bin.000001 # Query # # use `test`; create table t1 (to_be_deleted int)
slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 AS SELECT 1 AS f1 slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 AS SELECT 1 AS f1
@@ -53,7 +62,9 @@ slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 AS SELECT 2
slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t2 slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t2
slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t3 slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` (
`a_in_temporary` int(11) DEFAULT NULL
) ENGINE=MyISAM
slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
connection server_1; connection server_1;
@@ -87,10 +98,6 @@ master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int) master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t1`/* Generated to handle failed CREATE OR REPLACE */ master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t1`/* Generated to handle failed CREATE OR REPLACE */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t9 (a int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t9`/* Generated to handle failed CREATE OR REPLACE */
connection server_2; connection server_2;
show tables; show tables;
Tables_in_test Tables_in_test
@@ -159,7 +166,7 @@ slave-bin.000001 # Query # # use `test`; create table t4 (server_2_to_be_delete
slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (new_table int) slave-bin.000001 # Query # # use `test`; create table t1 (new_table int)
slave-bin.000001 # Gtid # # BEGIN GTID #-#-# slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t2` ( slave-bin.000001 # Query # # use `test`; CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) )
slave-bin.000001 # Annotate_rows # # create table t2 select * from t9 slave-bin.000001 # Annotate_rows # # create table t2 select * from t9
@@ -271,14 +278,13 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t5 (a int) master-bin.000001 # Query # # use `test`; create temporary table t5 (a int)
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `t5` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t5` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t7 (a int) master-bin.000001 # Query # # use `test`; create temporary table t7 (a int)
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t7` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t7` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t9 (i int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t9`
drop table t2; drop table t2;
connection server_2;
set @@global.create_tmp_table_binlog_formats=default;
connection server_1;
include/rpl_end.inc include/rpl_end.inc

View File

@@ -0,0 +1,301 @@
set @@global.create_tmp_table_binlog_formats="mixed";
set @@session.create_tmp_table_binlog_formats="mixed";
include/rpl_init.inc [topology=1->2]
select @@binlog_format, @@create_tmp_table_binlog_formats;
@@binlog_format @@create_tmp_table_binlog_formats
MIXED MIXED,STATEMENT
connection server_2;
set @@global.create_tmp_table_binlog_formats='MIXED,STATEMENT';
include/stop_slave.inc
include/start_slave.inc
connection server_1;
#
# Create help tables
#
create table t2 (a int) engine=myisam;
insert into t2 values (0),(1),(2),(2);
create temporary table t3 (a_in_temporary int) engine=myisam;
#
# Check how create table and create or replace table are logged
#
connection server_2;
create table t1 (to_be_deleted int);
connection server_1;
CREATE TABLE t1 AS SELECT 1 AS f1;
CREATE OR REPLACE TABLE t1 AS SELECT 2 AS f1;
CREATE OR REPLACE table t1 like t2;
CREATE OR REPLACE table t1 like t3;
drop table t1;
binlog from server 1
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t2 (a int) engine=myisam
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t2 values (0),(1),(2),(2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t3 (a_in_temporary int) engine=myisam
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 AS SELECT 1 AS f1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 AS SELECT 2 AS f1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t2
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t3
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
connection server_2;
binlog from server 2
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t2 (a int) engine=myisam
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; insert into t2 values (0),(1),(2),(2)
slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create temporary table t3 (a_in_temporary int) engine=myisam
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (to_be_deleted int)
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 AS SELECT 1 AS f1
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 AS SELECT 2 AS f1
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t2
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t3
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
connection server_1;
#
# Ensure that also failed create_or_replace are logged
#
create table t1 (a int);
create or replace table t1;
ERROR 42000: A table must have at least 1 column
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
create or replace table t1 (a int primary key) select a from t2;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
create table t1 (a int);
create or replace table t1 (a int primary key) select a from t2;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
create temporary table t9 (a int);
create or replace temporary table t9 (a int primary key) select a from t2;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
binlog from server 1
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create or replace table t1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t1`/* Generated to handle failed CREATE OR REPLACE */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t9 (a int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t9`/* Generated to handle failed CREATE OR REPLACE */
connection server_2;
show tables;
Tables_in_test
t2
connection server_1;
create table t1 (a int);
create or replace table t1 (a int, a int) select * from t2;
ERROR 42S21: Duplicate column name 'a'
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t1`/* Generated to handle failed CREATE OR REPLACE */
drop table if exists t1,t2;
Warnings:
Note 1051 Unknown table 'test.t1'
drop temporary table if exists t9;
Warnings:
Note 1051 Unknown table 'test.t9'
#
# Ensure that CREATE are run as CREATE OR REPLACE on slave
#
connection server_2;
create table t1 (server_2_to_be_delete int);
connection server_1;
create table t1 (new_table int);
connection server_2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`new_table` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
connection server_1;
drop table t1;
#
# Check how CREATE is logged on slave in case of conflicts
#
connection server_2;
create table t1 (server_2_to_be_delete int);
create table t2 (server_2_to_be_delete int);
create table t4 (server_2_to_be_delete int);
set @org_binlog_format=@@binlog_format;
set @@global.binlog_format="ROW";
stop slave;
include/wait_for_slave_to_stop.inc
start slave;
include/wait_for_slave_to_start.inc
connection server_1;
create temporary table t9 (a int);
insert into t9 values(1);
create table t1 (new_table int);
create table t2 select * from t9;
create table t4 like t9;
create table t5 select * from t9;
connection server_2;
binlog from server 2
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (server_2_to_be_delete int)
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t2 (server_2_to_be_delete int)
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t4 (server_2_to_be_delete int)
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (new_table int)
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t2` (
`a` int(11) DEFAULT NULL
)
slave-bin.000001 # Annotate_rows # # create table t2 select * from t9
slave-bin.000001 # Table_map # # table_id: # (test.t2)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE TABLE `t4` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE TABLE `t5` (
`a` int(11) DEFAULT NULL
)
slave-bin.000001 # Annotate_rows # # create table t5 select * from t9
slave-bin.000001 # Table_map # # table_id: # (test.t5)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT
set @@global.binlog_format=@org_binlog_format;
stop slave;
include/wait_for_slave_to_stop.inc
start slave;
include/wait_for_slave_to_start.inc
connection server_1;
drop table t1,t2,t4,t5,t9;
#
# Ensure that DROP TABLE is run as DROP IF NOT EXISTS
#
create table t1 (server_1_ver_1 int);
create table t4 (server_1_ver_2 int);
connection server_2;
drop table t1;
connection server_1;
drop table t1,t4;
create table t1 (server_2_ver_2 int);
connection server_2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`server_2_ver_2` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
binlog from server 2
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t4` /* generated by server */
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (server_2_ver_2 int)
connection server_1;
drop table t1;
#
# Ensure that CREATE ... SELECT is recorded as one GTID on the slave
#
connection server_2;
connection server_1;
create table t1 (a int);
insert into t1 values (0),(1),(2);
create table t2 engine=myisam select * from t1;
create or replace table t2 engine=innodb select * from t1;
connection server_2;
binlog from server 2
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (a int)
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; insert into t1 values (0),(1),(2)
slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t2 engine=myisam select * from t1
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create or replace table t2 engine=innodb select * from t1
connection server_1;
drop table t1;
#
# Check logging of drop temporary table
#
drop temporary table t3;
set @org_binlog_format=@@binlog_format;
set binlog_format="STATEMENT";
create temporary table t5 (a int);
drop temporary table t5;
set binlog_format="ROW";
create temporary table t6 (a int);
drop temporary table t6;
set binlog_format="STATEMENT";
create temporary table t7 (a int);
set binlog_format="ROW";
drop temporary table t7;
create temporary table t8 (a int);
set binlog_format="STATEMENT";
ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables
drop temporary table t8;
set @@binlog_format=@org_binlog_format;
set @@session.binlog_format=default;
drop temporary table if exists t9;
Warnings:
Note 1051 Unknown table 'test.t9'
connect con1,localhost,root,,;
set session binlog_format=default;
create temporary table t9 (i int);
*** Must be no DROP logged for t9 when there was no CREATE, at disconnect too ***
disconnect con1;
connection server_1;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t5 (a int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t5` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t7 (a int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t7` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t9 (i int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t9` /* generated by server */
drop table t2;
connection server_2;
set @@global.create_tmp_table_binlog_formats=default;
connection server_1;
include/rpl_end.inc
set @@global.create_tmp_table_binlog_formats=default;

View File

@@ -1,4 +1,15 @@
include/rpl_init.inc [topology=1->2] include/rpl_init.inc [topology=1->2]
select @@binlog_format, @@create_tmp_table_binlog_formats;
@@binlog_format @@create_tmp_table_binlog_formats
ROW STATEMENT
connection server_2;
set @@global.create_tmp_table_binlog_formats='STATEMENT';
include/stop_slave.inc
include/start_slave.inc
connection server_1;
#
# Create help tables
#
create table t2 (a int) engine=myisam; create table t2 (a int) engine=myisam;
insert into t2 values (0),(1),(2),(2); insert into t2 values (0),(1),(2),(2);
create temporary table t3 (a_in_temporary int) engine=myisam; create temporary table t3 (a_in_temporary int) engine=myisam;
@@ -311,10 +322,13 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t5 (a int) master-bin.000001 # Query # # use `test`; create temporary table t5 (a int)
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `t5` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t5` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t7 (a int) master-bin.000001 # Query # # use `test`; create temporary table t7 (a int)
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t7` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t7` /* generated by server */
drop table t2; drop table t2;
connection server_2;
set @@global.create_tmp_table_binlog_formats=default;
connection server_1;
include/rpl_end.inc include/rpl_end.inc

View File

@@ -1,4 +1,15 @@
include/rpl_init.inc [topology=1->2] include/rpl_init.inc [topology=1->2]
select @@binlog_format, @@create_tmp_table_binlog_formats;
@@binlog_format @@create_tmp_table_binlog_formats
STATEMENT STATEMENT
connection server_2;
set @@global.create_tmp_table_binlog_formats='STATEMENT';
include/stop_slave.inc
include/start_slave.inc
connection server_1;
#
# Create help tables
#
create table t2 (a int) engine=myisam; create table t2 (a int) engine=myisam;
insert into t2 values (0),(1),(2),(2); insert into t2 values (0),(1),(2),(2);
create temporary table t3 (a_in_temporary int) engine=myisam; create temporary table t3 (a_in_temporary int) engine=myisam;
@@ -271,7 +282,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t5 (a int) master-bin.000001 # Query # # use `test`; create temporary table t5 (a int)
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `t5` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t5` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t7 (a int) master-bin.000001 # Query # # use `test`; create temporary table t7 (a int)
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
@@ -279,6 +290,9 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t7` /* gene
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t9 (i int) master-bin.000001 # Query # # use `test`; create temporary table t9 (i int)
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t9` master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t9` /* generated by server */
drop table t2; drop table t2;
connection server_2;
set @@global.create_tmp_table_binlog_formats=default;
connection server_1;
include/rpl_end.inc include/rpl_end.inc

View File

@@ -44,6 +44,7 @@ SHOW STATUS LIKE 'Slave_open_temp_tables';
Variable_name Value Variable_name Value
Slave_open_temp_tables 0 Slave_open_temp_tables 0
connect con1,localhost,root,,; connect con1,localhost,root,,;
set @@CREATE_TMP_TABLE_BINLOG_FORMATS="mixed";
CREATE TEMPORARY TABLE ttmp1 ( i INT ); CREATE TEMPORARY TABLE ttmp1 ( i INT );
SET SESSION binlog_format=ROW; SET SESSION binlog_format=ROW;
disconnect con1; disconnect con1;
@@ -60,6 +61,6 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE t1 ( i INT )
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE ttmp1 ( i INT ) master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE ttmp1 ( i INT )
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `ttmp1` master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `ttmp1` /* generated by server */
DROP TABLE t1; DROP TABLE t1;
include/rpl_end.inc include/rpl_end.inc

View File

@@ -76,6 +76,7 @@ DELETE FROM t1 WHERE a=200;
SET SESSION gtid_domain_id= 202; SET SESSION gtid_domain_id= 202;
DROP TEMPORARY TABLE t2; DROP TEMPORARY TABLE t2;
SET SESSION binlog_format= mixed; SET SESSION binlog_format= mixed;
SET SESSION create_tmp_table_binlog_formats="mixed";
SET SESSION gtid_domain_id= 0; SET SESSION gtid_domain_id= 0;
CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (1);

File diff suppressed because it is too large Load Diff

View File

@@ -282,19 +282,13 @@ master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP INDEX ix ON tt_1 master-bin.000001 # Query # # use `test`; DROP INDEX ix ON tt_1
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (11) master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (11)
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx (a int)
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (10) master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (10)
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; ALTER TABLE tt_xx ADD COLUMN (b int)
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (9) master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (9)
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; ALTER TABLE tt_xx RENAME new_tt_xx
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (8) master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (8)
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`new_tt_xx` /* generated by server */
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (7) master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (7)
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#

View File

@@ -1,5 +1,7 @@
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
set @@global.create_tmp_table_binlog_formats="mixed";
set @@session.create_tmp_table_binlog_formats="mixed";
######################################################################### #########################################################################
# CONFIGURATION # CONFIGURATION
######################################################################### #########################################################################
@@ -13315,4 +13317,6 @@ DROP FUNCTION fc_i_tt_5_suc;
DROP FUNCTION fc_i_nt_5_suc; DROP FUNCTION fc_i_nt_5_suc;
DROP FUNCTION fc_i_nt_3_tt_3_suc; DROP FUNCTION fc_i_nt_3_tt_3_suc;
connection slave; connection slave;
connection server_1;
set @@global.create_tmp_table_binlog_formats=default;
include/rpl_end.inc include/rpl_end.inc

View File

@@ -13859,4 +13859,6 @@ DROP FUNCTION fc_i_tt_5_suc;
DROP FUNCTION fc_i_nt_5_suc; DROP FUNCTION fc_i_nt_5_suc;
DROP FUNCTION fc_i_nt_3_tt_3_suc; DROP FUNCTION fc_i_nt_3_tt_3_suc;
connection slave; connection slave;
connection server_1;
SET @@global.create_tmp_table_binlog_formats=default;
include/rpl_end.inc include/rpl_end.inc

View File

@@ -259,17 +259,17 @@ connection master;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `database_master_temp_01`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_01_01_temp` master-bin.000001 # Query # # use `database_master_temp_01`; DROP TEMPORARY TABLE IF EXISTS `t_01_01_temp` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `database_master_temp_02`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_02_02_temp`,`t_02_01_temp` master-bin.000001 # Query # # use `database_master_temp_02`; DROP TEMPORARY TABLE IF EXISTS `t_02_02_temp`,`t_02_01_temp` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `database_master_temp_01`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_01_01_temp` master-bin.000001 # Query # # use `database_master_temp_01`; DROP TEMPORARY TABLE IF EXISTS `t_01_01_temp` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `database_master_temp_03`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_03_03_temp`,`t_03_02_temp`,`t_03_01_temp` master-bin.000001 # Query # # use `database_master_temp_03`; DROP TEMPORARY TABLE IF EXISTS `t_03_03_temp`,`t_03_02_temp`,`t_03_01_temp` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `database_master_temp_02`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_02_02_temp`,`t_02_01_temp` master-bin.000001 # Query # # use `database_master_temp_02`; DROP TEMPORARY TABLE IF EXISTS `t_02_02_temp`,`t_02_01_temp` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `database_master_temp_01`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_01_01_temp` master-bin.000001 # Query # # use `database_master_temp_01`; DROP TEMPORARY TABLE IF EXISTS `t_01_01_temp` /* generated by server */
**** ****
**** Cleaning up the test case **** Cleaning up the test case
**** ****
@@ -289,4 +289,6 @@ DROP DATABASE y;
SET sql_log_bin= 1; SET sql_log_bin= 1;
connection master; connection master;
connection slave; connection slave;
connection default;
set @@global.create_tmp_table_binlog_formats=default;
include/rpl_end.inc include/rpl_end.inc

View File

@@ -66,7 +66,7 @@ DROP TEMPORARY TABLE tt_tmp_2;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-N-Temp'; SET @commands= 'Drop-Temp-N-Temp';
@@ -75,7 +75,7 @@ DROP TEMPORARY TABLE nt_tmp_2;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-Xe-Temp'; SET @commands= 'Drop-Temp-Xe-Temp';
@@ -100,7 +100,7 @@ ERROR 42S02: Unknown table 'test.tt_1'
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-If-TXe-Temp'; SET @commands= 'Drop-Temp-If-TXe-Temp';
@@ -121,7 +121,7 @@ ERROR 42S02: Unknown table 'test.tt_1'
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-If-NXe-Temp'; SET @commands= 'Drop-Temp-If-NXe-Temp';
@@ -141,9 +141,9 @@ DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-TT-Temp'; SET @commands= 'Drop-Temp-TT-Temp';
@@ -152,7 +152,7 @@ DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1`,`test`.`tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TT-Temp << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TT-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-NN-Temp'; SET @commands= 'Drop-Temp-NN-Temp';
@@ -161,7 +161,7 @@ DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1`,`test`.`nt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NN-Temp << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
@@ -178,7 +178,7 @@ include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -197,8 +197,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -211,7 +211,7 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
@@ -229,13 +229,13 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
@@ -324,7 +324,7 @@ include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -345,8 +345,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -400,7 +400,7 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
@@ -420,13 +420,13 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
@@ -488,11 +488,11 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -507,18 +507,18 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -532,7 +532,7 @@ include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1`,`test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -550,7 +550,7 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1`,`test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -563,7 +563,7 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1`,`test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
@@ -580,7 +580,7 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1`,`test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
@@ -602,7 +602,7 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1`,`test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
@@ -627,7 +627,7 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1`,`test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
@@ -649,7 +649,7 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1`,`test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
@@ -676,7 +676,7 @@ include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -697,8 +697,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -711,7 +711,7 @@ ROLLBACK;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
@@ -731,13 +731,13 @@ Warning # Some non-transactional changed tables couldn't be rolled back
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
@@ -830,7 +830,7 @@ include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -853,8 +853,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -910,7 +910,7 @@ ROLLBACK;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
@@ -932,13 +932,13 @@ Warning # Some non-transactional changed tables couldn't be rolled back
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
@@ -1002,11 +1002,11 @@ ROLLBACK;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1023,18 +1023,18 @@ Warning # Some non-transactional changed tables couldn't be rolled back
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1048,7 +1048,7 @@ include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1`,`test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1068,7 +1068,7 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1`,`test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1081,7 +1081,7 @@ ROLLBACK;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1`,`test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
@@ -1100,7 +1100,7 @@ Warning # Some non-transactional changed tables couldn't be rolled back
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1`,`test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
@@ -1124,7 +1124,7 @@ Warning # Some non-transactional changed tables couldn't be rolled back
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1`,`test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
@@ -1151,7 +1151,7 @@ Warning # Some non-transactional changed tables couldn't be rolled back
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1`,`test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
@@ -1175,7 +1175,7 @@ Warning # Some non-transactional changed tables couldn't be rolled back
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1`,`test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
@@ -1307,9 +1307,9 @@ DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1320,9 +1320,9 @@ DROP TABLE tt_tmp_2, nt_tmp_2;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1501,9 +1501,9 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1519,9 +1519,9 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
######################################################################### #########################################################################
@@ -1541,13 +1541,13 @@ DROP TEMPORARY TABLE nt_tmp_2;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp'; SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp';
@@ -1559,13 +1559,13 @@ DROP TEMPORARY TABLE tt_tmp_2;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1584,16 +1584,16 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
@@ -1611,10 +1611,10 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1634,10 +1634,10 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_error_1() VALUES (5), (5) master-bin.000001 # Query # # use `test`; INSERT INTO nt_error_1() VALUES (5), (5)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp Ne C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp Ne C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1654,10 +1654,10 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp Te C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp Te C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1677,10 +1677,10 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_error_1() VALUES (6), (6) master-bin.000001 # Query # # use `test`; INSERT INTO nt_error_1() VALUES (6), (6)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp NeT-trig C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp NeT-trig C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1700,16 +1700,16 @@ ROLLBACK;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
@@ -1727,10 +1727,10 @@ ROLLBACK;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1752,10 +1752,10 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_error_1() VALUES (7), (7) master-bin.000001 # Query # # use `test`; INSERT INTO nt_error_1() VALUES (7), (7)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp Ne R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp Ne R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1772,10 +1772,10 @@ ROLLBACK;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp Te R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp Te R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1797,10 +1797,10 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO nt_error_1() VALUES (8), (8) master-bin.000001 # Query # # use `test`; INSERT INTO nt_error_1() VALUES (8), (8)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp NeT-trig R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp NeT-trig R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1860,6 +1860,7 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1 master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
# Error: Data mismatch in tt_xx_1: Master: 3 rows Slave: 4 rows
-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp C'; SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp C';
@@ -2212,7 +2213,7 @@ include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1`,`test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp Te C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp Te C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -2228,7 +2229,7 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
@@ -2246,11 +2247,11 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp Te C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp Te C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -2284,7 +2285,7 @@ include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1`,`test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp Te R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp Te R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -2300,7 +2301,7 @@ ROLLBACK;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
@@ -2318,11 +2319,11 @@ ROLLBACK;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp Te R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp Te R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -2408,7 +2409,7 @@ include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1`,`test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp Te C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp Te C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -2424,7 +2425,7 @@ COMMIT;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
@@ -2443,8 +2444,8 @@ include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp Te C << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp Te C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -2476,7 +2477,7 @@ include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1`,`test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp Te R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp Te R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -2492,7 +2493,7 @@ ROLLBACK;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
@@ -2511,8 +2512,8 @@ include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp Te R << -e-e-e-e-e-e-e-e-e-e-e- -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp Te R << -e-e-e-e-e-e-e-e-e-e-e-

View File

@@ -0,0 +1 @@
--create_tmp_table_binlog_formats="MIXED"

View File

@@ -36,11 +36,10 @@ INSERT INTO t1 values(1);
INSERT INTO t2 (i1) select * from t1; INSERT INTO t2 (i1) select * from t1;
CREATE TEMPORARY TABLE t2_tmp (a int); CREATE TEMPORARY TABLE t2_tmp (a int);
ALTER TABLE t1_tmp ADD COLUMN c INT; ALTER TABLE t1_tmp ADD COLUMN c INT;
### assertion: assert that there is one open temp table on slave
connection slave; connection slave;
SHOW STATUS LIKE 'Slave_open_temp_tables'; SHOW STATUS LIKE 'Slave_open_temp_tables';
Variable_name Value Variable_name Value
Slave_open_temp_tables 1 Slave_open_temp_tables 2
connection master; connection master;
DROP TABLE t1_tmp, t2; DROP TABLE t1_tmp, t2;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
@@ -78,14 +77,18 @@ slave-bin.000001 # Table_map # # table_id: # (test.t2)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
slave-bin.000001 # Xid # # COMMIT /* XID */ slave-bin.000001 # Xid # # COMMIT /* XID */
slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE t2_tmp (a int)
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; ALTER TABLE t1_tmp ADD COLUMN c INT
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t1_tmp` /* generated by server */ slave-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t1_tmp` /* generated by server */
slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */ slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
slave-bin.000001 # Gtid # # BEGIN GTID #-#-# slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1) slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
slave-bin.000001 # Table_map # # table_id: # (test.t1)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
slave-bin.000001 # Xid # # COMMIT /* XID */ slave-bin.000001 # Xid # # COMMIT /* XID */
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t2_tmp` /* generated by server */
slave-bin.000001 # Gtid # # BEGIN GTID #-#-# slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
slave-bin.000001 # Xid # # COMMIT /* XID */ slave-bin.000001 # Xid # # COMMIT /* XID */

View File

@@ -1,5 +1,6 @@
SET sql_log_bin = 0; SET sql_log_bin = 0;
SET sql_log_bin = 1; SET sql_log_bin = 1;
set @@binlog_format="statement";
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
connection slave; connection slave;

View File

@@ -4,7 +4,24 @@
--let $rpl_topology=1->2 --let $rpl_topology=1->2
--source include/rpl_init.inc --source include/rpl_init.inc
# Create help tables select @@binlog_format, @@create_tmp_table_binlog_formats;
# Copy create_tmp_table_binlog_formats from master to slave
# This is done to get same results as with older versions of MariaDB.
# The slave will work even if this is not done. However in mixed
# format on slave temporary tables would not be logged to in the
# slaves binary log
let $format=`select @@create_tmp_table_binlog_formats`;
connection server_2;
--eval set @@global.create_tmp_table_binlog_formats='$format'
# Ensure that the slave threads uses the new values.
--source include/stop_slave.inc
--source include/start_slave.inc
connection server_1;
--echo #
--echo # Create help tables
--echo #
create table t2 (a int) engine=myisam; create table t2 (a int) engine=myisam;
insert into t2 values (0),(1),(2),(2); insert into t2 values (0),(1),(2),(2);
create temporary table t3 (a_in_temporary int) engine=myisam; create temporary table t3 (a_in_temporary int) engine=myisam;
@@ -231,4 +248,8 @@ create temporary table t9 (i int);
# Clean up # Clean up
drop table t2; drop table t2;
--connection server_2
set @@global.create_tmp_table_binlog_formats=default;
--connection server_1
--source include/rpl_end.inc --source include/rpl_end.inc

View File

@@ -0,0 +1,7 @@
# Testing create or replace table in mixed mode.
set @@global.create_tmp_table_binlog_formats="mixed";
set @@session.create_tmp_table_binlog_formats="mixed";
--source include/have_binlog_format_mixed.inc
--source create_or_replace.inc
set @@global.create_tmp_table_binlog_formats=default;

View File

@@ -7,7 +7,7 @@
# in row-based, it hangs waiting for an offset which is never # in row-based, it hangs waiting for an offset which is never
# reached (the "sync_with_master 1"), logically. # reached (the "sync_with_master 1"), logically.
--source include/have_binlog_format_mixed_or_statement.inc --source include/have_binlog_format_statement.inc
source include/master-slave.inc; source include/master-slave.inc;
--disable_query_log --disable_query_log

View File

@@ -28,7 +28,7 @@
# #
--source include/have_partition.inc --source include/have_partition.inc
--source include/have_binlog_format_mixed.inc --source include/have_binlog_format_statement.inc
--source include/master-slave.inc --source include/master-slave.inc
CREATE TEMPORARY TABLE t1 (a INT NOT NULL); CREATE TEMPORARY TABLE t1 (a INT NOT NULL);

View File

@@ -22,9 +22,9 @@
# http://dev.mysql.com/doc/refman/5.1/en/sql-syntax-data-definition.html # http://dev.mysql.com/doc/refman/5.1/en/sql-syntax-data-definition.html
# #
#CREATE TEMPORARY TABLE statements are not binlogged in row mode, #CREATE TEMPORARY TABLE statements are not binlogged in mixed or row mode,
#So it must be test by itself. #So it must be test by itself.
source include/have_binlog_format_mixed_or_statement.inc; source include/have_binlog_format_statement.inc;
source include/master-slave.inc; source include/master-slave.inc;
disable_warnings; disable_warnings;

View File

@@ -21,8 +21,11 @@ disconnect con_temp;
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
connection master; connection master;
if (`SELECT FIND_IN_SET(@@BINLOG_FORMAT,@@CREATE_TMP_TABLE_BINLOG_FORMATS) > 0`)
{
-- let $wait_binlog_event= DROP -- let $wait_binlog_event= DROP
-- source include/wait_for_binlog_event.inc -- source include/wait_for_binlog_event.inc
}
sync_slave_with_master; sync_slave_with_master;
connection slave; connection slave;
@@ -76,13 +79,17 @@ CREATE TABLE t1 ( i INT );
SHOW STATUS LIKE 'Slave_open_temp_tables'; SHOW STATUS LIKE 'Slave_open_temp_tables';
--connect(con1,localhost,root,,) --connect(con1,localhost,root,,)
set @@CREATE_TMP_TABLE_BINLOG_FORMATS="mixed";
CREATE TEMPORARY TABLE ttmp1 ( i INT ); CREATE TEMPORARY TABLE ttmp1 ( i INT );
SET SESSION binlog_format=ROW; SET SESSION binlog_format=ROW;
--disconnect con1 --disconnect con1
-- connection master -- connection master
if (`SELECT FIND_IN_SET(@@BINLOG_FORMAT,@@CREATE_TMP_TABLE_BINLOG_FORMATS) > 0`)
{
--let $wait_binlog_event= DROP --let $wait_binlog_event= DROP
--source include/wait_for_binlog_event.inc --source include/wait_for_binlog_event.inc
}
--sync_slave_with_master --sync_slave_with_master
SHOW STATUS LIKE 'Slave_open_temp_tables'; SHOW STATUS LIKE 'Slave_open_temp_tables';

View File

@@ -28,8 +28,11 @@ CREATE TEMPORARY TABLE tmp (a INT);
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--connection master --connection master
if (`SELECT FIND_IN_SET(@@BINLOG_FORMAT,@@CREATE_TMP_TABLE_BINLOG_FORMATS) > 0`)
{
--let $wait_binlog_event= DROP --let $wait_binlog_event= DROP
--source include/wait_for_binlog_event.inc --source include/wait_for_binlog_event.inc
}
sync_slave_with_master; sync_slave_with_master;
--connection slave --connection slave

View File

@@ -95,6 +95,7 @@ SET SESSION gtid_domain_id= 202;
DROP TEMPORARY TABLE t2; DROP TEMPORARY TABLE t2;
SET SESSION binlog_format= mixed; SET SESSION binlog_format= mixed;
SET SESSION create_tmp_table_binlog_formats="mixed";
SET SESSION gtid_domain_id= 0; SET SESSION gtid_domain_id= 0;
CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (1);

View File

@@ -1,6 +1,6 @@
--source include/have_debug.inc --source include/have_debug.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_binlog_format_mixed.inc --source include/have_binlog_format_statement.inc
--source include/master-slave.inc --source include/master-slave.inc
--echo *** MDEV-13831: Assertion on event group missing XID/COMMIT event --echo *** MDEV-13831: Assertion on event group missing XID/COMMIT event

View File

@@ -0,0 +1,15 @@
###################################################################################
# This test cases evaluates the mixture of non-transactional and transcational
# tables. Specifically when drop temporary tables and create temporary tables
# are used.
###################################################################################
--source include/big_test.inc
--source include/have_binlog_format_mixed.inc
--source include/have_innodb.inc
--source include/master-slave.inc
set @@global.create_tmp_table_binlog_formats="MIXED";
set @@session.create_tmp_table_binlog_formats="MIXED";
--source include/rpl_drop_create_temp_table.test
--source include/rpl_end.inc
set @@global.create_tmp_table_binlog_formats=default;

View File

@@ -8,7 +8,11 @@
--source include/not_msan.inc --source include/not_msan.inc
--source include/master-slave.inc --source include/master-slave.inc
set @@global.create_tmp_table_binlog_formats="mixed";
set @@session.create_tmp_table_binlog_formats="mixed";
let $engine_type=Innodb; let $engine_type=Innodb;
let $database_name=test; let $database_name=test;
--source include/rpl_mixing_engines.test --source include/rpl_mixing_engines.test
--connection server_1
set @@global.create_tmp_table_binlog_formats=default;
--source include/rpl_end.inc --source include/rpl_end.inc

View File

@@ -10,8 +10,12 @@
--disable_query_log --disable_query_log
SET SESSION binlog_direct_non_transactional_updates = OFF; SET SESSION binlog_direct_non_transactional_updates = OFF;
SET @@global.create_tmp_table_binlog_formats="mixed";
SET @@session.create_tmp_table_binlog_formats="mixed";
--enable_query_log --enable_query_log
let $engine_type=Innodb; let $engine_type=Innodb;
let $database_name=test; let $database_name=test;
--source include/rpl_mixing_engines.test --source include/rpl_mixing_engines.test
--connection server_1
SET @@global.create_tmp_table_binlog_formats=default;
--source include/rpl_end.inc --source include/rpl_end.inc

View File

@@ -2,6 +2,14 @@
-- source include/have_binlog_format_mixed_or_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc
if (`SELECT @@binlog_format = "MIXED"`) {
--disable_query_log
# Ensure that switching between mixed and statment works in all case */
set @@global.create_tmp_table_binlog_formats= "MIXED";
set @@session.create_tmp_table_binlog_formats= "MIXED";
--enable_query_log
}
--connection slave --connection slave
set sql_log_bin=0; set sql_log_bin=0;
create database y; create database y;
@@ -246,5 +254,7 @@ SET sql_log_bin= 1;
connection master; connection master;
sync_slave_with_master; sync_slave_with_master;
connection default;
set @@global.create_tmp_table_binlog_formats=default;
# end of 5.0 tests # end of 5.0 tests
--source include/rpl_end.inc --source include/rpl_end.inc

View File

@@ -1,5 +1,5 @@
# TBF - difference in row level logging # TBF - difference in row level logging
-- source include/have_binlog_format_mixed_or_statement.inc -- source include/have_binlog_format_statement.inc
-- source include/rpl_reset_slave.test -- source include/rpl_reset_slave.test
# End of 4.1 tests # End of 4.1 tests

View File

@@ -1,7 +1,7 @@
source include/have_innodb.inc; source include/have_innodb.inc;
source include/have_debug.inc; source include/have_debug.inc;
source include/have_debug_sync.inc; source include/have_debug_sync.inc;
source include/have_binlog_format_mixed_or_statement.inc; source include/have_binlog_format_statement.inc;
source include/master-slave.inc; source include/master-slave.inc;
--connection slave --connection slave

View File

@@ -1,7 +1,7 @@
# drop table t1 t2 t3 are included int master-slave.inc # drop table t1 t2 t3 are included int master-slave.inc
# meaningful only in statement-based: # meaningful only in statement-based:
-- source include/have_binlog_format_mixed_or_statement.inc -- source include/have_binlog_format_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc
--disable_query_log --disable_query_log

View File

@@ -0,0 +1 @@
--create_tmp_table_binlog_formats="MIXED"

View File

@@ -1,6 +1,7 @@
# ==== Purpose ==== # ==== Purpose ====
# #
# Test that temporary tables are correctly replicated after switching to ROW format in MIX mode. # Test that temporary tables are correctly replicated after switching to ROW format in
# STATEMENT mode.
# This test case will test the condition of the bug#40013. # This test case will test the condition of the bug#40013.
# The test step is: # The test step is:
# 1: create temp table on connection 'master'; # 1: create temp table on connection 'master';
@@ -31,9 +32,12 @@ SHOW STATUS LIKE "Slave_open_temp_tables";
disconnect master; disconnect master;
--connection master1 --connection master1
# waiting DROP TEMPORARY TABLE event to be written into binlog # waiting for DROP TEMPORARY TABLE event to be written into binlog
if (`SELECT FIND_IN_SET(@@BINLOG_FORMAT,@@CREATE_TMP_TABLE_BINLOG_FORMATS) > 0`)
{
let $wait_binlog_event= DROP; let $wait_binlog_event= DROP;
source include/wait_for_binlog_event.inc; source include/wait_for_binlog_event.inc;
}
sync_slave_with_master; sync_slave_with_master;
@@ -102,17 +106,13 @@ CREATE TEMPORARY TABLE t1_tmp (i1 int);
# assertion: assert that ALTER TABLE is logged as STATEMENT # assertion: assert that ALTER TABLE is logged as STATEMENT
ALTER TABLE t1_tmp ADD COLUMN b INT; ALTER TABLE t1_tmp ADD COLUMN b INT;
# action: force switch to RBR
INSERT INTO t1 values(1); INSERT INTO t1 values(1);
INSERT INTO t2 (i1) select * from t1; INSERT INTO t2 (i1) select * from t1;
# assertion: assert that t2_tmp will not make into the binlog (RBR logging atm)
CREATE TEMPORARY TABLE t2_tmp (a int); CREATE TEMPORARY TABLE t2_tmp (a int);
# assertion: assert that ALTER TABLE on t1_tmp will not make into the binlog
ALTER TABLE t1_tmp ADD COLUMN c INT; ALTER TABLE t1_tmp ADD COLUMN c INT;
-- echo ### assertion: assert that there is one open temp table on slave
-- sync_slave_with_master -- sync_slave_with_master
SHOW STATUS LIKE 'Slave_open_temp_tables'; SHOW STATUS LIKE 'Slave_open_temp_tables';
@@ -121,15 +121,10 @@ SHOW STATUS LIKE 'Slave_open_temp_tables';
# assertion: assert that both drops are logged # assertion: assert that both drops are logged
DROP TABLE t1_tmp, t2; DROP TABLE t1_tmp, t2;
# assertion: assert that statement is logged as row (master still has one
# opened temporary table - t2_tmp.
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
# assertion: assert that DROP TABLE *is* logged despite CREATE is not.
DROP TEMPORARY TABLE t2_tmp; DROP TEMPORARY TABLE t2_tmp;
# assertion: assert that statement is now logged as STMT (mixed mode switches
# back to STATEMENT).
INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (2);
-- sync_slave_with_master -- sync_slave_with_master

View File

@@ -4,6 +4,7 @@ SET sql_log_bin = 0;
source include/add_anonymous_users.inc; source include/add_anonymous_users.inc;
SET sql_log_bin = 1; SET sql_log_bin = 1;
set @@binlog_format="statement";
-- source include/master-slave.inc -- source include/master-slave.inc
# Clean up old slave's binlogs. # Clean up old slave's binlogs.

View File

@@ -21,7 +21,7 @@
# Requires statement-based logging since temporary tables are not # Requires statement-based logging since temporary tables are not
# logged in row-based logging # logged in row-based logging
-- source include/have_binlog_format_mixed_or_statement.inc -- source include/have_binlog_format_statement.inc
source include/master-slave.inc; source include/master-slave.inc;
@@ -47,9 +47,12 @@ disconnect master;
connection slave; connection slave;
if (`SELECT FIND_IN_SET(@@BINLOG_FORMAT,@@CREATE_TMP_TABLE_BINLOG_FORMATS) > 0`)
{
# Wait until drop of temp tables appers in slave's binlog # Wait until drop of temp tables appers in slave's binlog
let $wait_binlog_event= DROP; let $wait_binlog_event= DROP;
source include/wait_for_binlog_event.inc; source include/wait_for_binlog_event.inc;
}
show status like 'Slave_open_temp_tables'; show status like 'Slave_open_temp_tables';

View File

@@ -0,0 +1,81 @@
SET @start_value= @@global.create_tmp_table_binlog_formats;
SELECT @@GLOBAL.create_tmp_table_binlog_formats;
@@GLOBAL.create_tmp_table_binlog_formats
STATEMENT
'#---------------------BS_STVARS_002_01----------------------#'
SELECT COUNT(@@GLOBAL.create_tmp_table_binlog_formats);
COUNT(@@GLOBAL.create_tmp_table_binlog_formats)
1
1 Expected
SELECT COUNT(@@SESSION.create_tmp_table_binlog_formats);
COUNT(@@SESSION.create_tmp_table_binlog_formats)
1
1 Expected
'#---------------------BS_STVARS_002_02----------------------#'
SET @@GLOBAL.create_tmp_table_binlog_formats="STATEMENT";
SELECT @@GLOBAL.create_tmp_table_binlog_formats;
@@GLOBAL.create_tmp_table_binlog_formats
STATEMENT
SET @@GLOBAL.create_tmp_table_binlog_formats="MIXED,STATEMENT";
SELECT @@GLOBAL.create_tmp_table_binlog_formats;
@@GLOBAL.create_tmp_table_binlog_formats
MIXED,STATEMENT
SET @@SESSION.create_tmp_table_binlog_formats="STATEMENT";
SELECT @@SESSION.create_tmp_table_binlog_formats;
@@SESSION.create_tmp_table_binlog_formats
STATEMENT
SET @@SESSION.create_tmp_table_binlog_formats="MIXED,STATEMENT";
SELECT @@SESSION.create_tmp_table_binlog_formats;
@@SESSION.create_tmp_table_binlog_formats
MIXED,STATEMENT
'#---------------------BS_STVARS_002_03----------------------#'
SELECT @@GLOBAL.create_tmp_table_binlog_formats = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='create_tmp_table_binlog_formats';
@@GLOBAL.create_tmp_table_binlog_formats = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='create_tmp_table_binlog_formats';
COUNT(VARIABLE_VALUE)
1
1 Expected
'#---------------------BS_STVARS_002_04----------------------#'
SELECT @@SESSION.create_tmp_table_binlog_formats = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='create_tmp_table_binlog_formats';
@@SESSION.create_tmp_table_binlog_formats = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='create_tmp_table_binlog_formats';
COUNT(VARIABLE_VALUE)
1
1 Expected
# Check assignment of correct values
SET @@session.create_tmp_table_binlog_formats= @start_value;
SET @@SESSION.create_tmp_table_binlog_formats="MIXED";
SELECT @@SESSION.create_tmp_table_binlog_formats;
@@SESSION.create_tmp_table_binlog_formats
MIXED,STATEMENT
SET @@session.create_tmp_table_binlog_formats= @start_value;
SET @@SESSION.create_tmp_table_binlog_formats="STATEMENT,MIXED";
SELECT @@SESSION.create_tmp_table_binlog_formats;
@@SESSION.create_tmp_table_binlog_formats
MIXED,STATEMENT
# Check assignment of wrong values
SET @@session.create_tmp_table_binlog_formats= @start_value;
SET @@SESSION.create_tmp_table_binlog_formats="";
ERROR 42000: Variable 'create_tmp_table_binlog_formats' can't be set to the value of ''
SELECT @@SESSION.create_tmp_table_binlog_formats;
@@SESSION.create_tmp_table_binlog_formats
STATEMENT
SET @@SESSION.create_tmp_table_binlog_formats="ROW";
ERROR 42000: Variable 'create_tmp_table_binlog_formats' can't be set to the value of 'ROW'
SELECT @@SESSION.create_tmp_table_binlog_formats;
@@SESSION.create_tmp_table_binlog_formats
STATEMENT
# Cleanup
SET @@global.create_tmp_table_binlog_formats= @start_value;

View File

@@ -752,6 +752,16 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON ENUM_VALUE_LIST OFF,ON
READ_ONLY YES READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME CREATE_TMP_TABLE_BINLOG_FORMATS
VARIABLE_SCOPE SESSION
VARIABLE_TYPE SET
VARIABLE_COMMENT The binary logging formats under which the master will log CREATE TEMPORARY statments to the binary log. If CREATE TEMPORARY is not logged, all usage of the temporary table will be logged in ROW format. Allowed values are STATEMENT or MIXED,STATEMENT
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST MIXED,STATEMENT
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DATADIR VARIABLE_NAME DATADIR
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR VARIABLE_TYPE VARCHAR

View File

@@ -802,6 +802,16 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON ENUM_VALUE_LIST OFF,ON
READ_ONLY YES READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME CREATE_TMP_TABLE_BINLOG_FORMATS
VARIABLE_SCOPE SESSION
VARIABLE_TYPE SET
VARIABLE_COMMENT The binary logging formats under which the master will log CREATE TEMPORARY statments to the binary log. If CREATE TEMPORARY is not logged, all usage of the temporary table will be logged in ROW format. Allowed values are STATEMENT or MIXED,STATEMENT
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST MIXED,STATEMENT
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DATADIR VARIABLE_NAME DATADIR
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR VARIABLE_TYPE VARCHAR

View File

@@ -0,0 +1,95 @@
################## mysql-test\t\binlog_format_basic.test ######################
# #
# Variable Name: create_tmp_table_binlog_formats #
# Scope: Global & Session #
# Access Type: Static #
# Data Type: set eration #
# #
# Description:Test Cases of a Dynamic System
# that checks the behavior of this variable in the following ways #
# * Value Check #
# * Scope Check #
# #
###############################################################################
SET @start_value= @@global.create_tmp_table_binlog_formats;
SELECT @@GLOBAL.create_tmp_table_binlog_formats;
--echo '#---------------------BS_STVARS_002_01----------------------#'
####################################################################
# Displaying default value #
####################################################################
SELECT COUNT(@@GLOBAL.create_tmp_table_binlog_formats);
--echo 1 Expected
SELECT COUNT(@@SESSION.create_tmp_table_binlog_formats);
--echo 1 Expected
--echo '#---------------------BS_STVARS_002_02----------------------#'
####################################################################
# Check if Value can set #
####################################################################
SET @@GLOBAL.create_tmp_table_binlog_formats="STATEMENT";
SELECT @@GLOBAL.create_tmp_table_binlog_formats;
SET @@GLOBAL.create_tmp_table_binlog_formats="MIXED,STATEMENT";
SELECT @@GLOBAL.create_tmp_table_binlog_formats;
SET @@SESSION.create_tmp_table_binlog_formats="STATEMENT";
SELECT @@SESSION.create_tmp_table_binlog_formats;
SET @@SESSION.create_tmp_table_binlog_formats="MIXED,STATEMENT";
SELECT @@SESSION.create_tmp_table_binlog_formats;
--echo '#---------------------BS_STVARS_002_03----------------------#'
#################################################################
# Check if the value in GLOBAL Table matches value in variable #
#################################################################
SELECT @@GLOBAL.create_tmp_table_binlog_formats = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='create_tmp_table_binlog_formats';
--echo 1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='create_tmp_table_binlog_formats';
--echo 1 Expected
--echo '#---------------------BS_STVARS_002_04----------------------#'
#################################################################
# Check if the value in SESSION Table matches value in variable #
#################################################################
SELECT @@SESSION.create_tmp_table_binlog_formats = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='create_tmp_table_binlog_formats';
--echo 1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='create_tmp_table_binlog_formats';
--echo 1 Expected
--echo # Check assignment of correct values
SET @@session.create_tmp_table_binlog_formats= @start_value;
SET @@SESSION.create_tmp_table_binlog_formats="MIXED";
SELECT @@SESSION.create_tmp_table_binlog_formats;
SET @@session.create_tmp_table_binlog_formats= @start_value;
SET @@SESSION.create_tmp_table_binlog_formats="STATEMENT,MIXED";
SELECT @@SESSION.create_tmp_table_binlog_formats;
--echo # Check assignment of wrong values
SET @@session.create_tmp_table_binlog_formats= @start_value;
--error ER_WRONG_VALUE_FOR_VAR
SET @@SESSION.create_tmp_table_binlog_formats="";
SELECT @@SESSION.create_tmp_table_binlog_formats;
--error ER_WRONG_VALUE_FOR_VAR
SET @@SESSION.create_tmp_table_binlog_formats="ROW";
SELECT @@SESSION.create_tmp_table_binlog_formats;
--echo # Cleanup
SET @@global.create_tmp_table_binlog_formats= @start_value;

View File

@@ -5589,6 +5589,7 @@ bool key_uses_partial_cols(TABLE_SHARE *table, uint keyno);
extern const LEX_CSTRING ha_row_type[]; extern const LEX_CSTRING ha_row_type[];
extern MYSQL_PLUGIN_IMPORT const char *tx_isolation_names[]; extern MYSQL_PLUGIN_IMPORT const char *tx_isolation_names[];
extern MYSQL_PLUGIN_IMPORT const char *binlog_format_names[]; extern MYSQL_PLUGIN_IMPORT const char *binlog_format_names[];
extern MYSQL_PLUGIN_IMPORT const char *binlog_formats_create_tmp_names[];
extern TYPELIB tx_isolation_typelib; extern TYPELIB tx_isolation_typelib;
extern const char *myisam_stats_method_names[]; extern const char *myisam_stats_method_names[];
extern ulong total_ha, total_ha_2pc; extern ulong total_ha, total_ha_2pc;

View File

@@ -456,6 +456,7 @@ uint opt_binlog_gtid_index_span_min= 65536;
my_bool opt_master_verify_checksum= 0; my_bool opt_master_verify_checksum= 0;
my_bool opt_slave_sql_verify_checksum= 1; my_bool opt_slave_sql_verify_checksum= 1;
const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NullS}; const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NullS};
const char *binlog_formats_create_tmp_names[]= {"MIXED", "STATEMENT", NullS};
volatile sig_atomic_t calling_initgroups= 0; /**< Used in SIGSEGV handler. */ volatile sig_atomic_t calling_initgroups= 0; /**< Used in SIGSEGV handler. */
uint mysqld_port, select_errors, ha_open_options; uint mysqld_port, select_errors, ha_open_options;
uint mysqld_extra_port; uint mysqld_extra_port;
@@ -4473,6 +4474,10 @@ static int init_common_variables()
if (tls_version & (VIO_TLSv1_0 + VIO_TLSv1_1)) if (tls_version & (VIO_TLSv1_0 + VIO_TLSv1_1))
sql_print_warning("TLSv1.0 and TLSv1.1 are insecure and should not be used for tls_version"); sql_print_warning("TLSv1.0 and TLSv1.1 are insecure and should not be used for tls_version");
/* create_temporary_table... must always have the flag BINLOG_FORMAT_STMT */
global_system_variables.create_temporary_table_binlog_formats|=
(1ULL << BINLOG_FORMAT_STMT);
#ifdef WITH_WSREP #ifdef WITH_WSREP
/* /*
We need to initialize auxiliary variables, that will be We need to initialize auxiliary variables, that will be

View File

@@ -57,6 +57,7 @@ static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list,
trans_rollback_stmt(thd); trans_rollback_stmt(thd);
trans_rollback(thd); trans_rollback(thd);
thd->tmp_table_binlog_handled= 1;
close_thread_tables(thd); close_thread_tables(thd);
thd->release_transactional_locks(); thd->release_transactional_locks();
@@ -1286,6 +1287,7 @@ send_result_message:
recreate_used= 1; recreate_used= 1;
trans_commit_stmt(thd); trans_commit_stmt(thd);
trans_commit(thd); trans_commit(thd);
thd->tmp_table_binlog_handled= 1;
close_thread_tables(thd); close_thread_tables(thd);
thd->release_transactional_locks(); thd->release_transactional_locks();
/* Clear references to TABLE and MDL_ticket after releasing them. */ /* Clear references to TABLE and MDL_ticket after releasing them. */
@@ -1459,6 +1461,7 @@ send_result_message:
goto err; goto err;
is_table_modified= true; is_table_modified= true;
} }
thd->tmp_table_binlog_handled= 1;
close_thread_tables(thd); close_thread_tables(thd);
if (storage_engine_name[0]) if (storage_engine_name[0])
@@ -1509,6 +1512,16 @@ send_result_message:
if (res) if (res)
goto err; goto err;
} }
else
{
/*
We decided to not log the query to binlog.
We mark the query as logged to ensure that temporary tables are not
marked with 'mark_as_not_binlogged()' on close.
*/
thd->tmp_table_binlog_handled= 1;
}
my_eof(thd); my_eof(thd);
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
@@ -1521,6 +1534,7 @@ err:
if (table && table->table) if (table && table->table)
{ {
table->table->mark_table_for_reopen(); table->table->mark_table_for_reopen();
table->table->mark_as_not_binlogged();
table->table= 0; table->table= 0;
} }
close_thread_tables(thd); // Shouldn't be needed close_thread_tables(thd); // Shouldn't be needed

View File

@@ -6978,7 +6978,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
table= tbl->table; table= tbl->table;
share= table->s; share= table->s;
flags= table->file->ha_table_flags(); flags= table->file->ha_table_flags();
if (!share->table_creation_was_logged) if (!share->using_binlog())
{ {
/* /*
This is a temporary table which was not logged in the binary log. This is a temporary table which was not logged in the binary log.
@@ -8203,6 +8203,9 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
*/ */
reset_binlog_for_next_statement(); reset_binlog_for_next_statement();
/* Temp tables changes are logged as a statement */
tmp_table_binlog_handled= 1;
DBUG_RETURN(error >= 0 ? error : 1); DBUG_RETURN(error >= 0 ? error : 1);
} }

View File

@@ -739,6 +739,7 @@ typedef struct system_variables
ulonglong default_regex_flags; ulonglong default_regex_flags;
ulonglong max_mem_used; ulonglong max_mem_used;
ulonglong max_rowid_filter_size; ulonglong max_rowid_filter_size;
ulonglong create_temporary_table_binlog_formats;
/** /**
Place holders to store Multi-source variables in sys_var.cc during Place holders to store Multi-source variables in sys_var.cc during
@@ -3275,6 +3276,12 @@ public:
bool semi_sync_slave; bool semi_sync_slave;
/* Several threads may share this thd. Used with parallel repair */ /* Several threads may share this thd. Used with parallel repair */
bool shared_thd; bool shared_thd;
/*
Mark if query was logged as statement or to mark that there was no
changes in the table. Used to check if tmp table changes are
properly logged.
*/
bool tmp_table_binlog_handled;
ulonglong client_capabilities; /* What the client supports */ ulonglong client_capabilities; /* What the client supports */
ulong max_client_packet_length; ulong max_client_packet_length;
@@ -3454,6 +3461,33 @@ public:
current_stmt_binlog_format == BINLOG_FORMAT_ROW); current_stmt_binlog_format == BINLOG_FORMAT_ROW);
return current_stmt_binlog_format == BINLOG_FORMAT_ROW; return current_stmt_binlog_format == BINLOG_FORMAT_ROW;
} }
int is_binlog_format_row() const
{
return variables.binlog_format == BINLOG_FORMAT_ROW;
}
/*
Should we binlog a CREATE TEMPORARY statement.
This should happen only if all of the following is true
- binlog format is either BINLOG_FORMAT_STMT or BINLOG_FORMAT_MIXED
and the corresponding bit is set in binlog_format_for_create_temporary.
- The server is not in readonly mode or this is a slave thread.
- Slave threads are not affected by readonly in this case.
Note that CREATE TEMPORARY is always logged in STATEMENT from as
temporary tables does not support ROW logging.
@result 1 CREATE should be logged
@result 0 CREATE should not be logged
*/
bool binlog_create_tmp_table()
{
return (((1ULL << variables.binlog_format) &
variables.create_temporary_table_binlog_formats) &&
(!opt_readonly || slave_thread));
}
/** /**
Determine if binlogging is disabled for this session Determine if binlogging is disabled for this session
@retval 0 if the current statement binlogging is disabled @retval 0 if the current statement binlogging is disabled
@@ -3496,6 +3530,8 @@ public:
return m_binlog_filter_state; return m_binlog_filter_state;
} }
bool binlog_renamed_tmp_tables(TABLE_LIST *table_list);
/** /**
Checks if a user connection is read-only Checks if a user connection is read-only
*/ */
@@ -5148,21 +5184,6 @@ public:
inline void reset_current_stmt_binlog_format_row() inline void reset_current_stmt_binlog_format_row()
{ {
DBUG_ENTER("reset_current_stmt_binlog_format_row"); DBUG_ENTER("reset_current_stmt_binlog_format_row");
/*
If there are temporary tables, don't reset back to
statement-based. Indeed it could be that:
CREATE TEMPORARY TABLE t SELECT UUID(); # row-based
# and row-based does not store updates to temp tables
# in the binlog.
INSERT INTO u SELECT * FROM t; # stmt-based
and then the INSERT will fail as data inserted into t was not logged.
So we continue with row-based until the temp table is dropped.
If we are in a stored function or trigger, we mustn't reset in the
middle of its execution (as the binary logging way of a stored function
or trigger is decided when it starts executing, depending for example on
the caller (for a stored function: if caller is SELECT or
INSERT/UPDATE/DELETE...).
*/
DBUG_PRINT("debug", DBUG_PRINT("debug",
("temporary_tables: %s, in_sub_stmt: %s, system_thread: %s", ("temporary_tables: %s, in_sub_stmt: %s, system_thread: %s",
YESNO(has_temporary_tables()), YESNO(in_sub_stmt), YESNO(has_temporary_tables()), YESNO(in_sub_stmt),
@@ -5171,7 +5192,7 @@ public:
{ {
if (wsrep_binlog_format(variables.binlog_format) == BINLOG_FORMAT_ROW) if (wsrep_binlog_format(variables.binlog_format) == BINLOG_FORMAT_ROW)
set_current_stmt_binlog_format_row(); set_current_stmt_binlog_format_row();
else if (!has_temporary_tables()) else
set_current_stmt_binlog_format_stmt(); set_current_stmt_binlog_format_stmt();
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@@ -5772,6 +5793,8 @@ public:
}; };
bool has_thd_temporary_tables(); bool has_thd_temporary_tables();
bool has_temporary_tables(); bool has_temporary_tables();
bool has_not_logged_temporary_tables();
bool has_logged_temporary_tables();
TABLE *create_and_open_tmp_table(LEX_CUSTRING *frm, TABLE *create_and_open_tmp_table(LEX_CUSTRING *frm,
const char *path, const char *path,
@@ -6500,7 +6523,7 @@ class select_insert :public select_result_interceptor {
int send_data(List<Item> &items) override; int send_data(List<Item> &items) override;
virtual bool store_values(List<Item> &values, bool *trg_skip_row); virtual bool store_values(List<Item> &values, bool *trg_skip_row);
virtual bool can_rollback_data() { return 0; } virtual bool can_rollback_data() { return 0; }
bool prepare_eof(); bool prepare_eof(bool using_create);
bool send_ok_packet(); bool send_ok_packet();
bool send_eof() override; bool send_eof() override;
void abort_result_set() override; void abort_result_set() override;

View File

@@ -332,6 +332,7 @@ bool Sql_cmd_delete::delete_from_single_table(THD *thd)
bool safe_update; bool safe_update;
bool const_cond_result; bool const_cond_result;
bool return_error= 0; bool return_error= 0;
bool binlogged= 0;
TABLE *table; TABLE *table;
SQL_SELECT *select= 0; SQL_SELECT *select= 0;
SORT_INFO *file_sort= 0; SORT_INFO *file_sort= 0;
@@ -456,8 +457,8 @@ bool Sql_cmd_delete::delete_from_single_table(THD *thd)
transactional_table= table->file->has_transactions_and_rollback(); transactional_table= table->file->has_transactions_and_rollback();
if (!returning && !using_limit && const_cond_result && if (!returning && !using_limit && const_cond_result &&
(!thd->is_current_stmt_binlog_format_row() && !has_triggers) !thd->is_current_stmt_binlog_format_row() && !has_triggers &&
&& !table->versioned(VERS_TIMESTAMP) && !table_list->has_period()) !table->versioned(VERS_TIMESTAMP) && !table_list->has_period())
{ {
/* Update the table->file->stats.records number */ /* Update the table->file->stats.records number */
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
@@ -991,10 +992,11 @@ cleanup:
thd->transaction->all.modified_non_trans_table= TRUE; thd->transaction->all.modified_non_trans_table= TRUE;
/* See similar binlogging code in sql_update.cc, for comments */ /* See similar binlogging code in sql_update.cc, for comments */
if (likely((error < 0) || thd->transaction->stmt.modified_non_trans_table if (likely((error < 0) || thd->transaction->stmt.modified_non_trans_table ||
|| thd->log_current_statement())) thd->log_current_statement()))
{ {
if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) &&
table->s->using_binlog())
{ {
int errcode= 0; int errcode= 0;
if (error < 0) if (error < 0)
@@ -1019,8 +1021,13 @@ cleanup:
{ {
error=1; error=1;
} }
else
binlogged= 1;
} }
} }
if (!binlogged)
table->mark_as_not_binlogged();
DBUG_ASSERT(transactional_table || !deleted || thd->transaction->stmt.modified_non_trans_table); DBUG_ASSERT(transactional_table || !deleted || thd->transaction->stmt.modified_non_trans_table);
if (likely(error < 0) || if (likely(error < 0) ||
@@ -1421,6 +1428,7 @@ int multi_delete::send_data(List<Item> &values)
void multi_delete::abort_result_set() void multi_delete::abort_result_set()
{ {
TABLE_LIST *cur_table;
DBUG_ENTER("multi_delete::abort_result_set"); DBUG_ENTER("multi_delete::abort_result_set");
/**************************************************************************** /****************************************************************************
@@ -1480,6 +1488,13 @@ void multi_delete::abort_result_set()
transactional_tables, FALSE, FALSE, errcode); transactional_tables, FALSE, FALSE, errcode);
} }
} }
/*
Mark all temporay tables as not completely binlogged
All future usage of these tables will enforce row level logging, which
ensures that all future usage of them enforces row level logging.
*/
for (cur_table= delete_tables; cur_table; cur_table= cur_table->next_local)
cur_table->table->mark_as_not_binlogged();
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }

View File

@@ -1253,9 +1253,12 @@ values_loop_end:
thd->log_current_statement() || thd->log_current_statement() ||
was_insert_delayed) was_insert_delayed)
{ {
if(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) bool binlogged= 0;
if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) &&
table->s->using_binlog())
{ {
int errcode= 0; int errcode= 0, skip_binlog= 0;
String log_query;
if (error <= 0) if (error <= 0)
{ {
/* /*
@@ -1291,27 +1294,42 @@ values_loop_end:
if (was_insert_delayed && table_list->lock_type == TL_WRITE) if (was_insert_delayed && table_list->lock_type == TL_WRITE)
{ {
/* Binlog INSERT DELAYED as INSERT without DELAYED. */ /* Binlog INSERT DELAYED as INSERT without DELAYED. */
String log_query;
if (create_insert_stmt_from_insert_delayed(thd, &log_query)) if (create_insert_stmt_from_insert_delayed(thd, &log_query))
{ {
sql_print_error("Event Error: An error occurred while creating query string" sql_print_error("Event Error: An error occurred while creating query string"
"for INSERT DELAYED stmt, before writing it into binary log."); "for INSERT DELAYED stmt, before writing it into binary log.");
error= 1; skip_binlog= error= 1;
} }
else if (thd->binlog_query(THD::ROW_QUERY_TYPE, }
log_query.c_ptr(), log_query.length(), else
transactional_table, FALSE, FALSE, log_query.set(thd->query(), thd->query_length(), log_query.charset());
errcode) > 0)
if (!skip_binlog)
{
int binlog_error;
binlog_error= thd->binlog_query(THD::ROW_QUERY_TYPE,
log_query.c_ptr(),
log_query.length(),
transactional_table, FALSE, FALSE,
errcode);
if (likely(binlog_error == 0))
binlogged= 1;
else if (binlog_error > 0)
error= 1; error= 1;
} }
else if (thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query(), thd->query_length(),
transactional_table, FALSE, FALSE,
errcode) > 0)
error= 1;
} }
if (changed)
{
if (!binlogged)
table->mark_as_not_binlogged();
}
else
thd->tmp_table_binlog_handled= 1; // Temp table not changed
} }
else
thd->tmp_table_binlog_handled= 1; // Temp table not changed
DBUG_ASSERT(transactional_table || !changed || DBUG_ASSERT(transactional_table || !changed ||
thd->transaction->stmt.modified_non_trans_table); thd->transaction->stmt.modified_non_trans_table);
} }
@@ -4394,7 +4412,7 @@ bool select_insert::store_values(List<Item> &values, bool *trg_skip_row)
DBUG_RETURN(error); DBUG_RETURN(error);
} }
bool select_insert::prepare_eof() bool select_insert::prepare_eof(bool in_create_table)
{ {
int error; int error;
bool const trans_table= table->file->has_transactions_and_rollback(); bool const trans_table= table->file->has_transactions_and_rollback();
@@ -4454,14 +4472,22 @@ bool select_insert::prepare_eof()
thd->transaction->stmt.modified_non_trans_table); thd->transaction->stmt.modified_non_trans_table);
/* /*
Write to binlog before commiting transaction. No statement will Write to binlog before committing transaction. No statement will
be written by the binlog_query() below in RBR mode. All the be written by the binlog_query() below in RBR mode. All the
events are in the transaction cache and will be written when events are in the transaction cache and will be written when
ha_autocommit_or_rollback() is issued below. ha_autocommit_or_rollback() is issued below.
Temporary tables will be logged only on CREATE in STMT format
or on INSERT if all changes to the table is in the binlog.
*/ */
if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) && if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) &&
(likely(!error) || thd->transaction->stmt.modified_non_trans_table || (table->s->using_binlog() ||
thd->log_current_statement())) ((in_create_table &&
(!table->s->tmp_table || thd->binlog_create_tmp_table())))) &&
(likely(!error) ||
(!in_create_table &&
(thd->transaction->stmt.modified_non_trans_table ||
thd->log_current_statement()))))
{ {
int errcode= 0; int errcode= 0;
int res; int res;
@@ -4480,8 +4506,12 @@ bool select_insert::prepare_eof()
DBUG_RETURN(true); DBUG_RETURN(true);
} }
binary_logged= res == 0 || !table->s->tmp_table; binary_logged= res == 0 || !table->s->tmp_table;
if (binary_logged)
table->s->table_creation_was_logged= 1;
} }
table->s->table_creation_was_logged|= binary_logged; else if (changed)
table->mark_as_not_binlogged();
table->file->ha_release_auto_increment(); table->file->ha_release_auto_increment();
if (unlikely(error)) if (unlikely(error))
@@ -4534,7 +4564,7 @@ bool select_insert::send_eof()
{ {
bool res; bool res;
DBUG_ENTER("select_insert::send_eof"); DBUG_ENTER("select_insert::send_eof");
res= (prepare_eof() || (!suppress_my_ok && send_ok_packet())); res= (prepare_eof(0) || (!suppress_my_ok && send_ok_packet()));
DBUG_RETURN(res); DBUG_RETURN(res);
} }
@@ -4599,28 +4629,33 @@ void select_insert::abort_result_set()
if (thd->transaction->stmt.modified_non_trans_table || if (thd->transaction->stmt.modified_non_trans_table ||
thd->log_current_statement()) thd->log_current_statement())
{ {
if (!can_rollback_data()) if (!can_rollback_data())
thd->transaction->all.modified_non_trans_table= TRUE; thd->transaction->all.modified_non_trans_table= TRUE;
if(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{ {
StatementBinlog stmt_binlog(thd, !can_rollback_data() && StatementBinlog stmt_binlog(thd, !can_rollback_data() &&
thd->binlog_need_stmt_format(transactional_table)); thd->binlog_need_stmt_format(transactional_table));
int errcode= query_error_code(thd, thd->killed == NOT_KILLED); int errcode= query_error_code(thd, thd->killed == NOT_KILLED);
int res; int res;
/* error of writing binary log is ignored */ /* error of writing binary log is ignored */
res= thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query(), res= thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query(),
thd->query_length(), thd->query_length(),
transactional_table, FALSE, FALSE, errcode); transactional_table, FALSE, FALSE, errcode);
binary_logged= res == 0 || !table->s->tmp_table; binary_logged= res == 0 || !table->s->tmp_table;
} }
if (changed) if (changed)
query_cache_invalidate3(thd, table, 1); {
if (!binary_logged)
table->mark_as_not_binlogged();
query_cache_invalidate3(thd, table, 1);
}
else
thd->tmp_table_binlog_handled= 1; // tmp table not changed
} }
DBUG_ASSERT(transactional_table || !changed || DBUG_ASSERT(transactional_table || !changed ||
thd->transaction->stmt.modified_non_trans_table); thd->transaction->stmt.modified_non_trans_table);
table->s->table_creation_was_logged|= binary_logged;
table->file->ha_release_auto_increment(); table->file->ha_release_auto_increment();
} }
@@ -4882,6 +4917,8 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
mysql_unlock_tables(thd, *lock); mysql_unlock_tables(thd, *lock);
*lock= 0; *lock= 0;
} }
table->s->table_creation_was_logged= save_table_creation_was_logged;
drop_open_table(thd, table, &table_list->db, &table_list->table_name); drop_open_table(thd, table, &table_list->db, &table_list->table_name);
ddl_log_complete(&ddl_log_state_rm); ddl_log_complete(&ddl_log_state_rm);
ddl_log_complete(&ddl_log_state_create); ddl_log_complete(&ddl_log_state_create);
@@ -5134,16 +5171,16 @@ bool binlog_create_table(THD *thd, TABLE *table, bool replace)
bool result; bool result;
ulonglong save_option_bits; ulonglong save_option_bits;
/* Don't log temporary tables in row format */ /* Don't log temporary tables in row or mixed format */
if (thd->variables.binlog_format == BINLOG_FORMAT_ROW && if (table->s->tmp_table && !thd->binlog_create_tmp_table())
table->s->tmp_table)
return 0; return 0;
if (!thd->binlog_table_should_be_logged(&table->s->db)) if (!thd->binlog_table_should_be_logged(&table->s->db))
return 0; return 0;
/* /*
We have to use ROW format to ensure that future row inserts will be We have to use ROW format to ensure that future row inserts will be
logged logged. For temporary tables this means the table will not be binlogged
anymore.
*/ */
thd->set_current_stmt_binlog_format_row(); thd->set_current_stmt_binlog_format_row();
table->file->prepare_for_row_logging(); table->file->prepare_for_row_logging();
@@ -5176,7 +5213,7 @@ bool binlog_create_table(THD *thd, TABLE *table, bool replace)
bool binlog_drop_table(THD *thd, TABLE *table) bool binlog_drop_table(THD *thd, TABLE *table)
{ {
StringBuffer<2048> query(system_charset_info); StringBuffer<2048> query(system_charset_info);
/* Don't log temporary tables in row format */ /* Don't log temporary tables if creation was not logged */
if (!table->s->table_creation_was_logged) if (!table->s->table_creation_was_logged)
return 0; return 0;
if (!thd->binlog_table_should_be_logged(&table->s->db)) if (!thd->binlog_table_should_be_logged(&table->s->db))
@@ -5240,7 +5277,7 @@ bool select_create::send_eof()
ddl_log_complete(&ddl_log_state_rm); ddl_log_complete(&ddl_log_state_rm);
} }
if (prepare_eof()) if (prepare_eof(1))
{ {
abort_result_set(); abort_result_set();
DBUG_RETURN(true); DBUG_RETURN(true);
@@ -5436,7 +5473,8 @@ void select_create::abort_result_set()
{ {
bool tmp_table= table->s->tmp_table; bool tmp_table= table->s->tmp_table;
bool table_creation_was_logged= (!tmp_table || bool table_creation_was_logged= (!tmp_table ||
table->s->table_creation_was_logged); table->s->table_creation_was_logged ||
create_info->table_was_deleted);
/* CREATE SELECT failed. Remove all row events and clear caches */ /* CREATE SELECT failed. Remove all row events and clear caches */
thd->binlog_remove_rows_events(); thd->binlog_remove_rows_events();

View File

@@ -861,6 +861,8 @@ err:
thd->transaction->stmt.modified_non_trans_table); thd->transaction->stmt.modified_non_trans_table);
table->file->ha_release_auto_increment(); table->file->ha_release_auto_increment();
table->auto_increment_field_not_null= FALSE; table->auto_increment_field_not_null= FALSE;
if (thd->tmp_table_binlog_handled)
table->mark_as_not_binlogged(); // tmp table changes are not in binlog
thd->abort_on_warning= 0; thd->abort_on_warning= 0;
DBUG_RETURN(error); DBUG_RETURN(error);
} }
@@ -996,6 +998,7 @@ static bool write_execute_load_query_log_event(THD *thd, const sql_exchange* ex,
if (!(load_data_query= (char *)thd->strmake(query_str.ptr(), query_str.length()))) if (!(load_data_query= (char *)thd->strmake(query_str.ptr(), query_str.length())))
return TRUE; return TRUE;
thd->tmp_table_binlog_handled= 1;
Execute_load_query_log_event Execute_load_query_log_event
e(thd, load_data_query, query_str.length(), e(thd, load_data_query, query_str.length(),
(uint) (fname_start - 1), (uint) fname_end, (uint) (fname_start - 1), (uint) fname_end,

View File

@@ -530,6 +530,7 @@ void init_update_queries(void)
CF_SCHEMA_CHANGE; CF_SCHEMA_CHANGE;
sql_command_flags[SQLCOM_CREATE_SEQUENCE]= (CF_CHANGES_DATA | sql_command_flags[SQLCOM_CREATE_SEQUENCE]= (CF_CHANGES_DATA |
CF_REEXECUTION_FRAGILE | CF_REEXECUTION_FRAGILE |
CF_FORCE_ORIGINAL_BINLOG_FORMAT |
CF_AUTO_COMMIT_TRANS | CF_AUTO_COMMIT_TRANS |
CF_SCHEMA_CHANGE); CF_SCHEMA_CHANGE);
sql_command_flags[SQLCOM_CREATE_INDEX]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS | sql_command_flags[SQLCOM_CREATE_INDEX]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS |
@@ -7494,6 +7495,7 @@ void THD::reset_for_next_command(bool do_clear_error)
get_stmt_da()->reset_for_next_command(); get_stmt_da()->reset_for_next_command();
sent_row_count_for_statement= examined_row_count_for_statement= 0; sent_row_count_for_statement= examined_row_count_for_statement= 0;
accessed_rows_and_keys= 0; accessed_rows_and_keys= 0;
tmp_table_binlog_handled= 0;
reset_slow_query_state(0); reset_slow_query_state(0);

View File

@@ -44,7 +44,8 @@ struct TABLE_PAIR
static bool rename_tables(THD *thd, TABLE_LIST *table_list, static bool rename_tables(THD *thd, TABLE_LIST *table_list,
DDL_LOG_STATE *ddl_log_state, DDL_LOG_STATE *ddl_log_state,
bool skip_error, bool if_exits, bool skip_error, bool if_exits,
bool *force_if_exists); bool *force_if_exists,
bool *not_logged_temporary_tables);
/* /*
Every two entries in the table_list form a pair of original name and Every two entries in the table_list form a pair of original name and
@@ -55,7 +56,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent,
bool if_exists) bool if_exists)
{ {
bool error= 1; bool error= 1;
bool binlog_error= 0, force_if_exists; bool binlog_error= 0, force_if_exists, not_logged_temporary_tables;
TABLE_LIST *ren_table= 0; TABLE_LIST *ren_table= 0;
int to_table; int to_table;
const char *rename_log_table[2]= {NULL, NULL}; const char *rename_log_table[2]= {NULL, NULL};
@@ -163,7 +164,8 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent,
no other thread accesses this table. no other thread accesses this table.
*/ */
error= rename_tables(thd, table_list, &ddl_log_state, error= rename_tables(thd, table_list, &ddl_log_state,
0, if_exists, &force_if_exists); 0, if_exists, &force_if_exists,
&not_logged_temporary_tables);
if (likely(!silent && !error)) if (likely(!silent && !error))
{ {
@@ -181,9 +183,16 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent,
*/ */
thd->binlog_xid= thd->query_id; thd->binlog_xid= thd->query_id;
ddl_log_update_xid(&ddl_log_state, thd->binlog_xid); ddl_log_update_xid(&ddl_log_state, thd->binlog_xid);
binlog_error= write_bin_log(thd, TRUE, thd->query(), thd->query_length()); if (mysql_bin_log.is_open())
if (binlog_error) {
error= 1; if (not_logged_temporary_tables)
binlog_error= thd->binlog_renamed_tmp_tables(table_list);
else
binlog_error= write_bin_log(thd, TRUE, thd->query(),
thd->query_length());
if (binlog_error)
error= 1;
}
thd->binlog_xid= 0; thd->binlog_xid= 0;
thd->variables.option_bits= save_option_bits; thd->variables.option_bits= save_option_bits;
debug_crash_here("ddl_log_rename_after_binlog"); debug_crash_here("ddl_log_rename_after_binlog");
@@ -475,6 +484,8 @@ do_rename(THD *thd, const rename_param *param, DDL_LOG_STATE *ddl_log_state,
if_exists Don't give an error if table doesn't exists if_exists Don't give an error if table doesn't exists
force_if_exists Set to 1 if we have to log the query with 'IF EXISTS' force_if_exists Set to 1 if we have to log the query with 'IF EXISTS'
Otherwise set it to 0 Otherwise set it to 0
not_logged_temporary_tables Set to 1 if there was a temporary table in the statement
that was not in the binary logged.
DESCRIPTION DESCRIPTION
Take a table/view name from and odd list element and rename it to a Take a table/view name from and odd list element and rename it to a
@@ -489,13 +500,15 @@ do_rename(THD *thd, const rename_param *param, DDL_LOG_STATE *ddl_log_state,
static bool static bool
rename_tables(THD *thd, TABLE_LIST *table_list, DDL_LOG_STATE *ddl_log_state, rename_tables(THD *thd, TABLE_LIST *table_list, DDL_LOG_STATE *ddl_log_state,
bool skip_error, bool if_exists, bool *force_if_exists) bool skip_error, bool if_exists, bool *force_if_exists,
bool *not_logged_temporary_tables)
{ {
TABLE_LIST *ren_table, *new_table; TABLE_LIST *ren_table, *new_table;
List<TABLE_PAIR> tmp_tables; List<TABLE_PAIR> tmp_tables;
DBUG_ENTER("rename_tables"); DBUG_ENTER("rename_tables");
*force_if_exists= 0; *force_if_exists= 0;
*not_logged_temporary_tables= 0;
for (ren_table= table_list; ren_table; ren_table= new_table->next_local) for (ren_table= table_list; ren_table; ren_table= new_table->next_local)
{ {
@@ -517,6 +530,8 @@ rename_tables(THD *thd, TABLE_LIST *table_list, DDL_LOG_STATE *ddl_log_state,
if (do_rename_temporary(thd, ren_table, new_table)) if (do_rename_temporary(thd, ren_table, new_table))
goto revert_rename; goto revert_rename;
if (!ren_table->table->s->table_creation_was_logged)
*not_logged_temporary_tables= 1;
} }
else else
{ {

View File

@@ -103,7 +103,7 @@ class Enable_wsrep_ctas_guard
#endif #endif
const Lex_ident_column primary_key_name= "PRIMARY"_Lex_ident_column; const Lex_ident_column primary_key_name= "PRIMARY"_Lex_ident_column;
static const LEX_CSTRING generated_by_server= LEX_CSTRING generated_by_server=
{ STRING_WITH_LEN(" /* generated by server */") }; { STRING_WITH_LEN(" /* generated by server */") };
static const LEX_CSTRING SEQUENCE_clex_str= { STRING_WITH_LEN("SEQUENCE") }; static const LEX_CSTRING SEQUENCE_clex_str= { STRING_WITH_LEN("SEQUENCE") };
static const LEX_CSTRING TABLE_clex_str= { STRING_WITH_LEN("TABLE") }; static const LEX_CSTRING TABLE_clex_str= { STRING_WITH_LEN("TABLE") };
@@ -1381,11 +1381,12 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables,
built_trans_tmp_query.append(STRING_WITH_LEN("DROP TEMPORARY ")); built_trans_tmp_query.append(STRING_WITH_LEN("DROP TEMPORARY "));
built_trans_tmp_query.append(object_to_drop); built_trans_tmp_query.append(object_to_drop);
built_trans_tmp_query.append(' '); built_trans_tmp_query.append(' ');
if (thd->is_current_stmt_binlog_format_row() || if_exists) /*
{ Better to always use IF EXISTS for temporary tables to handle the case
is_drop_tmp_if_exists_added= true; where the slave died after it created it's temporary tables
built_trans_tmp_query.append(STRING_WITH_LEN("IF EXISTS ")); */
} is_drop_tmp_if_exists_added= true;
built_trans_tmp_query.append(STRING_WITH_LEN("IF EXISTS "));
built_non_trans_tmp_query.set_charset(system_charset_info); built_non_trans_tmp_query.set_charset(system_charset_info);
built_non_trans_tmp_query.copy(built_trans_tmp_query); built_non_trans_tmp_query.copy(built_trans_tmp_query);
} }
@@ -5268,10 +5269,12 @@ err:
thd->abort_on_warning= 0; thd->abort_on_warning= 0;
/* In RBR or readonly server we don't need to log CREATE TEMPORARY TABLE */ /* In RBR or readonly server we don't need to log CREATE TEMPORARY TABLE */
if (!result && create_info->tmp_table() && if (!result && create_info->tmp_table() && !thd->binlog_create_tmp_table())
(thd->is_current_stmt_binlog_format_row() || (opt_readonly && !thd->slave_thread)))
{ {
/* Note that table->s->table_creation_was_logged is not set! */ /*
Note that mark_created_temp_table was not called and thus
table->s->table_creation_was_logged is not set!
*/
DBUG_RETURN(result); DBUG_RETURN(result);
} }
@@ -5853,22 +5856,26 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
/* /*
We have to write the query before we unlock the tables. We have to write the query before we unlock the tables.
*/ */
if (thd->is_current_stmt_binlog_disabled()) if (thd->is_current_stmt_binlog_disabled() ||
(create_info->tmp_table() && !thd->binlog_create_tmp_table()))
goto err; goto err;
#ifdef ENABLE_WHEN_S3_CAN_CREATE_TABLES #ifdef ENABLE_WHEN_S3_CAN_CREATE_TABLES
/* /*
If we do a create based on a shared table, log the full create of the If we do a create based on a shared table or a not logged temporary table,
resulting table. This is needed as a shared table may look different log the full create of the resulting table. This is needed as a shared table
when the slave executes the command. may look different when the slave executes the command or the shared table
was never replicated to the slave.
*/ */
force_generated_create= force_generated_create=
(((src_table->table->file->partition_ht()->flags & ((((src_table->table->file->partition_ht()->flags &
HTON_TABLE_MAY_NOT_EXIST_ON_SLAVE) && HTON_TABLE_MAY_NOT_EXIST_ON_SLAVE) &&
src_table->table->s->db_type() != local_create_info.db_type)); src_table->table->s->db_type() != local_create_info.db_type)) ||
!src_table->table->s->table_creation_was_logged);
#endif #endif
force_generated_create|= !src_table->table->s->table_creation_was_logged;
if (thd->is_current_stmt_binlog_format_row() || force_generated_create) if (thd->is_binlog_format_row() || force_generated_create)
{ {
/* /*
Since temporary tables are not replicated under row-based Since temporary tables are not replicated under row-based
@@ -5994,16 +6001,19 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
if (create_info->tmp_table()) if (create_info->tmp_table())
{ {
thd->transaction->stmt.mark_created_temp_table(); thd->transaction->stmt.mark_created_temp_table();
if (!res && local_create_info.table) if (!res && local_create_info.table &&
thd->variables.binlog_format == BINLOG_FORMAT_STMT)
{ {
/* /*
Remember that tmp table creation was logged so that we know if Remember that tmp table creation was logged so that we know if
we should log a delete of it. we should log a delete of it.
*/ */
local_create_info.table->s->table_creation_was_logged= 1; local_create_info.table->s->table_creation_was_logged= 1;
do_logging= TRUE;
} }
} }
do_logging= TRUE; else
do_logging= TRUE;
} }
err: err:
@@ -10049,13 +10059,11 @@ simple_tmp_rename_or_index_change(THD *thd, TABLE_LIST *table_list,
if (likely(!error)) if (likely(!error))
{ {
/* /*
We do not replicate alter table statement on temporary tables under Only replicate temporary tables that has already been logged to the
ROW-based replication. binary log.
*/ */
if (!thd->is_current_stmt_binlog_format_row()) if (table->s->table_creation_was_logged)
{
error= write_bin_log(thd, true, thd->query(), thd->query_length()) != 0; error= write_bin_log(thd, true, thd->query(), thd->query_length()) != 0;
}
if (likely(!error)) if (likely(!error))
my_ok(thd); my_ok(thd);
} }
@@ -11911,8 +11919,6 @@ alter_copy:
} }
} }
new_table->s->table_creation_was_logged=
table->s->table_creation_was_logged;
/* Remove link to old table and rename the new one */ /* Remove link to old table and rename the new one */
thd->drop_temporary_table(table, NULL, true); thd->drop_temporary_table(table, NULL, true);
/* Should pass the 'new_name' as we store table name in the cache */ /* Should pass the 'new_name' as we store table name in the cache */
@@ -11934,7 +11940,7 @@ alter_copy:
DBUG_ASSERT(!partial_alter); // temporary table alter DBUG_ASSERT(!partial_alter); // temporary table alter
/* We don't replicate alter table statement on temporary tables */ /* We don't replicate alter table statement on temporary tables */
if (!thd->is_current_stmt_binlog_format_row() && if (!thd->is_binlog_format_row() &&
table_creation_was_logged && table_creation_was_logged &&
!binlog_as_create_select) !binlog_as_create_select)
{ {
@@ -11945,6 +11951,7 @@ alter_copy:
thd->binlog_xid= 0; thd->binlog_xid= 0;
if (tmp_error) if (tmp_error)
goto err_cleanup; goto err_cleanup;
new_table->s->table_creation_was_logged= 1;
} }
goto end_temporary; goto end_temporary;
} }
@@ -12174,7 +12181,7 @@ end_inplace:
DEBUG_SYNC(thd, "alter_table_before_main_binlog"); DEBUG_SYNC(thd, "alter_table_before_main_binlog");
DBUG_ASSERT(!(mysql_bin_log.is_open() && DBUG_ASSERT(!(mysql_bin_log.is_open() &&
thd->is_current_stmt_binlog_format_row() && thd->is_binlog_format_row() &&
(create_info->tmp_table()))); (create_info->tmp_table())));
if (start_alter_id) if (start_alter_id)
@@ -13598,7 +13605,7 @@ bool Sql_cmd_create_table_like::execute(THD *thd)
if (!check_engine(thd, create_table->db.str, if (!check_engine(thd, create_table->db.str,
create_table->table_name.str, create_table->table_name.str,
&create_info) && &create_info) &&
(!thd->is_current_stmt_binlog_format_row() || (!thd->is_binlog_format_row() ||
!create_info.tmp_table())) !create_info.tmp_table()))
{ {
if (thd->lex->sql_command == SQLCOM_CREATE_SEQUENCE && if (thd->lex->sql_command == SQLCOM_CREATE_SEQUENCE &&

View File

@@ -44,6 +44,7 @@ typedef struct st_key_cache KEY_CACHE;
typedef struct st_lock_param_type ALTER_PARTITION_PARAM_TYPE; typedef struct st_lock_param_type ALTER_PARTITION_PARAM_TYPE;
typedef struct st_order ORDER; typedef struct st_order ORDER;
typedef struct st_ddl_log_state DDL_LOG_STATE; typedef struct st_ddl_log_state DDL_LOG_STATE;
extern LEX_CSTRING generated_by_server;
enum enum_explain_filename_mode enum enum_explain_filename_mode
{ {

View File

@@ -457,8 +457,12 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref)
/* If it is a temporary table, no need to take locks. */ /* If it is a temporary table, no need to take locks. */
if (is_temporary_table(table_ref)) if (is_temporary_table(table_ref))
{ {
/* In RBR, the statement is not binlogged if the table is temporary. */ /*
binlog_stmt= !thd->is_current_stmt_binlog_format_row(); In RBR, the statement is not binlogged if the table is temporary or
table is not up to date in binlog.
*/
binlog_stmt= (!thd->is_binlog_format_row() &&
table_ref->table->s->using_binlog());
thd->close_unused_temporary_table_instances(table_ref); thd->close_unused_temporary_table_instances(table_ref);

View File

@@ -361,6 +361,7 @@ bool Sql_cmd_update::update_single_table(THD *thd)
bool used_key_is_modified= FALSE, transactional_table; bool used_key_is_modified= FALSE, transactional_table;
bool will_batch= FALSE; bool will_batch= FALSE;
bool can_compare_record; bool can_compare_record;
bool binlogged= 0;
int res; int res;
int error, loc_error; int error, loc_error;
ha_rows dup_key_found; ha_rows dup_key_found;
@@ -1275,7 +1276,8 @@ update_end:
if (likely(error < 0) || thd->transaction->stmt.modified_non_trans_table || if (likely(error < 0) || thd->transaction->stmt.modified_non_trans_table ||
thd->log_current_statement()) thd->log_current_statement())
{ {
if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) &&
table->s->using_binlog())
{ {
int errcode= 0; int errcode= 0;
if (likely(error < 0)) if (likely(error < 0))
@@ -1291,8 +1293,12 @@ update_end:
{ {
error=1; // Rollback update error=1; // Rollback update
} }
binlogged= 1;
} }
} }
if (!binlogged)
table->mark_as_not_binlogged();
DBUG_ASSERT(transactional_table || !updated || thd->transaction->stmt.modified_non_trans_table); DBUG_ASSERT(transactional_table || !updated || thd->transaction->stmt.modified_non_trans_table);
free_underlaid_joins(thd, select_lex); free_underlaid_joins(thd, select_lex);
delete file_sort; delete file_sort;
@@ -2526,10 +2532,12 @@ error:
void multi_update::abort_result_set() void multi_update::abort_result_set()
{ {
TABLE_LIST *cur_table;
/* the error was handled or nothing deleted and no side effects return */ /* the error was handled or nothing deleted and no side effects return */
if (unlikely(error_handled || if (unlikely(error_handled ||
(!thd->transaction->stmt.modified_non_trans_table && !updated))) (!thd->transaction->stmt.modified_non_trans_table && !updated)))
return; goto end;
/**************************************************************************** /****************************************************************************
@@ -2581,6 +2589,15 @@ void multi_update::abort_result_set()
thd->transaction->all.m_unsafe_rollback_flags|= thd->transaction->all.m_unsafe_rollback_flags|=
(thd->transaction->stmt.m_unsafe_rollback_flags & THD_TRANS::DID_WAIT); (thd->transaction->stmt.m_unsafe_rollback_flags & THD_TRANS::DID_WAIT);
DBUG_ASSERT(trans_safe || !updated || thd->transaction->stmt.modified_non_trans_table); DBUG_ASSERT(trans_safe || !updated || thd->transaction->stmt.modified_non_trans_table);
end:
/*
Mark all temporay tables as not completely binlogged
All future usage of these tables will enforce row level logging, which
ensures that all future usage of them enforces row level logging.
*/
for (cur_table= update_tables; cur_table; cur_table= cur_table->next_local)
cur_table->table->mark_as_not_binlogged();
} }

View File

@@ -663,11 +663,10 @@ static bool binlog_format_check(sys_var *self, THD *thd, set_var *var)
switching @@SESSION.binlog_format from MIXED to STATEMENT when there are switching @@SESSION.binlog_format from MIXED to STATEMENT when there are
open temp tables and we are logging in row format. open temp tables and we are logging in row format.
*/ */
if (thd->has_thd_temporary_tables() && if (thd->has_not_logged_temporary_tables() &&
var->type == OPT_SESSION && var->type == OPT_SESSION &&
var->save_result.ulonglong_value == BINLOG_FORMAT_STMT && var->save_result.ulonglong_value == BINLOG_FORMAT_STMT &&
((thd->variables.binlog_format == BINLOG_FORMAT_MIXED && (thd->variables.binlog_format == BINLOG_FORMAT_MIXED ||
thd->is_current_stmt_binlog_format_row()) ||
thd->variables.binlog_format == BINLOG_FORMAT_ROW)) thd->variables.binlog_format == BINLOG_FORMAT_ROW))
{ {
my_error(ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR, MYF(0)); my_error(ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR, MYF(0));
@@ -732,6 +731,36 @@ Sys_binlog_direct(
CMD_LINE(OPT_ARG), DEFAULT(FALSE), CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(binlog_direct_check)); NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(binlog_direct_check));
static bool binlog_create_tmp_format_check(sys_var *self, THD *thd,
set_var *var)
{
if (var->save_result.ulonglong_value == 0)
return true;
/*
Logging of temporary tables is always done in STATEMENT format.
Because of this MIXED implies STATEMENT.
*/
var->save_result.ulonglong_value|= (1 << BINLOG_FORMAT_STMT);
return false;
}
static Sys_var_on_access<Sys_var_set,
PRIV_SET_SYSTEM_VAR_BINLOG_FORMAT,
PRIV_SET_SYSTEM_VAR_BINLOG_FORMAT>
Sys_binlog_create_tmptable_format(
"create_tmp_table_binlog_formats",
"The binary logging formats under which the master will log "
"CREATE TEMPORARY statments to the binary log. If CREATE TEMPORARY "
"is not logged, all usage of the temporary table will be logged in "
"ROW format. Allowed values are STATEMENT or MIXED,STATEMENT",
SESSION_VAR(create_temporary_table_binlog_formats),
CMD_LINE(REQUIRED_ARG, OPT_BINLOG_FORMAT),
binlog_formats_create_tmp_names,
DEFAULT((ulong) (1 << BINLOG_FORMAT_STMT)),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(binlog_create_tmp_format_check));
static bool deprecated_explicit_defaults_for_timestamp(sys_var *self, THD *thd, static bool deprecated_explicit_defaults_for_timestamp(sys_var *self, THD *thd,
set_var *var) set_var *var)
{ {
@@ -1976,11 +2005,14 @@ check_gtid_domain_id(sys_var *self, THD *thd, set_var *var)
All binlogged statements on a temporary table must be binlogged in the All binlogged statements on a temporary table must be binlogged in the
same domain_id; it is not safe to run them in parallel in different same domain_id; it is not safe to run them in parallel in different
domains, temporary table must be exclusive to a single thread. domains, temporary table must be exclusive to a single thread.
In row-based binlogging, temporary tables do not end up in the binlog,
so there is no such issue. ToDo: When merging to next (non-GA) release, introduce a more specific
error that describes that the problem is changing gtid_domain_id with
open temporary tables in statement/mixed binlogging mode; it is not
really due to doing it inside a "transaction".
*/ */
if (thd->has_thd_temporary_tables() &&
!thd->is_current_stmt_binlog_format_row() && if (thd->has_logged_temporary_tables() &&
var->save_result.ulonglong_value != thd->variables.gtid_domain_id) var->save_result.ulonglong_value != thd->variables.gtid_domain_id)
{ {
my_error(ER_TEMPORARY_TABLES_PREVENT_SWITCH_GTID_DOMAIN_ID, my_error(ER_TEMPORARY_TABLES_PREVENT_SWITCH_GTID_DOMAIN_ID,

View File

@@ -846,6 +846,16 @@ struct TABLE_SHARE
uint default_expressions; uint default_expressions;
uint table_check_constraints, field_check_constraints; uint table_check_constraints, field_check_constraints;
/*
This is set for all normal tables and for temporary tables that have
the CREATE TABLE statement binary logged.
0 table is not in the binary log (not logged temporary table)
1 table create was logged (normal table or logged temp table)
2 table create was logged but not all changes are in the binary log.
ROW LOGGING will be used for the table.
*/
uint table_creation_was_logged;
uint rec_buff_length; /* Size of table->record[] buffer */ uint rec_buff_length; /* Size of table->record[] buffer */
uint keys; /* Number of KEY's for the engine */ uint keys; /* Number of KEY's for the engine */
@@ -898,8 +908,7 @@ struct TABLE_SHARE
bool crashed; bool crashed;
bool is_view; bool is_view;
bool can_cmp_whole_record; bool can_cmp_whole_record;
/* This is set for temporary tables where CREATE was binary logged */ bool binlog_not_up_to_date;
bool table_creation_was_logged;
bool non_determinstic_insert; bool non_determinstic_insert;
bool has_update_default_function; bool has_update_default_function;
bool can_do_row_logging; /* 1 if table supports RBR */ bool can_do_row_logging; /* 1 if table supports RBR */
@@ -1234,6 +1243,11 @@ struct TABLE_SHARE
void update_optimizer_costs(handlerton *hton); void update_optimizer_costs(handlerton *hton);
void update_engine_independent_stats(TABLE_STATISTICS_CB *stat); void update_engine_independent_stats(TABLE_STATISTICS_CB *stat);
bool histograms_exists(); bool histograms_exists();
/* True if changes for the table should be logged to binary log */
bool using_binlog()
{
return table_creation_was_logged == 1;
}
}; };
/* not NULL, but cannot be dereferenced */ /* not NULL, but cannot be dereferenced */
@@ -1990,6 +2004,17 @@ public:
#endif #endif
void find_constraint_correlated_indexes(); void find_constraint_correlated_indexes();
/* Mark that table is not up to date in binary log */
void mark_as_not_binlogged()
{
if (s->tmp_table && s->table_creation_was_logged == 1 &&
file->mark_trx_read_write_done)
{
/* Do not log anything more to binlog for this table */
s->table_creation_was_logged= 2;
}
}
/** Number of additional fields used in versioned tables */ /** Number of additional fields used in versioned tables */
#define VERSIONING_FIELDS 2 #define VERSIONING_FIELDS 2
}; };

View File

@@ -26,6 +26,7 @@
#include "log_event.h" /* Query_log_event */ #include "log_event.h" /* Query_log_event */
#include "sql_show.h" /* append_identifier */ #include "sql_show.h" /* append_identifier */
#include "sql_handler.h" /* mysql_ha_rm_temporary_tables */ #include "sql_handler.h" /* mysql_ha_rm_temporary_tables */
#include "sql_table.h" // generated_by_server
#include "rpl_rli.h" /* rpl_group_info */ #include "rpl_rli.h" /* rpl_group_info */
#define IS_USER_TABLE(A) ((A->tmp_table == TRANSACTIONAL_TMP_TABLE) || \ #define IS_USER_TABLE(A) ((A->tmp_table == TRANSACTIONAL_TMP_TABLE) || \
@@ -45,6 +46,55 @@ bool THD::has_thd_temporary_tables()
DBUG_RETURN(result); DBUG_RETURN(result);
} }
/**
Check if there is any temporary tables that has not been logged to binary
log.
If this is the case then statement based binary logging is not safe.
@result 0 All temporary tables are logged. Statement and row based
replication are safe.
@result 1 Some temporary tables are not logged. Statement based replication
is not safe.
*/
bool THD::has_not_logged_temporary_tables()
{
TABLE_SHARE *share;
if (temporary_tables)
{
All_tmp_tables_list::Iterator it(*temporary_tables);
while ((share= it++))
{
if (!share->using_binlog())
return 1;
}
}
return 0;
}
/**
Check if there is at least one temporary table that is logged to binary log.
@result 0 No temporary table changes are logged to binary log.
@result 1 At least one temporary table is logged to binary log.
*/
bool THD::has_logged_temporary_tables()
{
TABLE_SHARE *share;
if (temporary_tables)
{
All_tmp_tables_list::Iterator it(*temporary_tables);
while ((share= it++))
{
if (share->using_binlog())
return 1;
}
}
return 0;
}
/** /**
Create a temporary table, open it and return the TABLE handle. Create a temporary table, open it and return the TABLE handle.
@@ -794,6 +844,20 @@ void THD::mark_tmp_table_as_free_for_reuse(TABLE *table)
DBUG_ASSERT(table->s->tmp_table); DBUG_ASSERT(table->s->tmp_table);
/*
Ensure that table changes were either binary logged or the table
is marked as not up to date.
*/
if (!tmp_table_binlog_handled && // Not logged to binlog
table->s->using_binlog() && // Table should be using binlog
table->file->mark_trx_read_write_done) // Changes where done
{
/* We should only come here is binlog is not open */
DBUG_ASSERT(!mysql_bin_log.is_open());
/* Mark the table as not up to date */
table->mark_as_not_binlogged();
}
table->query_id= 0; table->query_id= 0;
table->file->ha_reset(); table->file->ha_reset();
@@ -1277,6 +1341,8 @@ void THD::close_temporary_table(TABLE *table)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
static const char drop_table_stub[]= "DROP TEMPORARY TABLE IF EXISTS ";
static const char rename_table_stub[]= "RENAME TABLE ";
/** /**
Write query log events with "DROP TEMPORARY TABLES .." for each pseudo Write query log events with "DROP TEMPORARY TABLES .." for each pseudo
@@ -1299,11 +1365,10 @@ bool THD::log_events_and_free_tmp_shares()
bool error= false; bool error= false;
bool found_user_tables= false; bool found_user_tables= false;
// Better add "IF EXISTS" in case a RESET MASTER has been done. // Better add "IF EXISTS" in case a RESET MASTER has been done.
const char stub[]= "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS ";
char buf[FN_REFLEN]; char buf[FN_REFLEN];
String s_query(buf, sizeof(buf), system_charset_info); String s_query(buf, sizeof(buf), system_charset_info);
s_query.copy(stub, sizeof(stub) - 1, system_charset_info); s_query.copy(drop_table_stub, sizeof(drop_table_stub) - 1, system_charset_info);
/* /*
Insertion sort of temporary tables by pseudo_thread_id to build ordered Insertion sort of temporary tables by pseudo_thread_id to build ordered
@@ -1383,7 +1448,7 @@ bool THD::log_events_and_free_tmp_shares()
/* /*
Reset s_query() if changed by previous loop. Reset s_query() if changed by previous loop.
*/ */
s_query.length(sizeof(stub) - 1); s_query.length(sizeof(drop_table_stub) - 1);
/* /*
Loop forward through all tables that belong to a common database Loop forward through all tables that belong to a common database
@@ -1420,9 +1485,11 @@ bool THD::log_events_and_free_tmp_shares()
variables.character_set_client= system_charset_info; variables.character_set_client= system_charset_info;
used|= THREAD_SPECIFIC_USED; used|= THREAD_SPECIFIC_USED;
Query_log_event qinfo(this, s_query.ptr(), s_query.length(s_query.length()-1); // remove trailing ','
s_query.length() - 1 /* to remove trailing ',' */, s_query.append(&generated_by_server);
false, true, false, 0);
Query_log_event qinfo(this, s_query.ptr(), s_query.length(),
false, true, false, 0);
qinfo.db= db.ptr(); qinfo.db= db.ptr();
qinfo.db_len= db.length(); qinfo.db_len= db.length();
variables.character_set_client= cs_save; variables.character_set_client= cs_save;
@@ -1473,6 +1540,54 @@ bool THD::log_events_and_free_tmp_shares()
} }
/*
Log drop of renamed temporary table to binary log
This function is only called by mysql_rename_table() if of there was
a rename of temporary table that was not in the binary log. These
tables are removed from the rename list.
Note that find_temporary_table_for_rename() has ensured that all
elements in table_list points to the same temporary table even
if the table exists in several places in the rename list.
*/
bool THD::binlog_renamed_tmp_tables(TABLE_LIST *table_list)
{
TABLE_LIST *old_table, *new_table;
char buf[FN_REFLEN];
String rename_query(buf, sizeof(buf), system_charset_info);
bool res= 0;
DBUG_ENTER("binlog_rename_of_changed_tmp_tables_to_binlog");
rename_query.copy(rename_table_stub, sizeof(rename_table_stub) - 1,
system_charset_info);
for (old_table= table_list; old_table; old_table= new_table->next_local)
{
new_table= old_table->next_local;
if (!old_table->table || // Normal table
old_table->table->s->table_creation_was_logged) // Normal or logged tmp
{
append_identifier(this, &rename_query, &old_table->db);
rename_query.append('.');
append_identifier(this, &rename_query, &old_table->table_name);
rename_query.append(" TO ", 4);
append_identifier(this, &rename_query, &new_table->db);
rename_query.append('.');
append_identifier(this, &rename_query, &new_table->table_name);
rename_query.append(',');
}
}
if (rename_query.length() > sizeof(rename_table_stub))
{
rename_query.length(rename_query.length()-1);
rename_query.append(generated_by_server);
res= write_bin_log(this, FALSE, rename_query.ptr(), rename_query.length());
}
DBUG_RETURN(res);
}
/** /**
Delete the files and free the specified table share. Delete the files and free the specified table share.

View File

@@ -3212,11 +3212,12 @@ THR_LOCK_DATA **ha_maria::store_lock(THD *thd,
We have to disable concurrent inserts for INSERT ... SELECT or We have to disable concurrent inserts for INSERT ... SELECT or
INSERT/UPDATE/DELETE with sub queries if we are using statement based INSERT/UPDATE/DELETE with sub queries if we are using statement based
logging. We take the safe route here and disable this for all commands logging. We take the safe route here and disable this for all commands
that only does reading that are not SELECT. that only does reading that are not SELECT or ALTER TABLE nolock.
*/ */
if (lock_type <= TL_READ_HIGH_PRIORITY && if (lock_type <= TL_READ_HIGH_PRIORITY &&
!thd->is_current_stmt_binlog_format_row() && !thd->is_current_stmt_binlog_format_row() &&
(sql_command != SQLCOM_SELECT && (sql_command != SQLCOM_SELECT &&
sql_command != SQLCOM_ALTER_TABLE &&
sql_command != SQLCOM_LOCK_TABLES) && sql_command != SQLCOM_LOCK_TABLES) &&
(thd->variables.option_bits & OPTION_BIN_LOG) && (thd->variables.option_bits & OPTION_BIN_LOG) &&
mysql_bin_log.is_open()) mysql_bin_log.is_open())