460
460
my ($dbh, $repl_table) = @args{@required_args};
463
= "SELECT CONCAT(db, '.', tbl) AS `table`, "
464
. "chunk, chunk_index, lower_boundary, upper_boundary, "
465
. "COALESCE(this_cnt-master_cnt, 0) AS cnt_diff, "
467
. "this_crc <> master_crc OR ISNULL(master_crc) <> ISNULL(this_crc), 0"
468
. ") AS crc_diff, this_cnt, master_cnt, this_crc, master_crc "
469
. "FROM $repl_table "
470
. "WHERE (master_cnt <> this_cnt OR master_crc <> this_crc "
471
. "OR ISNULL(master_crc) <> ISNULL(this_crc))"
472
. ($args{where} ? " AND ($args{where})" : "");
474
my $diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
463
my $tries = $self->{'OptionParser'}->get('replicate-check-retries') || 1;
467
= "SELECT CONCAT(db, '.', tbl) AS `table`, "
468
. "chunk, chunk_index, lower_boundary, upper_boundary, "
469
. "COALESCE(this_cnt-master_cnt, 0) AS cnt_diff, "
471
. "this_crc <> master_crc OR ISNULL(master_crc) <> ISNULL(this_crc), 0"
472
. ") AS crc_diff, this_cnt, master_cnt, this_crc, master_crc "
473
. "FROM $repl_table "
474
. "WHERE (master_cnt <> this_cnt OR master_crc <> this_crc "
475
. "OR ISNULL(master_crc) <> ISNULL(this_crc)) "
476
. ($args{where} ? " AND ($args{where})" : "");
478
$diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
479
if (!@$diffs || !$tries) { # if no differences are found OR we are out of tries left...