| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Test verifies that failed CREATE OR REPLACE TEMPORARY TABLE statement which |
| 4 |
# dropped the table but failed at a later stage of creation of temporary table |
| 5 |
# is written to binarylog in row based replication. |
| 6 |
# |
| 7 |
# ==== Implementation ==== |
| 8 |
# |
| 9 |
# Steps: |
| 10 |
# 0 - Have mixed based replication mode. |
| 11 |
# 1 - Create a temporary table. It will be replicated as mixed replication |
| 12 |
# mode is in use. |
| 13 |
# 2 - Execute an unsafe statement which will switch current statement |
| 14 |
# binlog format to 'ROW'. i.e If binlog_format=MIXED, there are open |
| 15 |
# temporary tables, and an unsafe statement is executed, then subsequent |
| 16 |
# statements are logged in row format. |
| 17 |
# 3 - Execute a CREATE OR REPLACE TEMPORARY TABLE statement which tries to |
| 18 |
# create partitions on temporary table. Since it is not supported it will |
| 19 |
# fail. |
| 20 |
# 4 - Check the binary log output to ensure that the failed statement is |
| 21 |
# written to the binary log. |
| 22 |
# 5 - Slave should be up and running and in sync with master. |
| 23 |
# |
| 24 |
# ==== References ==== |
| 25 |
# |
| 26 |
# MDEV-18930: Failed CREATE OR REPLACE TEMPORARY not written into binary log |
| 27 |
# makes data on master and slave diverge |
| 28 |
# |
| 29 |
|
| 30 |
--source include/have_partition.inc |
| 31 |
--source include/have_binlog_format_mixed.inc |
| 32 |
--source include/master-slave.inc |
| 33 |
|
| 34 |
CREATE TEMPORARY TABLE t1 (a INT NOT NULL); |
| 35 |
|
| 36 |
# Execute an unsafe statement which switches replication mode internally from |
| 37 |
# "STATEMENT" to "ROW". |
| 38 |
--error ER_NO_SUCH_TABLE |
| 39 |
LOAD DATA INFILE 'x' INTO TABLE x; |
| 40 |
|
| 41 |
--error ER_FEATURE_NOT_SUPPORTED_WITH_PARTITIONING |
| 42 |
CREATE OR REPLACE TEMPORARY TABLE t1 (x INT) PARTITION BY HASH(x); |
| 43 |
|
| 44 |
--echo "************** DROP TEMPORARY TABLE Should be present in Binary log **************" |
| 45 |
--source include/show_binlog_events.inc |
| 46 |
|
| 47 |
CREATE TABLE t1 (b INT); |
| 48 |
INSERT INTO t1 VALUES (NULL); |
| 49 |
--sync_slave_with_master |
| 50 |
|
| 51 |
# Cleanup |
| 52 |
--connection master |
| 53 |
DROP TABLE t1; |
| 54 |
|
| 55 |
--source include/rpl_end.inc |
| 56 |
|