mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-07 21:09:14 +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;
|
my @dupes;
|
||||||
|
|
||||||
KEY:
|
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->{real_cols} = [ @{$key->{cols}} ];
|
||||||
|
|
||||||
$key->{len_cols} = length $key->{colnames};
|
$key->{len_cols} = length $key->{colnames};
|
||||||
@@ -2412,7 +2413,8 @@ sub get_duplicate_keys {
|
|||||||
sub get_duplicate_fks {
|
sub get_duplicate_fks {
|
||||||
my ( $self, $fks, %args ) = @_;
|
my ( $self, $fks, %args ) = @_;
|
||||||
die "I need a fks argument" unless $fks;
|
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;
|
my @dupes;
|
||||||
|
|
||||||
foreach my $i ( 0..$#fks - 1 ) {
|
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(
|
ok(
|
||||||
no_diff(
|
no_diff(
|
||||||
sub { pt_duplicate_key_checker::main(@args, qw(-d issue_331)) },
|
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'
|
'Issue 331 crash on fks'
|
||||||
);
|
) or diag($test_diff);
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Done.
|
# Done.
|
||||||
|
@@ -2,14 +2,14 @@
|
|||||||
# issue_331.issue_331_t2
|
# 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:
|
# 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_2` FOREIGN KEY (`id`) REFERENCES `issue_331_t1` (`t1_id`)
|
||||||
|
# CONSTRAINT `fk_1` FOREIGN KEY (`id`) REFERENCES `issue_331_t1` (`t1_id`)
|
||||||
# Column types:
|
# Column types:
|
||||||
# `id` bigint(20) not null default '0'
|
# `id` bigint(20) not null default '0'
|
||||||
# To remove this duplicate foreign key, execute:
|
# 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
|
# MySQL uses the PRIMARY index for this foreign key constraint
|
||||||
|
|
||||||
|
@@ -6,15 +6,15 @@
|
|||||||
# domain (`domain`)
|
# domain (`domain`)
|
||||||
# unique_key_domain (`domain`)
|
# unique_key_domain (`domain`)
|
||||||
|
|
||||||
# Uniqueness of domain ignored because unique_key_domain is a duplicate constraint
|
# Uniqueness of unique_key_domain ignored because domain is a duplicate constraint
|
||||||
# domain is a duplicate of unique_key_domain
|
# unique_key_domain is a duplicate of domain
|
||||||
# Key definitions:
|
# Key definitions:
|
||||||
# UNIQUE KEY `domain` (`domain`),
|
|
||||||
# UNIQUE KEY `unique_key_domain` (`domain`)
|
# UNIQUE KEY `unique_key_domain` (`domain`)
|
||||||
|
# UNIQUE KEY `domain` (`domain`),
|
||||||
# Column types:
|
# Column types:
|
||||||
# `domain` varchar(175) collate utf8_bin not null
|
# `domain` varchar(175) collate utf8_bin not null
|
||||||
# To remove this duplicate index, execute:
|
# 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
|
# Summary of indexes
|
||||||
|
Reference in New Issue
Block a user