MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rpl_mixed_ddl.inc
1 #########################################
2 # Purpose: testing the replication in mixed mode
3 # Requirements: define binlog format for mysqld as in example below:
4 # ./mysql-test-run.pl --mysqld=--binlog-format=mixed
5 #########################################
6 
7 --source include/master-slave.inc
8 
9 # Check MIXED on both master and slave
10 connection master;
11 --echo ==========MASTER==========
12 --source suite/rpl/include/rpl_mixed_show_binlog_format.inc
13 connection slave;
14 --echo ==========SLAVE===========
15 --source suite/rpl/include/rpl_mixed_show_binlog_format.inc
16 connection master;
17 
18 
19 # DDL for databases
20 --echo
21 --echo ******************** DDL for database ********************
22 --disable_warnings
23 DROP DATABASE IF EXISTS test_rpl;
24 DROP DATABASE IF EXISTS test_rpl_1;
25 --enable_warnings
26 CREATE DATABASE test_rpl_1 CHARACTER SET utf8 COLLATE utf8_general_ci;
27 ALTER DATABASE test_rpl_1 CHARACTER SET latin1 COLLATE latin1_general_ci;
28 DROP DATABASE test_rpl_1;
29 CREATE DATABASE test_rpl CHARACTER SET utf8 COLLATE utf8_general_ci;
30 ALTER DATABASE test_rpl CHARACTER SET latin1 COLLATE latin1_swedish_ci;
31 --source suite/rpl/include/rpl_mixed_check_db.inc
32 
33 USE test_rpl;
34 
35 # DDL for tables
36 --echo
37 --echo ******************** DDL for tables ********************
38 eval CREATE TABLE t0 (a int auto_increment not null, c int not null, PRIMARY KEY(a), KEY index2 (c)) ENGINE=$engine_type;
39 ALTER TABLE t0 DROP INDEX index2;
40 ALTER TABLE t0 ADD COLUMN b char(254);
41 ALTER TABLE t0 ADD INDEX index1 (b);
42 ALTER TABLE t0 DROP COLUMN c;
43 RENAME TABLE t0 TO t1;
44 CREATE TABLE t2 LIKE t1;
45 --source suite/rpl/include/rpl_mixed_check_table.inc
46 
47 # DDL for logfiles
48 # skipped
49 
50 # DDL for tablespaces
51 # skipped
52 
53 # DDL for indexes
54 --echo
55 --echo ******************** DDL for indexes ********************
56 ALTER TABLE t2 ADD COLUMN d datetime;
57 CREATE INDEX index2 on t2 (d);
58 CREATE INDEX index3 on t2 (a, d);
59 --source suite/rpl/include/rpl_mixed_check_table.inc
60 ALTER TABLE t2 DROP COLUMN d;
61 
62 
63 # BINLOG EVENTS
64 --echo
65 --echo
66 --echo ******************** SHOW BINLOG EVENTS ********************
67 source include/show_binlog_events.inc;
68 sync_slave_with_master;
69 # as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
70 --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test_rpl > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
71 --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test_rpl > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
72 
73 connection master;
74 drop database test_rpl;
75 sync_slave_with_master;
76 
77 # Let's compare. Note: If they match test will pass, if they do not match
78 # the test will show that the diff statement failed and not reject file
79 # will be created. You will need to go to the mysql-test dir and diff
80 # the files your self to see what is not matching
81 
82 --diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
83 --source include/rpl_end.inc