mirror of
https://github.com/MariaDB/server.git
synced 2025-07-12 14:28:13 +02:00
170 lines
4 KiB
Text
170 lines
4 KiB
Text
--source include/have_s3.inc
|
|
--source include/have_partition.inc
|
|
--source include/have_binlog_format_mixed.inc
|
|
--source include/have_innodb.inc
|
|
--source include/have_sequence.inc
|
|
--source include/master-slave.inc
|
|
--source create_database.inc
|
|
|
|
sync_slave_with_master;
|
|
|
|
if (`select @@s3_slave_ignore_updates <> 1`)
|
|
{
|
|
die "Slave is not configured with s3-slave-ignore-updates=1";
|
|
}
|
|
|
|
let $MYSQLD_DATADIR= `select @@datadir`;
|
|
--replace_result $database database
|
|
--eval use $database
|
|
connection master;
|
|
|
|
--echo #
|
|
--echo # Check replication of partitioned S3 tables
|
|
--echo #
|
|
|
|
CREATE TABLE t1 (
|
|
c1 INT DEFAULT NULL
|
|
) ENGINE=Aria
|
|
PARTITION BY HASH (c1)
|
|
PARTITIONS 3;
|
|
INSERT INTO t1 VALUE (1), (2), (101), (102), (201), (202);
|
|
ALTER TABLE t1 ENGINE=S3;
|
|
sync_slave_with_master;
|
|
connection master;
|
|
ALTER TABLE t1 ADD PARTITION PARTITIONS 6;
|
|
select sum(c1) from t1;
|
|
sync_slave_with_master;
|
|
connection master;
|
|
ALTER TABLE t1 ADD COLUMN c INT;
|
|
select sum(c1) from t1;
|
|
sync_slave_with_master;
|
|
show create table t1;
|
|
select sum(c1) from t1;
|
|
connection master;
|
|
drop table t1;
|
|
|
|
--echo #
|
|
--echo # Checking that the slave is keeping in sync with changed partitions
|
|
--echo #
|
|
|
|
CREATE TABLE t1 (
|
|
c1 int primary key,
|
|
c2 int DEFAULT NULL
|
|
) ENGINE=InnoDB
|
|
PARTITION BY RANGE (c1)
|
|
(PARTITION p1 VALUES LESS THAN (200),
|
|
PARTITION p2 VALUES LESS THAN (300),
|
|
PARTITION p3 VALUES LESS THAN (400));
|
|
insert into t1 select seq*100,seq*100 from seq_1_to_3;
|
|
alter table t1 engine=S3;
|
|
show create table t1;
|
|
|
|
sync_slave_with_master;
|
|
select sum(c1) from t1;
|
|
--file_exists $MYSQLD_DATADIR/$database/t1.frm
|
|
--file_exists $MYSQLD_DATADIR/$database/t1.par
|
|
stop slave;
|
|
connection master;
|
|
ALTER TABLE t1 ADD PARTITION (PARTITION p4 VALUES LESS THAN (500));
|
|
connection slave;
|
|
show create table t1;
|
|
select sum(c1) from t1;
|
|
start slave;
|
|
connection master;
|
|
sync_slave_with_master;
|
|
select sum(c1)+0 from t1;
|
|
stop slave;
|
|
|
|
# Ensure the slave is using the new table
|
|
show create table t1;
|
|
|
|
connection master;
|
|
drop table t1;
|
|
connection slave;
|
|
--file_exists $MYSQLD_DATADIR/$database/t1.par
|
|
--replace_result $database database
|
|
--error ER_NO_SUCH_TABLE
|
|
select sum(c1) from t1;
|
|
--error 1
|
|
--file_exists $MYSQLD_DATADIR/$database/t1.par
|
|
start slave;
|
|
connection master;
|
|
sync_slave_with_master;
|
|
connection master;
|
|
|
|
--echo #
|
|
--echo # Check altering partitioned table to S3 and back
|
|
--echo # Checks also rename partitioned table and drop partition
|
|
--echo #
|
|
|
|
CREATE TABLE t2 (
|
|
c1 int primary key,
|
|
c2 int DEFAULT NULL
|
|
) ENGINE=InnoDB
|
|
PARTITION BY RANGE (c1)
|
|
(PARTITION p1 VALUES LESS THAN (200),
|
|
PARTITION p2 VALUES LESS THAN (300),
|
|
PARTITION p3 VALUES LESS THAN (400));
|
|
insert into t2 select seq*100,seq*100 from seq_1_to_3;
|
|
alter table t2 engine=S3;
|
|
rename table t2 to t1;
|
|
alter table t1 drop partition p1;
|
|
sync_slave_with_master;
|
|
select sum(c1) from t1;
|
|
connection master;
|
|
alter table t1 engine=innodb;
|
|
sync_slave_with_master;
|
|
select sum(c1) from t1;
|
|
connection master;
|
|
drop table t1;
|
|
|
|
--echo #
|
|
--echo # Check that slaves ignores changes to S3 tables.
|
|
--echo #
|
|
|
|
connection master;
|
|
CREATE TABLE t1 (
|
|
c1 int primary key,
|
|
c2 int DEFAULT NULL
|
|
) ENGINE=InnoDB
|
|
PARTITION BY RANGE (c1)
|
|
(PARTITION p1 VALUES LESS THAN (200),
|
|
PARTITION p2 VALUES LESS THAN (300),
|
|
PARTITION p3 VALUES LESS THAN (400));
|
|
insert into t1 select seq*100,seq*100 from seq_1_to_3;
|
|
create table t2 like t1;
|
|
alter table t2 remove partitioning;
|
|
insert into t2 values (450,450);
|
|
sync_slave_with_master;
|
|
stop slave;
|
|
connection master;
|
|
alter table t1 engine=s3;
|
|
alter table t2 engine=s3;
|
|
ALTER TABLE t1 ADD PARTITION (PARTITION p4 VALUES LESS THAN (500));
|
|
alter table t1 exchange partition p4 with table t2;
|
|
select count(*) from t1;
|
|
drop table t1,t2;
|
|
connection slave;
|
|
start slave;
|
|
connection master;
|
|
sync_slave_with_master;
|
|
--replace_result $database database
|
|
--error ER_NO_SUCH_TABLE
|
|
select sum(c1) from t1;
|
|
connection master;
|
|
|
|
--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
|
|
sync_slave_with_master;
|
|
--source include/rpl_end.inc
|