summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/rpl/t/rpl_alter_online_debug.test
blob: b257ce29ef31489fb8b335956fdf8bdd1472ec65 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
source include/have_debug_sync.inc;
source include/have_innodb.inc;
source include/master-slave.inc;

--connection master
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");

--connection slave
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");

#
# Single-phase alter
#

--echo # MDEV-31804 Assertion `thd->m_transaction_psi == __null' fails upon
--echo # replicating online ALTER
--connection master
create table t (a char(8)) engine=myisam;
insert into t values ('foo'),('bar');

set debug_sync= 'alter_table_online_progress signal go_dml wait_for go_alter';
set @old_slave_exec_mode= @@global.slave_exec_mode;
set @@global.slave_exec_mode= idempotent;
send alter table t force;

--connection master1
set debug_sync= 'now wait_for go_dml';
insert into t (a) values ('qux');
set debug_sync= 'now signal go_alter';

--connection master
--reap
--sync_slave_with_master

# Cleanup
--connection master
drop table t;
set global slave_exec_mode= @old_slave_exec_mode;
set debug_sync= reset;


--echo #
--echo # End of 11.2 tests (Single-phase alter)
--echo #


#
# Two-phase alter
#
--connection slave
source include/stop_slave.inc;
--let $slave_parallel_threads=`select @@global.slave_parallel_threads`
--let $slave_parallel_mode=   `select @@global.slave_parallel_mode`
--let $binlog_row_image= `select @@global.binlog_row_image`
set global slave_parallel_threads=3;
set global slave_parallel_mode= optimistic;
set global binlog_row_image=MINIMAL;
--connection master


--echo #
--echo # MDEV-31755 Replica's DML event deadlocks wit online alter table
--echo #
--echo # Three threads for SA,U,CA

create table t (id int, a int, primary key (id)) engine=innodb;
insert into t values (1,10), (2,20);

set @@session.binlog_alter_two_phase=1;
set debug_sync= 'alter_table_online_downgraded signal ready wait_for go';
send alter table t add c text default('qqq') after id, algorithm=copy, lock=none;

--connection master1
set debug_sync= 'now wait_for ready';

update t set a = 1;

set debug_sync= 'now signal go';

--connection master
--reap
--source include/save_master_gtid.inc

--connection slave
source include/start_slave.inc;
--source include/sync_with_master_gtid.inc
select * from t;

# Cleanup
--connection master
drop table t;

--echo # MDEV-31838 Assertion fails on replica upon parallel
--echo # replication with two-phase alter and MINIMAL row image
create table t (id int, a int, primary key(id)) engine=aria;
insert into t values (1,0);

set @@session.binlog_alter_two_phase=1;
set debug_sync= 'alter_table_online_progress signal go_dml wait_for go_alter';
send alter table t force, algorithm=copy, lock=none;

--connection master1
set binlog_row_image=MINIMAL;
set debug_sync= 'now wait_for go_dml';
--disable_warnings
update ignore t set a = 1;
--enable_warnings
set debug_sync= 'now signal go_alter';

# Cleanup
--connection master
--reap
drop table t;
--sync_slave_with_master
--connection master

--echo #
--echo # End of 11.2 tests (Two-phase alter)
--echo #

--connection slave
source include/stop_slave.inc;
--eval set global binlog_row_image=$binlog_row_image
--eval set global slave_parallel_threads=$slave_parallel_threads
--eval set global slave_parallel_mode=   $slave_parallel_mode
source include/start_slave.inc;

--source include/rpl_end.inc