mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-13 14:39:28 +00:00
Fix for 911385: pt-table-checksum v2 fails when --resume + --ignore-database is used
This commit is contained in:
@@ -5281,7 +5281,7 @@ sub _get_hash_func {
|
|||||||
}
|
}
|
||||||
my ($dbh) = @args{@required_args};
|
my ($dbh) = @args{@required_args};
|
||||||
my $o = $self->{OptionParser};
|
my $o = $self->{OptionParser};
|
||||||
my @funcs = qw(CRC32 FNV1A_64 FNV_64 MD5 SHA1);
|
my @funcs = qw(CRC32 FNV1A_64 FNV_64 MURMUR_HASH MD5 SHA1);
|
||||||
|
|
||||||
if ( my $func = $o->get('function') ) {
|
if ( my $func = $o->get('function') ) {
|
||||||
unshift @funcs, $func;
|
unshift @funcs, $func;
|
||||||
@@ -5302,7 +5302,7 @@ sub _get_hash_func {
|
|||||||
PTDEBUG && _d('Chosen hash func:', $result);
|
PTDEBUG && _d('Chosen hash func:', $result);
|
||||||
return $func;
|
return $func;
|
||||||
}
|
}
|
||||||
die $error || 'No hash functions (CRC32, MD5, etc.) are available';
|
die($error || 'No hash functions (CRC32, MD5, etc.) are available');
|
||||||
}
|
}
|
||||||
|
|
||||||
sub _get_crc_width {
|
sub _get_crc_width {
|
||||||
@@ -6782,9 +6782,10 @@ sub _iterate_dbh {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !$self->{db} ) {
|
if ( !$self->{db} ) {
|
||||||
do {
|
while ( @{$self->{dbs}} ) {
|
||||||
$self->{db} = shift @{$self->{dbs}};
|
$self->{db} = shift @{$self->{dbs}};
|
||||||
} until $self->_resume_from_database($self->{db});
|
last if $self->_resume_from_database($self->{db});
|
||||||
|
}
|
||||||
PTDEBUG && _d('Next database:', $self->{db});
|
PTDEBUG && _d('Next database:', $self->{db});
|
||||||
return unless $self->{db};
|
return unless $self->{db};
|
||||||
}
|
}
|
||||||
|
@@ -327,9 +327,10 @@ sub _iterate_dbh {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !$self->{db} ) {
|
if ( !$self->{db} ) {
|
||||||
do {
|
while ( @{$self->{dbs}} ) {
|
||||||
$self->{db} = shift @{$self->{dbs}};
|
$self->{db} = shift @{$self->{dbs}};
|
||||||
} until $self->_resume_from_database($self->{db});
|
last if $self->_resume_from_database($self->{db});
|
||||||
|
}
|
||||||
PTDEBUG && _d('Next database:', $self->{db});
|
PTDEBUG && _d('Next database:', $self->{db});
|
||||||
return unless $self->{db};
|
return unless $self->{db};
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@ BEGIN {
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings FATAL => 'all';
|
use warnings FATAL => 'all';
|
||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use Test::More tests => 30;
|
use Test::More;
|
||||||
|
|
||||||
use SchemaIterator;
|
use SchemaIterator;
|
||||||
use FileIterator;
|
use FileIterator;
|
||||||
@@ -77,20 +77,22 @@ sub test_so {
|
|||||||
|
|
||||||
my $res = "";
|
my $res = "";
|
||||||
my @objs;
|
my @objs;
|
||||||
while ( my $obj = $si->next() ) {
|
eval {
|
||||||
if ( $args{return_objs} ) {
|
while ( my $obj = $si->next() ) {
|
||||||
push @objs, $obj;
|
if ( $args{return_objs} ) {
|
||||||
}
|
push @objs, $obj;
|
||||||
else {
|
|
||||||
if ( $result_file || $args{ddl} ) {
|
|
||||||
$res .= "$obj->{db}.$obj->{tbl}\n";
|
|
||||||
$res .= "$obj->{ddl}\n\n" if $args{ddl} || $tp;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$res .= "$obj->{db}.$obj->{tbl} ";
|
if ( $result_file || $args{ddl} ) {
|
||||||
|
$res .= "$obj->{db}.$obj->{tbl}\n";
|
||||||
|
$res .= "$obj->{ddl}\n\n" if $args{ddl} || $tp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$res .= "$obj->{db}.$obj->{tbl} ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
return \@objs if $args{return_objs};
|
return \@objs if $args{return_objs};
|
||||||
|
|
||||||
@@ -114,6 +116,9 @@ sub test_so {
|
|||||||
$args{test_name},
|
$args{test_name},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
elsif ( $args{lives_ok} ) {
|
||||||
|
is($EVAL_ERROR, '', $args{test_name});
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
is(
|
is(
|
||||||
$res,
|
$res,
|
||||||
@@ -406,8 +411,23 @@ test_so(
|
|||||||
test_name => "Resume from ignored table"
|
test_name => "Resume from ignored table"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# ############################################################################
|
||||||
|
# pt-table-checksum v2 fails when --resume + --ignore-database is used
|
||||||
|
# https://bugs.launchpad.net/percona-toolkit/+bug/911385
|
||||||
|
# ############################################################################
|
||||||
|
|
||||||
|
# Actually, the important bit here si that it doesn't die, not the results.
|
||||||
|
|
||||||
|
test_so(
|
||||||
|
filters => ['--ignore-databases', 'sakila,mysql'],
|
||||||
|
result => "", # hack; uses lives_ok instead
|
||||||
|
lives_ok => 1,
|
||||||
|
test_name => "Bug 911385: pt-table-checksum v2 fails when --resume + --ignore-database is used"
|
||||||
|
);
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Done.
|
# Done.
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||||
|
done_testing;
|
||||||
exit;
|
exit;
|
||||||
|
Reference in New Issue
Block a user