Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
8fbad587
Commit
8fbad587
authored
Jan 31, 2024
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-33342 Add a replication MTR test cloning the slave with mariadb-backup
parent
68c1fbfc
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
437 additions
and
0 deletions
+437
-0
mysql-test/suite/mariabackup/rpl_clone_slave.result
mysql-test/suite/mariabackup/rpl_clone_slave.result
+190
-0
mysql-test/suite/mariabackup/rpl_clone_slave.test
mysql-test/suite/mariabackup/rpl_clone_slave.test
+247
-0
No files found.
mysql-test/suite/mariabackup/rpl_clone_slave.result
0 → 100644
View file @
8fbad587
include/master-slave.inc
[connection master]
#
# MDEV-33342 Add a replication MTR test cloning the slave with mariadb-backup
#
connection master;
connection slave;
##############################################################
### Initial block with some transactions
### Slave: Make sure replication is not using GTID
connection slave;
# Using_Gtid=No
### Master: Create and populate t1
connection master;
CREATE TABLE t1(a TEXT) ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO t1 VALUES ('tr#00:stmt#00 - slave run#0, before backup');
INSERT INTO t1 VALUES ('tr#00:stmt#01 - slave run#0, before backup');
INSERT INTO t1 VALUES ('tr#00:stmt#02 - slave run#0, before backup');
COMMIT;
connection slave;
##############################################################
### Run the last transaction before mariadb-backup --backup
### Remember SHOW MASTER STATUS and @@gtid_binlog_pos
### before and after the transaction.
### Master: Rember MASTER STATUS and @@gtid_binlog_pos before tr#01
connection master;
### Slave: Remember MASTER STATUS and @@gtid_binlog_pos before tr#01
connection slave;
### Master: Run the actual last transaction before the backup
connection master;
START TRANSACTION;
INSERT INTO t1 VALUES ('tr#01:stmt#00 - slave run#0, before backup');
INSERT INTO t1 VALUES ('tr#01:stmt#01 - slave run#0, before backup');
INSERT INTO t1 VALUES ('tr#01:stmt#02 - slave run#0, before backup');
COMMIT;
connection slave;
### Master: Remember MASTER STATUS and @@gtid_binlog_pos after tr#01
connection master;
### Slave: Remember MASTER STATUS and @@gtid_binlog_pos after tr#01
connection slave;
##############################################################
### Running `mariadb-backup --backup,--prepare` and checking
### that xtrabackup_slave_info and xtrabackup_binlog_info are OK
### Slave: Create a backup
### Slave: Prepare the backup
### Slave: xtrabackup files:
############################ xtrabackup_slave_info
CHANGE MASTER TO MASTER_LOG_FILE='master_after_tr01_show_master_status_file', MASTER_LOG_POS=master_after_tr01_show_master_status_position;
############################ xtrabackup_binlog_info
slave_after_tr01_show_master_status_file slave_after_tr01_show_master_status_position slave_after_tr01_gtid_binlog_pos
############################
##############################################################
### Run more transactions after the backup:
### - while the slave is still running, then
### - while the slave is shut down
### Master: Run another transaction while the slave is still running
connection master;
START TRANSACTION;
INSERT INTO t1 VALUES ('tr#02:stmt#00 - slave run#0, after backup');
INSERT INTO t1 VALUES ('tr#02:stmt#01 - slave run#0, after backup');
INSERT INTO t1 VALUES ('tr#02:stmt@02 - slave run#0, after backup');
COMMIT;
connection slave;
### Master: Remember MASTER STATUS and @@gtid_binlog_pos after tr#02
connection master;
### Slave: Remember MASTER STATUS and @@gtid_binlog_pos after tr#02
connection slave;
### Master: Checking SHOW BINLOG EVENTS
connection master;
SHOW BINLOG EVENTS FROM master_after_tr01_show_master_status_position LIMIT 0,1;
Log_name master_after_tr01_show_master_status_file
Pos master_after_tr01_show_master_status_position
Event_type Gtid
Server_id #
End_log_pos #
Info BEGIN GTID master_after_tr02_gtid_binlog_pos
SHOW BINLOG EVENTS FROM master_after_tr01_show_master_status_position LIMIT 1,1;
Log_name master_after_tr01_show_master_status_file
Pos #
Event_type Query_or_Annotate_rows
Server_id #
End_log_pos #
Info INSERT INTO t1 VALUES ('tr#02:stmt#00 - slave run#0, after backup')
### Slave: Checking SHOW BINLOG EVENTS
connection slave;
SHOW BINLOG EVENTS FROM slave_after_tr01_show_master_status_position LIMIT 0,1;
Log_name slave_after_tr01_show_master_status_file
Pos #
Event_type Gtid
Server_id 1
End_log_pos #
Info BEGIN GTID slave_after_tr02_gtid_binlog_pos
SHOW BINLOG EVENTS FROM slave_after_tr01_show_master_status_position LIMIT 1,1;
Log_name slave_after_tr01_show_master_status_file
Pos #
Event_type Query_or_Annotate_rows
Server_id #
End_log_pos #
Info INSERT INTO t1 VALUES ('tr#02:stmt#00 - slave run#0, after backup')
### Slave: Shutdown the server
include/rpl_stop_server.inc [server_number=2]
### Master: Run a transaction while the slave is shut down
connection master;
START TRANSACTION;
INSERT INTO t1 VALUES ('tr#03:stmt#00 - after slave run#0, slave is shut down, after backup');
INSERT INTO t1 VALUES ('tr#03:stmt#01 - after slave run#0, slave is shut down, after backup');
INSERT INTO t1 VALUES ('tr#03:stmt#02 - after slave run#0, slave is shut down, after backup');
COMMIT;
##############################################################
### Emulate starting a new virgin slave
### Slave: Remove the data directory
### Slave: Copy back the backup
### Slave: Restart the server
include/rpl_start_server.inc [server_number=2]
connection slave;
### Slave: Display the restored data before START SLAVE
connection slave;
SELECT * FROM t1 ORDER BY a;
a
tr#00:stmt#00 - slave run#0, before backup
tr#00:stmt#01 - slave run#0, before backup
tr#00:stmt#02 - slave run#0, before backup
tr#01:stmt#00 - slave run#0, before backup
tr#01:stmt#01 - slave run#0, before backup
tr#01:stmt#02 - slave run#0, before backup
### Slave: Execute the CHANGE MASTER statement to set up the host and port
CHANGE MASTER '' TO MASTER_USER='root', MASTER_HOST='127.0.0.1', MASTER_PORT=###, MASTER_CONNECT_RETRY=1;
### Slave: Execute the CHANGE MASTER statement from xtrabackup_slave_info
CHANGE MASTER TO MASTER_LOG_FILE='master_after_tr01_show_master_status_file', MASTER_LOG_POS=master_after_tr01_show_master_status_position;
### Slave: Execute START SLAVE
include/start_slave.inc
### Master: Wait for the slave to apply all master events
connection master;
connection slave;
### Slave: Make sure replication is not using GTID after the slave restart
connection slave;
# Using_Gtid=No
### Slave: Display the restored data after START SLAVE
connection slave;
SELECT * FROM t1 ORDER BY a;
a
tr#00:stmt#00 - slave run#0, before backup
tr#00:stmt#01 - slave run#0, before backup
tr#00:stmt#02 - slave run#0, before backup
tr#01:stmt#00 - slave run#0, before backup
tr#01:stmt#01 - slave run#0, before backup
tr#01:stmt#02 - slave run#0, before backup
tr#02:stmt#00 - slave run#0, after backup
tr#02:stmt#01 - slave run#0, after backup
tr#02:stmt@02 - slave run#0, after backup
tr#03:stmt#00 - after slave run#0, slave is shut down, after backup
tr#03:stmt#01 - after slave run#0, slave is shut down, after backup
tr#03:stmt#02 - after slave run#0, slave is shut down, after backup
##############################################################
### Continue master transactions, check the new slave replicates well.
### Master: Run a transaction after restarting replication
connection master;
START TRANSACTION;
INSERT INTO t1 VALUES ('tr#04:stmt#00 - slave run#1');
INSERT INTO t1 VALUES ('tr#04:stmt#01 - slave run#1');
INSERT INTO t1 VALUES ('tr#04:stmt#02 - slave run#1');
COMMIT;
connection slave;
### Slave: Display the restored data + new transactions
connection slave;
SELECT * FROM t1 ORDER BY a;
a
tr#00:stmt#00 - slave run#0, before backup
tr#00:stmt#01 - slave run#0, before backup
tr#00:stmt#02 - slave run#0, before backup
tr#01:stmt#00 - slave run#0, before backup
tr#01:stmt#01 - slave run#0, before backup
tr#01:stmt#02 - slave run#0, before backup
tr#02:stmt#00 - slave run#0, after backup
tr#02:stmt#01 - slave run#0, after backup
tr#02:stmt@02 - slave run#0, after backup
tr#03:stmt#00 - after slave run#0, slave is shut down, after backup
tr#03:stmt#01 - after slave run#0, slave is shut down, after backup
tr#03:stmt#02 - after slave run#0, slave is shut down, after backup
tr#04:stmt#00 - slave run#1
tr#04:stmt#01 - slave run#1
tr#04:stmt#02 - slave run#1
##############################################################
### Cleanup
### Removing the backup directory
connection master;
DROP TABLE t1;
connection slave;
include/rpl_end.inc
mysql-test/suite/mariabackup/rpl_clone_slave.test
0 → 100644
View file @
8fbad587
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment