mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-04-17 01:01:39 +08:00
Report DIFFS as the true number of unique chunks that differ across all slaves.
This commit is contained in:
@@ -7690,7 +7690,7 @@ sub main {
|
|||||||
);
|
);
|
||||||
|
|
||||||
# Check each slave for checksum diffs.
|
# Check each slave for checksum diffs.
|
||||||
my $max_diffs = 0;
|
my %diff_chunks;
|
||||||
foreach my $slave ( @$slaves ) {
|
foreach my $slave ( @$slaves ) {
|
||||||
eval {
|
eval {
|
||||||
my $diffs = $rc->find_replication_differences(
|
my $diffs = $rc->find_replication_differences(
|
||||||
@@ -7700,10 +7700,9 @@ sub main {
|
|||||||
);
|
);
|
||||||
PTDEBUG && _d(scalar @$diffs, 'checksum diffs on',
|
PTDEBUG && _d(scalar @$diffs, 'checksum diffs on',
|
||||||
$slave->name());
|
$slave->name());
|
||||||
if ( my $n_diffs = scalar @$diffs ) {
|
# Save unique chunks that differ.
|
||||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1030031
|
# https://bugs.launchpad.net/percona-toolkit/+bug/1030031
|
||||||
$max_diffs = $n_diffs if $n_diffs > $max_diffs;
|
map { $diff_chunks{ $_->{chunk} }++ } @$diffs;
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if ($EVAL_ERROR) {
|
if ($EVAL_ERROR) {
|
||||||
if ( $o->get('quiet') < 2 ) {
|
if ( $o->get('quiet') < 2 ) {
|
||||||
@@ -7716,7 +7715,7 @@ sub main {
|
|||||||
$tbl->{checksum_results}->{errors}++;
|
$tbl->{checksum_results}->{errors}++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$tbl->{checksum_results}->{diffs} = $max_diffs;
|
$tbl->{checksum_results}->{diffs} = scalar keys %diff_chunks;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print table's checksum results if we're not being quiet,
|
# Print table's checksum results if we're not being quiet,
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ elsif ( !$slave2_dbh ) {
|
|||||||
plan skip_all => 'Cannot connect to sandbox slave2';
|
plan skip_all => 'Cannot connect to sandbox slave2';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
plan tests => 9;
|
plan tests => 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
||||||
@@ -155,7 +155,6 @@ $slave1_dbh->do("SET SQL_LOG_BIN=1");
|
|||||||
|
|
||||||
$output = output(
|
$output = output(
|
||||||
sub { pt_table_checksum::main(@args, qw(-t test.t --chunk-size 10)) },
|
sub { pt_table_checksum::main(@args, qw(-t test.t --chunk-size 10)) },
|
||||||
stderr => 1,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
@@ -164,6 +163,21 @@ is(
|
|||||||
"Bug 1030031 (wrong DIFFS): 2 diffs"
|
"Bug 1030031 (wrong DIFFS): 2 diffs"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Restore slave2, but then give it 1 diff that's not the same chunk#
|
||||||
|
# as slave1, so there's 3 unique chunk that differ.
|
||||||
|
$slave2_dbh->do("UPDATE test.t SET c='e' WHERE id=5");
|
||||||
|
$slave2_dbh->do("UPDATE test.t SET c='' WHERE id=26");
|
||||||
|
|
||||||
|
$output = output(
|
||||||
|
sub { pt_table_checksum::main(@args, qw(-t test.t --chunk-size 10)) },
|
||||||
|
);
|
||||||
|
|
||||||
|
is(
|
||||||
|
PerconaTest::count_checksum_results($output, 'diffs'),
|
||||||
|
3,
|
||||||
|
"Bug 1030031 (wrong DIFFS): 3 diffs"
|
||||||
|
);
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Done.
|
# Done.
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
|||||||
Reference in New Issue
Block a user