pt-table-checksum-PXC-inconsistent-results-upon-resume-1311654

This commit is contained in:
Frank Cizmich
2014-08-05 16:51:34 -03:00
3 changed files with 58 additions and 28 deletions

View File

@@ -459,19 +459,28 @@ sub find_replication_differences {
}
my ($dbh, $repl_table) = @args{@required_args};
my $sql
= "SELECT CONCAT(db, '.', tbl) AS `table`, "
. "chunk, chunk_index, lower_boundary, upper_boundary, "
. "COALESCE(this_cnt-master_cnt, 0) AS cnt_diff, "
. "COALESCE("
. "this_crc <> master_crc OR ISNULL(master_crc) <> ISNULL(this_crc), 0"
. ") 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))"
. ($args{where} ? " AND ($args{where})" : "");
PTDEBUG && _d($sql);
my $diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
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, "
. "COALESCE(this_cnt-master_cnt, 0) AS cnt_diff, "
. "COALESCE("
. "this_crc <> master_crc OR ISNULL(master_crc) <> ISNULL(this_crc), 0"
. ") 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)) "
. ($args{where} ? " AND ($args{where})" : "");
PTDEBUG && _d($sql);
$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;
}