mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-03 19:15:54 +00:00
Added sort to some hash loops to make tests consistent. Modified test files accordingly
This commit is contained in:
@@ -2336,7 +2336,8 @@ sub get_duplicate_keys {
|
||||
my @dupes;
|
||||
|
||||
KEY:
|
||||
foreach my $key ( values %keys ) {
|
||||
# sort by key name for consistent testing
|
||||
foreach my $key ( sort {$a->{name} cmp $b->{name}} values %keys ) {
|
||||
$key->{real_cols} = [ @{$key->{cols}} ];
|
||||
|
||||
$key->{len_cols} = length $key->{colnames};
|
||||
@@ -2412,7 +2413,8 @@ sub get_duplicate_keys {
|
||||
sub get_duplicate_fks {
|
||||
my ( $self, $fks, %args ) = @_;
|
||||
die "I need a fks argument" unless $fks;
|
||||
my @fks = values %$fks;
|
||||
# sort by name for consistent testing
|
||||
my @fks = sort {$a->{name} cmp $b->{name}} values %$fks;
|
||||
my @dupes;
|
||||
|
||||
foreach my $i ( 0..$#fks - 1 ) {
|
||||
|
@@ -41,10 +41,10 @@ $sb->load_file('master', 't/pt-duplicate-key-checker/samples/issue_331.sql', 'te
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_duplicate_key_checker::main(@args, qw(-d issue_331)) },
|
||||
't/pt-duplicate-key-checker/samples/issue_331.txt',
|
||||
't/pt-duplicate-key-checker/samples/issue_331.txt'
|
||||
),
|
||||
'Issue 331 crash on fks'
|
||||
);
|
||||
) or diag($test_diff);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
|
@@ -2,14 +2,14 @@
|
||||
# issue_331.issue_331_t2
|
||||
# ########################################################################
|
||||
|
||||
# FOREIGN KEY fk_1 (`id`) REFERENCES `issue_331`.`issue_331_t1` (`t1_id`) is a duplicate of FOREIGN KEY fk_2 (`id`) REFERENCES `issue_331`.`issue_331_t1` (`t1_id`)
|
||||
# FOREIGN KEY fk_2 (`id`) REFERENCES `issue_331`.`issue_331_t1` (`t1_id`) is a duplicate of FOREIGN KEY fk_1 (`id`) REFERENCES `issue_331`.`issue_331_t1` (`t1_id`)
|
||||
# Key definitions:
|
||||
# CONSTRAINT `fk_1` FOREIGN KEY (`id`) REFERENCES `issue_331_t1` (`t1_id`)
|
||||
# CONSTRAINT `fk_2` FOREIGN KEY (`id`) REFERENCES `issue_331_t1` (`t1_id`)
|
||||
# CONSTRAINT `fk_1` FOREIGN KEY (`id`) REFERENCES `issue_331_t1` (`t1_id`)
|
||||
# Column types:
|
||||
# `id` bigint(20) not null default '0'
|
||||
# To remove this duplicate foreign key, execute:
|
||||
ALTER TABLE `issue_331`.`issue_331_t2` DROP FOREIGN KEY `fk_1`;
|
||||
ALTER TABLE `issue_331`.`issue_331_t2` DROP FOREIGN KEY `fk_2`;
|
||||
|
||||
# MySQL uses the PRIMARY index for this foreign key constraint
|
||||
|
||||
|
@@ -6,15 +6,15 @@
|
||||
# domain (`domain`)
|
||||
# unique_key_domain (`domain`)
|
||||
|
||||
# Uniqueness of domain ignored because unique_key_domain is a duplicate constraint
|
||||
# domain is a duplicate of unique_key_domain
|
||||
# Uniqueness of unique_key_domain ignored because domain is a duplicate constraint
|
||||
# unique_key_domain is a duplicate of domain
|
||||
# Key definitions:
|
||||
# UNIQUE KEY `domain` (`domain`),
|
||||
# UNIQUE KEY `unique_key_domain` (`domain`)
|
||||
# UNIQUE KEY `domain` (`domain`),
|
||||
# Column types:
|
||||
# `domain` varchar(175) collate utf8_bin not null
|
||||
# To remove this duplicate index, execute:
|
||||
ALTER TABLE `test`.`domains` DROP INDEX `domain`;
|
||||
ALTER TABLE `test`.`domains` DROP INDEX `unique_key_domain`;
|
||||
|
||||
# ########################################################################
|
||||
# Summary of indexes
|
||||
|
Reference in New Issue
Block a user