pt-duplicate-key-checker skipped reporting when verbose option on

This commit is contained in:
Frank Cizmich
2015-03-23 14:00:01 -03:00
parent 16a7ffa6f9
commit 0c50d5b1cd
3 changed files with 46 additions and 42 deletions

View File

@@ -4972,46 +4972,44 @@ sub main {
print_all_keys($keys, $tbl, \%seen_tbl) if $keys; print_all_keys($keys, $tbl, \%seen_tbl) if $keys;
print_all_keys($fks, $tbl, \%seen_tbl) if $fks; print_all_keys($fks, $tbl, \%seen_tbl) if $fks;
} }
else { PTDEBUG && _d('Getting duplicate keys on',
PTDEBUG && _d('Getting duplicate keys on', $tbl->{db}, $tbl->{tbl});
$tbl->{db}, $tbl->{tbl}); if ( $keys ) {
if ( $keys ) { $dk->get_duplicate_keys(
$dk->get_duplicate_keys( $keys,
$keys, clustered_key => $clustered_key,
clustered_key => $clustered_key, tbl_info => $tbl,
tbl_info => $tbl, callback => \&print_duplicate_key,
callback => \&print_duplicate_key, %tp_opts,
%tp_opts, # get_duplicate_keys() ignores these args but passes them
# get_duplicate_keys() ignores these args but passes them # to the callback:
# to the callback: dbh => $dbh,
dbh => $dbh, is_fk => 0,
is_fk => 0, o => $o,
o => $o, ks => $ks,
ks => $ks, tp => $tp,
tp => $tp, q => $q,
q => $q, seen_tbl => \%seen_tbl,
seen_tbl => \%seen_tbl, summary => \%summary,
summary => \%summary, );
); }
} if ( $fks ) {
if ( $fks ) { $dk->get_duplicate_fks(
$dk->get_duplicate_fks( $fks,
$fks, tbl_info => $tbl,
tbl_info => $tbl, callback => \&print_duplicate_key,
callback => \&print_duplicate_key, %tp_opts,
%tp_opts, # get_duplicate_fks() ignores these args but passes them
# get_duplicate_fks() ignores these args but passes them # to the callback:
# to the callback: dbh => $dbh,
dbh => $dbh, is_fk => 1,
is_fk => 1, o => $o,
o => $o, ks => $ks,
ks => $ks, tp => $tp,
tp => $tp, q => $q,
q => $q, seen_tbl => \%seen_tbl,
seen_tbl => \%seen_tbl, summary => \%summary,
summary => \%summary, );
);
}
} }
# Always count Total Keys so print_key_summary won't die # Always count Total Keys so print_key_summary won't die

View File

@@ -136,14 +136,16 @@ ok(
# ############################################################################# # #############################################################################
# Exact unique dupes # Exact unique dupes
# https://bugs.launchpad.net/percona-toolkit/+bug/1217013 # https://bugs.launchpad.net/percona-toolkit/+bug/1217013
# Also added --verbose option (-v) to test for:
# https://bugs.launchpad.net/percona-toolkit/+bug/1402730
# ############################################################################# # #############################################################################
$sb->load_file('master', 't/lib/samples/dupekeys/simple_dupe_bug_1217013.sql', 'test'); $sb->load_file('master', 't/lib/samples/dupekeys/simple_dupe_bug_1217013.sql', 'test');
ok( ok(
no_diff( no_diff(
sub { pt_duplicate_key_checker::main(@args, qw(-t test.domains)) }, sub { pt_duplicate_key_checker::main(@args, qw(-t test.domains -v)) },
"$sample/simple_dupe_bug_1217013.txt"), "$sample/simple_dupe_bug_1217013.txt", keep_output=>1),
'Exact unique dupes (bug 1217013)' 'Exact unique dupes (bug 1217013)'
) or diag($test_diff); ) or diag($test_diff);

View File

@@ -2,6 +2,10 @@
# test.domains # test.domains
# ######################################################################## # ########################################################################
# unique_key_domain (`domain`)
# domain (`domain`)
# PRIMARY (`id`)
# Uniqueness of domain ignored because unique_key_domain is a duplicate constraint # Uniqueness of domain ignored because unique_key_domain is a duplicate constraint
# domain is a duplicate of unique_key_domain # domain is a duplicate of unique_key_domain
# Key definitions: # Key definitions: