summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl/t/rpl_start_alter_restart_master.test
blob: ee2ff9cbfee386d7293cce9b8e7c53088a049635 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Test crashing of master after writing start alter into binary log.
#  And the doing the same alter again, to test on slave if that is successful
#   ====>  SA Crash SA CA Case
#
--source include/have_log_bin.inc
--source include/have_binlog_format_mixed.inc
--source include/have_innodb.inc
--source include/master-slave.inc
--source include/have_debug.inc

--connection slave
--source include/stop_slave.inc
CHANGE MASTER TO MASTER_USE_GTID=NO;
--source include/start_slave.inc

--connection slave
SET @old_debug_slave= @@global.debug;
stop slave;
--let $gtid_strict_mode= `select @@gtid_strict_mode`
--let $slave_parallel_threads= `select @@slave_parallel_threads`
--let $slave_parallel_mode= `select @@slave_parallel_mode`
SET GLOBAL slave_parallel_threads=4;
set global slave_parallel_mode=optimistic;
set global gtid_strict_mode=1;
start slave;

--connection master
call mtr.add_suppression("ALTER query started at .+ could not be completed");

SET @old_debug_master= @@global.debug;
--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase`
set binlog_alter_two_phase=true;
create table t3( a int primary key, b int) engine=innodb;

--connection master
--sync_slave_with_master
--source include/stop_slave.inc


--connection master
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET SESSION debug_dbug="d,start_alter_kill_after_binlog";
--error 2013
alter table t3 add column d int;

--let $rpl_server_number= 1
--source include/rpl_reconnect.inc
set binlog_alter_two_phase= true;
alter table t3 add column d int;
show create table t3;
--source include/show_binlog_events.inc
--let $binlog_file=master-bin.000002
--source include/show_binlog_events.inc
--let $binlog_file=

--connection slave
--source include/start_slave.inc

--connection master
--sync_slave_with_master
--source include/show_binlog_events.inc
show create table t3;


--connection master
SET GLOBAL debug_dbug= @old_debug_master;
drop table t3;
--eval set global binlog_alter_two_phase = $binlog_alter_two_phase

--sync_slave_with_master
SET GLOBAL debug_dbug= @old_debug_slave;
stop slave;
--eval set global slave_parallel_threads = $slave_parallel_threads;
--eval set global slave_parallel_mode = $slave_parallel_mode;
--eval set global gtid_strict_mode = $gtid_strict_mode;
start slave;
--connection master
let MYSQLD_DATADIR= `select @@datadir;`;
--remove_files_wildcard $MYSQLD_DATADIR/test #sql*.frm
--source include/rpl_end.inc