5978
5978
my ($dbh, $repl_table) = @args{@required_args};
5981
= "SELECT CONCAT(db, '.', tbl) AS `table`, "
5982
. "chunk, chunk_index, lower_boundary, upper_boundary, "
5983
. "COALESCE(this_cnt-master_cnt, 0) AS cnt_diff, "
5985
. "this_crc <> master_crc OR ISNULL(master_crc) <> ISNULL(this_crc), 0"
5986
. ") AS crc_diff, this_cnt, master_cnt, this_crc, master_crc "
5987
. "FROM $repl_table "
5988
. "WHERE (master_cnt <> this_cnt OR master_crc <> this_crc "
5989
. "OR ISNULL(master_crc) <> ISNULL(this_crc))"
5990
. ($args{where} ? " AND ($args{where})" : "");
5991
PTDEBUG && _d($sql);
5992
my $diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
5981
my $tries = $self->{'OptionParser'}->get('replicate-check-retries') || 1;
5985
= "SELECT CONCAT(db, '.', tbl) AS `table`, "
5986
. "chunk, chunk_index, lower_boundary, upper_boundary, "
5987
. "COALESCE(this_cnt-master_cnt, 0) AS cnt_diff, "
5989
. "this_crc <> master_crc OR ISNULL(master_crc) <> ISNULL(this_crc), 0"
5990
. ") AS crc_diff, this_cnt, master_cnt, this_crc, master_crc "
5991
. "FROM $repl_table "
5992
. "WHERE (master_cnt <> this_cnt OR master_crc <> this_crc "
5993
. "OR ISNULL(master_crc) <> ISNULL(this_crc)) "
5994
. ($args{where} ? " AND ($args{where})" : "");
5995
PTDEBUG && _d($sql);
5996
$diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
5997
if (!@$diffs || !$tries) { # if no differences are found OR we are out of tries left...
8514
8524
PTDEBUG && _d('Initial', $var, 'value:', $init_val);
8515
$val = int(($init_val * $threshold_factor) + $init_val);
8516
$vars->{$var} = $val;
8525
$val = ($init_val * $threshold_factor) + $init_val;
8526
$vars->{$var} = int(ceil($val));
8518
8528
PTDEBUG && _d('Wait if', $var, '>=', $val);
10562
10575
if ( $error =~ m/Lock wait timeout exceeded/
10563
10576
|| $error =~ m/Query execution was interrupted/
10577
|| $error =~ m/Deadlock found/
10565
10579
# These errors/warnings can be retried, so don't print
10566
10580
# a warning yet; do that in final_fail.
10584
10598
my (%args) = @_;
10585
10599
my $error = $args{error};
10587
if ( $error =~ /Lock wait timeout exceeded/
10588
|| $error =~ /Query execution was interrupted/
10601
if ( $error =~ m/Lock wait timeout exceeded/
10602
|| $error =~ m/Query execution was interrupted/
10603
|| $error =~ m/Deadlock found/
10590
10605
# These errors/warnings are not fatal but only cause this
10591
10606
# nibble to be skipped.
12287
12302
if you run pt-table-checksum quietly in a cron job, for example, and later want
12288
12303
a report on the results of the cron job, perhaps to implement a Nagios check.
12305
=item --replicate-check-retries
12307
type: int; default: 1
12309
Retry checksum comparison this many times when a difference is encountered.
12310
Only when a difference persists after this number of checks is it considered valid.
12311
Using this option with a value of 2 or more alleviates spurious differences that
12312
arise when using the --resume option.
12290
12314
=item --replicate-database