Skip to content

Commit 52e6b5d

Browse files
author
Arun Kuruvila
committed
Bug#25469190: MYSQLPUMP SHOULD EXCLUDE REPLICATION
REPOSITORY METADATA TABLES Description : Replication meta data tables such as mysql.slave_master_info and mysql.slave_relay_log_info gets backed up when MYSQLPUMP is executed. Analysis: The above mentioned replication tables should be excluded from backups because they are not a logical part of data. These tables contain replication channel meta data that will leave the replication meta data in an invalid state after the restoration of the dump. Fix: Both the tables are excluded from MYSQLPUMP.
1 parent 8ab9b49 commit 52e6b5d

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

client/dump/mysqldump_tool_chain_maker_options.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -152,6 +152,10 @@ void Mysqldump_tool_chain_maker_options::process_positional_options(
152152
"mysql", "general_log"));
153153
m_object_filter.m_tables_excluded.push_back(std::make_pair(
154154
"mysql", "slow_log"));
155+
m_object_filter.m_tables_excluded.push_back(std::make_pair(
156+
"mysql", "slave_master_info"));
157+
m_object_filter.m_tables_excluded.push_back(std::make_pair(
158+
"mysql", "slave_relay_log_info"));
155159
/*
156160
We filter out all the tables which store account and privilge
157161
information. ex: mysql.user, mysql.db, mysql.tables_priv,

mysql-test/r/mysqlpump.result

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,3 +432,27 @@ DROP DATABASE db1;
432432
DROP DATABASE db2;
433433
DROP DATABASE db3;
434434
DROP DATABASE db1_1gb;
435+
SHOW VARIABLES LIKE "master_info_repository";
436+
Variable_name Value
437+
master_info_repository FILE
438+
SHOW VARIABLES LIKE "relay_log_info_repository";
439+
Variable_name Value
440+
relay_log_info_repository FILE
441+
SET GLOBAL master_info_repository= 'TABLE';
442+
SET GLOBAL relay_log_info_repository= 'TABLE';
443+
SHOW VARIABLES LIKE "master_info_repository";
444+
Variable_name Value
445+
master_info_repository TABLE
446+
SHOW VARIABLES LIKE "relay_log_info_repository";
447+
Variable_name Value
448+
relay_log_info_repository TABLE
449+
Pattern "CREATE TABLE `mysql`.`slave_master_info`" not found
450+
Pattern "CREATE TABLE `mysql`.`slave_relay_log_info`" not found
451+
SET GLOBAL master_info_repository= 'FILE';
452+
SET GLOBAL relay_log_info_repository= 'FILE';
453+
SHOW VARIABLES LIKE "master_info_repository";
454+
Variable_name Value
455+
master_info_repository FILE
456+
SHOW VARIABLES LIKE "relay_log_info_repository";
457+
Variable_name Value
458+
relay_log_info_repository FILE

mysql-test/t/mysqlpump.test

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,40 @@ DROP DATABASE db1_1gb;
124124
--exec $MYSQL_PUMP --version 2>&1 > $MYSQLTEST_VARDIR/tmp/output_file.txt
125125
--remove_file $MYSQLTEST_VARDIR/tmp/output_file.txt
126126

127+
#
128+
# Bug #25469190: MYSQLPUMP SHOULD EXCLUDE REPLICATION
129+
# REPOSITORY METADATA TABLES
130+
#
131+
132+
SHOW VARIABLES LIKE "master_info_repository";
133+
SHOW VARIABLES LIKE "relay_log_info_repository";
134+
135+
SET GLOBAL master_info_repository= 'TABLE';
136+
SET GLOBAL relay_log_info_repository= 'TABLE';
137+
138+
SHOW VARIABLES LIKE "master_info_repository";
139+
SHOW VARIABLES LIKE "relay_log_info_repository";
140+
141+
--exec $MYSQL_PUMP --include-databases=mysql > $MYSQLTEST_VARDIR/tmp/bug25469190.sql
142+
143+
# Search for mysql.slave_master_info in the dump file
144+
--let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/bug25469190.sql
145+
--let SEARCH_PATTERN= CREATE TABLE `mysql`.`slave_master_info`
146+
--source include/search_pattern.inc
147+
148+
# Search for mysql.slave_relay_log_info in the dump file
149+
--let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/bug25469190.sql
150+
--let SEARCH_PATTERN= CREATE TABLE `mysql`.`slave_relay_log_info`
151+
--source include/search_pattern.inc
152+
153+
SET GLOBAL master_info_repository= 'FILE';
154+
SET GLOBAL relay_log_info_repository= 'FILE';
155+
156+
SHOW VARIABLES LIKE "master_info_repository";
157+
SHOW VARIABLES LIKE "relay_log_info_repository";
158+
159+
# Cleanup
160+
--remove_file $SEARCH_FILE
161+
127162

128163
# END OF TEST

0 commit comments

Comments
 (0)