Merged fix-1074179-ptc-replicate-check-only-filters

This commit is contained in:
Brian Fraser
2012-11-29 17:14:14 -03:00
2 changed files with 42 additions and 0 deletions

View File

@@ -8864,6 +8864,7 @@ sub main {
);
PTDEBUG && _d(scalar @$diffs, 'checksum diffs on',
$slave->name());
$diffs = filter_tables_replicate_check_only($diffs, $o);
if ( @$diffs ) {
$exit_status |= 1;
if ( $o->get('quiet') < 2 ) {
@@ -9997,6 +9998,30 @@ sub print_checksum_diffs {
}
}
sub filter_tables_replicate_check_only {
my ($diffs, $o) = @_;
my @filtered_diffs;
# TODO: SchemaIterator has the methods to filter the dbs & tables,
# but we don't actually need a real iterator beyond that
my $filter = new SchemaIterator(
file_itr => "Fake",
OptionParser => $o,
Quoter => "Quoter",
TableParser => "TableParser",
);
for my $diff (@$diffs) {
my ($db, $table) = Quoter->split_unquote($diff->{table});
next unless $filter->database_is_allowed($db)
&& $filter->table_is_allowed($db, $table);
push @filtered_diffs, $diff;
}
return \@filtered_diffs;
}
sub check_repl_table {
my ( %args ) = @_;
my @required_args = qw(dbh repl_table slaves

View File

@@ -172,6 +172,23 @@ is(
"Bug 1030031 (wrong DIFFS): 3 diffs"
);
# #############################################################################
# pt-table-checksum does't ignore tables for --replicate-check-only
# https://bugs.launchpad.net/percona-toolkit/+bug/1074179
# #############################################################################
$output = output(
sub { pt_table_checksum::main(@args, qw(--replicate-check-only --ignore-tables-regex=t)) },
stderr => 1,
);
chomp($output);
is(
$output,
'',
"Bug 1074179: ignore-tables-regex works with --replicate-check-only"
);
# #############################################################################
# pt-table-checksum can crash with --columns if none match
# https://bugs.launchpad.net/percona-toolkit/+bug/1016131