1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-32611: Test suite is missing dump option delete-master-logs.

Extending the rpl_mysqldump_slave.test to incorporate the
delete-master-logs option, and this options is alias of
get binlogs: show master status -> flush logs -> purge binary logs to <new_binlog>
sequence and this test is derived using the same pattern.
also we measure the pre and post log state
on the master following the mysqldump process. Introducing
assertions to validate the correct state.
This commit is contained in:
Gulshan Kumar Prasad
2023-11-18 19:08:10 +05:30
committed by Anel
parent 5f89045221
commit d8e6bb0088
2 changed files with 49 additions and 0 deletions

View File

@ -65,4 +65,13 @@ SET GLOBAL gtid_slave_pos='0-2-1003';
-- CHANGE MASTER TO MASTER_LOG_FILE='slave-bin.000001', MASTER_LOG_POS=BINLOG_START;
CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
SET GLOBAL gtid_slave_pos='0-2-1003';
connection master;
CREATE TABLE t (
id int
);
insert into t values (1);
insert into t values (2);
drop table t;
-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000002', MASTER_LOG_POS=BINLOG_START;
-- SET GLOBAL gtid_slave_pos='0-1-1005';
include/rpl_end.inc

View File

@ -83,6 +83,46 @@ DROP TABLE t2;
--replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
--exec $MYSQL_DUMP_SLAVE --compact --master-data --single-transaction --gtid test
#
# MDEV-32611 Added test for mysqldump --delete-master-logs option.
# This options is alias of
# get binlogs: show master status -> flush logs -> purge binary logs to <new_binlog>
# sequence and this test is derived using the same pattern.
#
connection master;
CREATE TABLE t (
id int
);
insert into t values (1);
insert into t values (2);
drop table t;
--let $predump_binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1)
# Execute mysqldump with delete-master-logs option
--replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
--exec $MYSQL_DUMP --compact --no-create-info --no-data --delete-master-logs test
--let $postdump_binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1)
--let $postdump_first_binary_log_filename= query_get_value(SHOW BINARY LOGS, Log_name, 1)
if ($predump_binlog_filename == $postdump_binlog_filename)
{
--echo # predump_binlog_filename: $predump_binlog_filename
--echo # postdump_binlog_filename: $postdump_binlog_filename
--die Master state didn't change after mariadb-dump with --delete-master-logs.
}
if ($postdump_first_binary_log_filename != $postdump_binlog_filename)
{
--echo # postdump_first_binary_log_filename: $postdump_first_binary_log_filename
--echo # postdump_binlog_filename: $postdump_binlog_filename
--die Master binlog wasn't deleted after mariadb-dump with --delete-master-logs.
}
--source include/rpl_end.inc