Skip to content

Commit b34e761

Browse files
author
Omar Sharieff
committed
Bug#21303549 : MYSQLPUMP: EXCLUDED TABLE TRIGGERS AND
VIEW DUMPED IN OUTPUT FILE Description: User specified view exclusions or inclusions using mysqlpump options --exclude-tables or --include-tables not handled. Fix: User specified view exclusions and inclusions handled with a check. Gerrit#18974 Change-Id: I9feb7f892531d6d023065dd66943ead411fb0f12
1 parent 240d073 commit b34e761

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

client/dump/object_filter.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "client/dump/stored_procedure.h"
3434
#include "client/dump/table.h"
3535
#include "client/dump/trigger.h"
36+
#include "client/dump/view.h"
3637
#endif
3738
#include <stddef.h>
3839
#include <boost/algorithm/string.hpp>
@@ -215,7 +216,8 @@ bool Object_filter::is_object_included_in_dump(Abstract_data_object *object) {
215216
std::vector<std::pair<std::string, std::string>> *exclude_list;
216217
bool *dump_switch = nullptr;
217218

218-
if (dynamic_cast<Table *>(object) != nullptr) {
219+
if (dynamic_cast<Table *>(object) != nullptr ||
220+
dynamic_cast<View *>(object) != nullptr) {
219221
include_list = &m_tables_included;
220222
exclude_list = &m_tables_excluded;
221223
} else if (dynamic_cast<Database *>(object) != nullptr) {

mysql-test/r/mysqlpump_filters.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ Warning 1681 Integer display width is deprecated and will be removed in a future
319319

320320
DROP DATABASE db3;
321321
DROP DATABASE db1_1gb;
322+
Pattern "VIEW `db1`.`v1`" not found
323+
Pattern "VIEW `db1`.`v1`" found
322324
DROP DATABASE db1;
323325
DROP DATABASE db2;
324326
DROP DATABASE db3;

mysql-test/t/mysqlpump_filters.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ DROP DATABASE db1_1gb;
4646
--exec $MYSQL_PUMP --parallel-schemas=2:db1 --exclude-databases=mtr,mysql,sys,test --include-databases=db3,db1 --skip-dump-rows --include-triggers=trig2 > $MYSQLTEST_VARDIR/tmp/include_triggers_1.sql
4747
--exec $MYSQL_PUMP --parallel-schemas=2:db3 --exclude-databases=mtr,mysql,sys,test --include-databases=db3,db1 --skip-dump-rows --exclude-triggers=trig3 > $MYSQLTEST_VARDIR/tmp/exclude_triggers_2.sql
4848

49+
# exclude view
50+
--exec $MYSQL_PUMP -u root --exclude-tables='v1' --result-file=$MYSQLTEST_VARDIR/tmp/exclude_view.sql
51+
--let SEARCH_FILE = $MYSQLTEST_VARDIR/tmp/exclude_view.sql
52+
--let SEARCH_PATTERN = VIEW `db1`.`v1`
53+
--source include/search_pattern.inc
54+
55+
# include view
56+
--exec $MYSQL_PUMP -u root --include-tables='v1' --result-file=$MYSQLTEST_VARDIR/tmp/include_view.sql
57+
--let SEARCH_FILE = $MYSQLTEST_VARDIR/tmp/include_view.sql
58+
--let SEARCH_PATTERN = VIEW `db1`.`v1`
59+
--source include/search_pattern.inc
60+
4961
# include/exclude-routines
5062
--exec $MYSQL_PUMP --parallel-schemas=1:db1 --exclude-databases=mtr,mysql,sys,test --include-databases=db3,db1 --skip-dump-rows --include-routines=db1t_cache,db1_f1 > $MYSQLTEST_VARDIR/tmp/include_routines_1.sql
5163
--exec $MYSQL_PUMP --parallel-schemas=1:db3 --exclude-databases=mtr,mysql,sys,test --include-databases=db3,db1 --skip-dump-rows --exclude-routines=d3t_cache > $MYSQLTEST_VARDIR/tmp/exclude_routines_2.sql

0 commit comments

Comments
 (0)