Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.5
-
None
Description
The s3_slave_ignore_updates option is supposed to allow running a master-slave setup where both master and slave are pointed at the same S3 storage. Yet, in some scenarios, slave will drop the table, destroying the data that the master has put there.
Put this into suite/s3/rpl_a.cnf:
!include ../rpl/my.cnf
|
!include ./my.cnf
|
!include ./slave.cnf
|
|
[mysqld.2]
|
s3_slave_ignore_updates=1
|
|
[mysqld.1]
|
s3_replicate_alter_as_create_select=1
|
Put this into suite/s3/rpl_a.test:
--source include/have_s3.inc
|
--source include/have_innodb.inc
|
|
--source include/have_binlog_format_mixed.inc
|
--source include/master-slave.inc
|
|
--disable_warnings
|
drop table if exists ten, t100, t101;
|
--enable_warnings
|
|
create table ten(a int primary key);
|
insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
|
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 ten;
|
alter table t100 engine=s3;
|
|
select *, 'before slave start' from t100;
|
|
#
|
# Now, start the slave
|
#
|
connection slave;
|
start slave;
|
connection master;
|
|
--sync_slave_with_master
|
connection master;
|
|
flush tables;
|
select *, 'after slave start' from t100;
|
|
--sync_slave_with_master
|
|
# This will fail with an error:
|
# mysqltest: At line 49: query 'select *, 'after slave start' from
|
# t100' failed: 1146: Table 'test.t100' doesn't exist
|
select * from t100;
|
Debug printout on the slave (the printout patch: https://gist.github.com/spetrunia/a3a941eeec55273fc806bf88d872e6c3 )
AAA query start slave
AAA query create table ten(a int primary key)
AAA query insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9)
AAA query COMMIT
AAA query create /*or replace*/ table t100 (
pk varchar(100)
) engine = 'innodb'
AAA ha_s3::delete_table(./test/t100)
AAA query insert into t100 values ('old data')
AAA query alter table t100 engine=s3
AAA query DROP TABLE IF EXISTS `t100` /* generated by server */
AAA ha_s3::delete_table(./test/t100)
AAA query create /*or replace*/ table t100 (
pk varchar(100)
) engine= innodb
AAA query insert into t100 select 'new data' from ten
AAA query alter table t100 engine=s3
AAA query flush tables
Note that some of these statements might be ignored on the slave.
But also note the calls to ha_s3::delete_table().