mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 13:11:32 +00:00
pt-table-checksum-PXC-inconsistent-results-upon-resume-1311654
This commit is contained in:
@@ -5977,6 +5977,10 @@ sub find_replication_differences {
|
||||
}
|
||||
my ($dbh, $repl_table) = @args{@required_args};
|
||||
|
||||
|
||||
my $tries = $self->{'OptionParser'}->get('replicate-check-retries') || 1;
|
||||
my $diffs;
|
||||
while ($tries--) {
|
||||
my $sql
|
||||
= "SELECT CONCAT(db, '.', tbl) AS `table`, "
|
||||
. "chunk, chunk_index, lower_boundary, upper_boundary, "
|
||||
@@ -5986,10 +5990,15 @@ sub find_replication_differences {
|
||||
. ") AS crc_diff, this_cnt, master_cnt, this_crc, master_crc "
|
||||
. "FROM $repl_table "
|
||||
. "WHERE (master_cnt <> this_cnt OR master_crc <> this_crc "
|
||||
. "OR ISNULL(master_crc) <> ISNULL(this_crc))"
|
||||
. "OR ISNULL(master_crc) <> ISNULL(this_crc)) "
|
||||
. ($args{where} ? " AND ($args{where})" : "");
|
||||
PTDEBUG && _d($sql);
|
||||
my $diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
|
||||
$diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
|
||||
if (!@$diffs || !$tries) { # if no differences are found OR we are out of tries left...
|
||||
last; # get out now
|
||||
}
|
||||
sleep 1;
|
||||
}
|
||||
return $diffs;
|
||||
}
|
||||
|
||||
@@ -8965,6 +8974,7 @@ sub main {
|
||||
$print_header = 1;
|
||||
$exit_status = 0;
|
||||
|
||||
|
||||
# ########################################################################
|
||||
# Get configuration information.
|
||||
# ########################################################################
|
||||
@@ -10073,6 +10083,7 @@ sub main {
|
||||
# Should be done automatically, but I like to be explicit.
|
||||
$fetch_sth->finish();
|
||||
$update_sth->finish();
|
||||
$delete_sth->finish();
|
||||
|
||||
# Update rate, chunk size, and progress if the nibble actually
|
||||
# selected some rows.
|
||||
@@ -10383,6 +10394,7 @@ sub ts {
|
||||
return $msg ? "$ts $msg" : $ts;
|
||||
}
|
||||
|
||||
|
||||
sub nibble_is_safe {
|
||||
my (%args) = @_;
|
||||
my @required_args = qw(Cxn tbl NibbleIterator OptionParser);
|
||||
@@ -12290,6 +12302,15 @@ differences found by previous checksumming, and then exits. It might be useful
|
||||
if you run pt-table-checksum quietly in a cron job, for example, and later want
|
||||
a report on the results of the cron job, perhaps to implement a Nagios check.
|
||||
|
||||
=item --replicate-check-retries
|
||||
|
||||
type: int; default: 1
|
||||
|
||||
Retry checksum comparison this many times when a difference is encountered.
|
||||
Only when a difference persists after this number of checks is it considered valid.
|
||||
Using this option with a value of 2 or more alleviates spurious differences that
|
||||
arise when using the --resume option.
|
||||
|
||||
=item --replicate-database
|
||||
|
||||
type: string
|
||||
|
@@ -459,6 +459,10 @@ sub find_replication_differences {
|
||||
}
|
||||
my ($dbh, $repl_table) = @args{@required_args};
|
||||
|
||||
|
||||
my $tries = $self->{'OptionParser'}->get('replicate-check-retries') || 1;
|
||||
my $diffs;
|
||||
while ($tries--) {
|
||||
my $sql
|
||||
= "SELECT CONCAT(db, '.', tbl) AS `table`, "
|
||||
. "chunk, chunk_index, lower_boundary, upper_boundary, "
|
||||
@@ -468,10 +472,15 @@ sub find_replication_differences {
|
||||
. ") AS crc_diff, this_cnt, master_cnt, this_crc, master_crc "
|
||||
. "FROM $repl_table "
|
||||
. "WHERE (master_cnt <> this_cnt OR master_crc <> this_crc "
|
||||
. "OR ISNULL(master_crc) <> ISNULL(this_crc))"
|
||||
. "OR ISNULL(master_crc) <> ISNULL(this_crc)) "
|
||||
. ($args{where} ? " AND ($args{where})" : "");
|
||||
PTDEBUG && _d($sql);
|
||||
my $diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
|
||||
$diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
|
||||
if (!@$diffs || !$tries) { # if no differences are found OR we are out of tries left...
|
||||
last; # get out now
|
||||
}
|
||||
sleep 1;
|
||||
}
|
||||
return $diffs;
|
||||
}
|
||||
|
||||
|
@@ -80,8 +80,8 @@ ok(
|
||||
# other than to ensure that there's at least one for each table.
|
||||
$row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");
|
||||
ok(
|
||||
$row->[0] > 30 && $row->[0] < 50,
|
||||
'Between 30 and 50 chunks'
|
||||
$row->[0] > 30 && $row->[0] < 60,
|
||||
'Between 30 and 60 chunks'
|
||||
) or diag($row->[0]);
|
||||
|
||||
# ############################################################################
|
||||
|
Reference in New Issue
Block a user