Updated tests for schema iterator

This commit is contained in:
Carlos Salguero
2017-01-16 23:42:11 -03:00
parent 14f42bf988
commit 410e75a623
9 changed files with 83 additions and 14 deletions

View File

@@ -3491,7 +3491,7 @@ sub database_is_allowed {
my $filter = $self->{filters};
if ( $db =~ m/information_schema|performance_schema|lost\+found/ ) {
if ( $db =~ m/information_schema|performance_schema|lost\+found|percona|percona_schema/ ) {
PTDEBUG && _d('Database', $db, 'is a system database, ignoring');
return 0;
}
@@ -3534,12 +3534,20 @@ sub table_is_allowed {
return 0 if $db eq 'mysql' && $tbl =~ m/^(?:
general_log
|slow_log
|gtid_execution
|innodb_index_stats
|innodb_table_stats
|inventory
|plugin
|proc
|slave_master_info
|slave_relay_log_info
|slave_worker_info
|slow_log
)$/x;
return 0 if $db eq 'sys' && $tbl =~ m/^(?:
sys_config
)$/x;
if ( $filter->{'ignore-tables'}->{'*'}->{$tbl}

View File

@@ -4269,7 +4269,7 @@ sub database_is_allowed {
my $filter = $self->{filters};
if ( $db =~ m/information_schema|performance_schema|lost\+found/ ) {
if ( $db =~ m/information_schema|performance_schema|lost\+found|percona|percona_schema/ ) {
PTDEBUG && _d('Database', $db, 'is a system database, ignoring');
return 0;
}
@@ -4312,12 +4312,20 @@ sub table_is_allowed {
return 0 if $db eq 'mysql' && $tbl =~ m/^(?:
general_log
|slow_log
|gtid_execution
|innodb_index_stats
|innodb_table_stats
|inventory
|plugin
|proc
|slave_master_info
|slave_relay_log_info
|slave_worker_info
|slow_log
)$/x;
return 0 if $db eq 'sys' && $tbl =~ m/^(?:
sys_config
)$/x;
if ( $filter->{'ignore-tables'}->{'*'}->{$tbl}

View File

@@ -7614,7 +7614,7 @@ sub database_is_allowed {
my $filter = $self->{filters};
if ( $db =~ m/information_schema|performance_schema|lost\+found|percona|percona_schema|test/ ) {
if ( $db =~ m/information_schema|performance_schema|lost\+found|percona|percona_schema/ ) {
PTDEBUG && _d('Database', $db, 'is a system database, ignoring');
return 0;
}
@@ -7672,6 +7672,7 @@ sub table_is_allowed {
return 0 if $db eq 'sys' && $tbl =~ m/^(?:
sys_config
)$/x;
if ( $filter->{'ignore-tables'}->{'*'}->{$tbl}
|| $filter->{'ignore-tables'}->{$db}->{$tbl}) {
PTDEBUG && _d('Table', $tbl, 'is in --ignore-tables list');

View File

@@ -7825,7 +7825,7 @@ sub database_is_allowed {
my $filter = $self->{filters};
if ( $db =~ m/information_schema|performance_schema|lost\+found/ ) {
if ( $db =~ m/information_schema|performance_schema|lost\+found|percona|percona_schema/ ) {
PTDEBUG && _d('Database', $db, 'is a system database, ignoring');
return 0;
}
@@ -7868,12 +7868,20 @@ sub table_is_allowed {
return 0 if $db eq 'mysql' && $tbl =~ m/^(?:
general_log
|slow_log
|gtid_execution
|innodb_index_stats
|innodb_table_stats
|inventory
|plugin
|proc
|slave_master_info
|slave_relay_log_info
|slave_worker_info
|slow_log
)$/x;
return 0 if $db eq 'sys' && $tbl =~ m/^(?:
sys_config
)$/x;
if ( $filter->{'ignore-tables'}->{'*'}->{$tbl}

View File

@@ -405,7 +405,7 @@ sub database_is_allowed {
my $filter = $self->{filters};
if ( $db =~ m/information_schema|performance_schema|lost\+found|percona|percona_schema|test/ ) {
if ( $db =~ m/information_schema|performance_schema|lost\+found|percona|percona_schema/ ) {
PTDEBUG && _d('Database', $db, 'is a system database, ignoring');
return 0;
}

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 43;
use Test::More tests => 42;
use SchemaIterator;
use FileIterator;
@@ -349,7 +349,7 @@ SKIP: {
test_so(
files => ["$in/dump001.txt"],
result => "",
result => "test.a test.b test2.a ",
test_name => "Iterate schema in dump001.txt",
);
@@ -362,7 +362,7 @@ test_so(
test_so(
files => ["$in/dump001.txt", "$in/dump001.txt"],
result => "",
result => "$out/multiple-files.txt",
ddl => 1,
test_name => "Iterate schema in multiple files",
);
@@ -370,7 +370,7 @@ test_so(
test_so(
files => ["$in/dump001.txt"],
filters => [qw(--databases TEST2)],
result => "",
result => "$out/all-dbs-dump001.txt",
test_name => "Filter dump file by --databases",
);
@@ -591,7 +591,7 @@ my $si = new SchemaIterator(
Quoter => $q,
TableParser => $tp,
);
for my $db (qw( information_schema performance_schema|lost\+found percona percona_schema test )) {
for my $db (qw( information_schema performance_schema|lost\+found percona percona_schema )) {
is(
$si->database_is_allowed($db),
0,

View File

@@ -0,0 +1,6 @@
test2.a
CREATE TABLE `a` (
`c1` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(45) NOT NULL
);

View File

@@ -0,0 +1,38 @@
test.a
CREATE TABLE `a` (
`c1` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(45) NOT NULL
);
test.b
CREATE TABLE `b` (
`c1` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(45) NOT NULL,
`c3` varchar(45) NOT NULL,
);
test2.a
CREATE TABLE `a` (
`c1` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(45) NOT NULL
);
test.a
CREATE TABLE `a` (
`c1` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(45) NOT NULL
);
test.b
CREATE TABLE `b` (
`c1` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(45) NOT NULL,
`c3` varchar(45) NOT NULL,
);
test2.a
CREATE TABLE `a` (
`c1` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(45) NOT NULL
);

View File

@@ -8,7 +8,7 @@ use test;
create table aaa (
`STOP_ARCHIVE` int(11) NOT NULL default '1',
UNIQUE KEY `STOP_ARCHIVE` (`STOP_ARCHIVE`)
) ENGINE=MyISAM;
);
insert into aaa values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);