mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-18 08:24:06 +00:00
Check that vars are defined before using them as hashrefs.
This commit is contained in:
@@ -3566,7 +3566,7 @@ sub main {
|
||||
$fks = $tp->get_fks($tbl->{ddl}, {database => $tbl->{db}});
|
||||
}
|
||||
|
||||
next TABLE unless %$keys || %$fks;
|
||||
next TABLE unless ($keys && %$keys) || ($fks && %$fks);
|
||||
|
||||
if ( $o->got('verbose') ) {
|
||||
print_all_keys($keys, $tbl, \%seen_tbl) if $keys;
|
||||
|
@@ -23,7 +23,7 @@ if ( !$dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
else {
|
||||
plan tests => 10;
|
||||
plan tests => 13;
|
||||
}
|
||||
|
||||
my $output;
|
||||
@@ -107,6 +107,35 @@ ok(
|
||||
"Bug 894140"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# --key-types
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/969669
|
||||
# #############################################################################
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_duplicate_key_checker::main(@args,
|
||||
qw(-d sakila --key-types k)) },
|
||||
"$sample/key-types-k.txt"),
|
||||
'--key-types k'
|
||||
);
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_duplicate_key_checker::main(@args,
|
||||
qw(-d sakila --key-types f)) },
|
||||
"$sample/key-types-f.txt"),
|
||||
'--key-types f'
|
||||
);
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_duplicate_key_checker::main(@args,
|
||||
qw(-d sakila --key-types fk)) },
|
||||
"$sample/key-types-fk.txt"),
|
||||
'--key-types fk (explicit)'
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
5
t/pt-duplicate-key-checker/samples/key-types-f.txt
Normal file
5
t/pt-duplicate-key-checker/samples/key-types-f.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
# ########################################################################
|
||||
# Summary of indexes
|
||||
# ########################################################################
|
||||
|
||||
# Total Indexes 22
|
5
t/pt-duplicate-key-checker/samples/key-types-fk.txt
Normal file
5
t/pt-duplicate-key-checker/samples/key-types-fk.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
# ########################################################################
|
||||
# Summary of indexes
|
||||
# ########################################################################
|
||||
|
||||
# Total Indexes 63
|
5
t/pt-duplicate-key-checker/samples/key-types-k.txt
Normal file
5
t/pt-duplicate-key-checker/samples/key-types-k.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
# ########################################################################
|
||||
# Summary of indexes
|
||||
# ########################################################################
|
||||
|
||||
# Total Indexes 41
|
Reference in New Issue
Block a user