mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-12-19 01:09:21 +08:00
Fix for 1074179: pt-table-checksum does't ignore tables for --replicate-check-only
This commit is contained in:
@@ -8686,6 +8686,7 @@ sub main {
|
|||||||
);
|
);
|
||||||
PTDEBUG && _d(scalar @$diffs, 'checksum diffs on',
|
PTDEBUG && _d(scalar @$diffs, 'checksum diffs on',
|
||||||
$slave->name());
|
$slave->name());
|
||||||
|
$diffs = filter_tables_replicate_check_only($diffs, $o);
|
||||||
if ( @$diffs ) {
|
if ( @$diffs ) {
|
||||||
$exit_status |= 1;
|
$exit_status |= 1;
|
||||||
if ( $o->get('quiet') < 2 ) {
|
if ( $o->get('quiet') < 2 ) {
|
||||||
@@ -9819,6 +9820,30 @@ sub print_checksum_diffs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub filter_tables_replicate_check_only {
|
||||||
|
my ($diffs, $o) = @_;
|
||||||
|
my @filtered_diffs;
|
||||||
|
|
||||||
|
# SchemaIterator has the methdos 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 {
|
sub check_repl_table {
|
||||||
my ( %args ) = @_;
|
my ( %args ) = @_;
|
||||||
my @required_args = qw(dbh repl_table slaves
|
my @required_args = qw(dbh repl_table slaves
|
||||||
|
|||||||
@@ -175,6 +175,23 @@ is(
|
|||||||
"Bug 1030031 (wrong DIFFS): 3 diffs"
|
"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
|
# pt-table-checksum can crash with --columns if none match
|
||||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1016131
|
# https://bugs.launchpad.net/percona-toolkit/+bug/1016131
|
||||||
|
|||||||
Reference in New Issue
Block a user