[MDEV-23550] s3_slave_ignore_updates is broken Created: 2020-08-23  Updated: 2020-09-25

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - S3
Affects Version/s: 10.5
Fix Version/s: 10.5

Type: Bug Priority: Major
Reporter: Sergei Petrunia Assignee: Michael Widenius
Resolution: Unresolved Votes: 0
Labels: None


 Description   

S3 engine's s3_slave_ignore_updates=1 mode is broken.

The idea of this option is that the slave shall ignore update operations (e.g. CREATE TABLE, ALTER TABLE, etc), because the master has already made all the changes on S3.

But what if

  • the slave is lagging behind (and executing events e.g. from yesterday)
  • the master is using a different table definition today?

then, any statement that makes use of the table's definition will break.

Test case:

Put this into suite/s3/rpl_basic1.cnf

!include suite/rpl/rpl_1slave_base.cnf
!include include/default_client.cnf
 
[mysqld.1]
plugin-maturity=alpha
plugin-load-add=ha_s3.so
s3-host-name="s3.amazonaws.com"
s3-protocol-version="Amazon"
s3-bucket=...
s3-access-key=...
s3-secret-key=...
s3-region=...
 
[mysqld.2]
plugin-maturity=alpha
plugin-load-add=ha_s3.so
s3-host-name="s3.amazonaws.com"
s3-protocol-version="Amazon"
s3-bucket=...
s3-access-key=...
s3-secret-key=...
s3-region=...

Put this into suite/s3/rpl_basic1-slave.opt :

--s3_slave_ignore_updates=1

Put this into suite/s3/rpl_basic1.test

--source include/master-slave.inc
--sync_slave_with_master
 
connection master;
 
--disable_warnings
drop table if exists ten, t1;
--enable_warnings
 
--sync_slave_with_master
 
connection slave;
stop slave;
 
connection master;
 
create table ten(a int primary key);
insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 
create table t1 (a int, b int, c int);
insert into t1 select a,a,a from ten;
 
alter table t1 engine=s3;
create view v1 as select a,b from t1;
 
drop view v1;
drop table t1;
 
create table t1 (x int, y int, z int) ;
insert into t1 select a,a,a from ten;
alter table t1 engine=s3;
 
connection slave;
start slave;
 
connection master;
--sync_slave_with_master
 
select * from t1;
 
connection master;
drop table t1;
--sync_slave_with_master
--source include/rpl_end.inc

And run.

The test will fail with

mysqltest: At line 37: sync_slave_with_master failed: 'select 
master_pos_wait('master-bin.000001', 2389, 300, '')' 
returned NULL indicating slave SQL thread failure

and the slave will be stopped with:

Last_Error      Error 'Table 'test.t1' doesn't exist' on query. Default database:
 'test'.  Query: 'CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` 
SQL SECURITY  DEFINER VIEW `v1` AS select a,b from t1'


Generated at Thu Feb 08 09:23:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.