summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/s3/replication_delayed.test
blob: 0ae93b850c4377539caee535beed1dc04c71092d (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
--source include/have_s3.inc
--source include/have_innodb.inc
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
--source include/have_sequence.inc

# First clear the binlog
set binlog_format=mixed;
RESET MASTER;
connection slave;
set binlog_format=mixed;
RESET MASTER;
connection master;

#
# Create unique database for running the tests
#
--source create_database.inc
sync_slave_with_master;
--replace_result $database database
--eval use $database
connection master;

--echo #
--echo # MDEV-23691 S3 storage engine: delayed slave can drop the table
--echo #

connection slave;
stop slave;
connection master;

#
# Create version 1 of the table
#

create /*or replace*/ table t100 (
  pk varchar(100)
) engine = 'innodb';

insert into t100 values ('old data');
alter table t100 engine=s3;

#
# Create version 2 of the table
#
drop table t100;
create /*or replace*/ table t100 (
  pk varchar(100)
) engine= innodb;
insert into t100 select 'new data' from seq_1_to_10;
alter table t100 engine=s3;

select count(*), 'before slave start' from t100;

#
#  Now, start the slave
#
connection slave;
start slave;
connection master;
sync_slave_with_master;
#select count(*) from t100;
connection master;

flush tables;
select count(*), 'after slave start' from t100;
show create table t100;

connection slave;

select count(*) from t100;

connection master;

drop table t100;

--echo #
--echo # Test delayed slave with inserts
--echo #


# Stop slave

connection slave;
stop slave;
connection master;

# Create tables with data while slave is stopped
create table t1 (a int) engine=innodb;
insert into t1 values (1),(2),(3);
insert into t1 select * from seq_4_to_6;
alter table t1 engine=s3;

connection slave;
start slave;
connection master;
sync_slave_with_master;
select * from t1;
connection master;
drop table t1;

--echo #
--echo # Check slave binary log
--echo #

sync_slave_with_master;
--let $binlog_database=$database
--source include/show_binlog_events.inc
connection master;

--echo #
--echo # clean up
--echo #
--source drop_database.inc
--source include/rpl_end.inc