mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
71d263a198
This commit fixed the problems with S3 after the "DROP TABLE FORCE" changes. It also fixes all failing replication S3 tests. A slave is delayed if it is trying to execute replicated queries on a table that is already converted to S3 by the master later in the binlog. Fixes for replication events on S3 tables for delayed slaves: - INSERT and INSERT ... SELECT and CREATE TABLE are ignored but written to the binary log. UPDATE & DELETE will be fixed in a future commit. Other things: - On slaves with --s3-slave-ignore-updates set, allow S3 tables to be opened in read-write mode. This was done to be able to ignore-but-replicate queries like insert. Without this change any open of an S3 table failed with 'Table is read only' which is too early to be able to replicate the original query. - Errors are now printed if handler::extra() call fails in wait_while_tables_are_used(). - Error message for row changes are changed from HA_ERR_WRONG_COMMAND to HA_ERR_TABLE_READONLY. - Disable some maria_extra() calls for S3 tables. This could cause S3 tables to fail in some cases. - Added missing thr_lock_delete() to ma_open() in case of failure. - Removed from mysql_prepare_insert() the not needed argument 'table'.
115 lines
2.1 KiB
Text
115 lines
2.1 KiB
Text
--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
|