Debian Codegraph @

mysql-test/suite/rpl/t/rpl_binlog_failed_drop_table_myisam.test

raw
1 # ==== Purpose ====
2 #
3 # Check that when the exectuion of a DROP TABLE command with single table
4 # fails it should not be written to the binary log. Also test that when the
5 # execution of DROP TABLE command with multiple tables fails then the fact
6 # if it will be logged or not depends on if any non-InnoDB tables are
7 # involved (as failed InnoDB-only multi-table DROP TABLE will have no
8 # effect).
9 #
10 # The above also provides coverage for changes to binary logging of failed
11 # DROP TABLES implemented as part of WL#7743 "New data dictionary: changes
12 # to DDL-related parts of SE API".
13 #
14 # ==== Implementation ====
15 # Create a database `db1` on master and ignore this database on the slave side
16 # using --replicate-ignore-db=db1 --replicate-wild-ignore-table=db1.%. Now
17 # execute a DROP TABLE command with single table in it and the command should
18 # fail thanks to error injection. Check in the binlog that query should
19 # not be binlogged. Slave should also be up and running without any errors.
20 # Execute another DROP TABLE command with multiple InnoDB tables in the drop
21 # list which will also fail. Check that the query is not binlogged in this
22 # case (as the whole statement is rolled back). Finally, execute multi-table
23 # DROP TABLE command involving MyISAM table which fails after deleting it.
24 # Check that query gets written into the binary log and slave should not fail
25 # since query is filtered on it.
26 #
27 # ==== References ====
28 #
29 # Bug#21435502: DROP TABLE IF EXISTS MAY BRAKE REPLICATION IF SLAVE HAS
30 # REPLICATION FILTERS.
31 #
32 ################################################################################
33 --source include/master-slave.inc
34 -- source include/have_debug.inc
35
36 --source include/force_myisam_default.inc
37 --source include/have_myisam.inc
38
39 CREATE DATABASE `db1`;
40
41 USE `db1`;
42
43 CREATE TABLE `t0` (`ID` bigint(20) primary key) ENGINE=MyISAM;
44
45 CREATE TABLE `t1` (`ID` bigint(20) primary key) ENGINE=InnoDB;
46
47 CREATE TABLE `t2` (`ID` bigint(20) primary key) ENGINE=InnoDB;
48
49 # Save master position
50 --let $saved_master_pos=query_get_value('SHOW MASTER STATUS', Position, 1)
51
52
53 # Test a multiple table drop failure involving non-InnoDB table
54 SET SESSION DEBUG='+d,rm_table_no_locks_abort_after_atomic_tables';
55 --error ER_UNKNOWN_ERROR
56 DROP TABLE `t0`, `t1`, `t2`;
57 SET SESSION DEBUG='-d,rm_table_no_locks_abort_after_atomic_tables';
58
59 --let $binlog_start= $saved_master_pos
60 --source include/show_binlog_events.inc
61
62 --source include/sync_slave_sql_with_master.inc
63
64 --echo Cleanup
65 --source include/rpl_connection_master.inc
66 DROP DATABASE `db1`;
67
68 --source include/rpl_end.inc