mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 18:30:16 +00:00
modified RowChecksum module and updated it in pt-table-checksum (only tool that uses it)
This commit is contained in:
@@ -5977,9 +5977,10 @@ sub find_replication_differences {
|
||||
}
|
||||
my ($dbh, $repl_table) = @args{@required_args};
|
||||
|
||||
my $ts_clause = $self->{start_ts} ? " AND ts >= '$self->{start_ts}' " : ''; # issue 1311654
|
||||
|
||||
my $ts_clause = $self->{start_ts} ? " AND ts >= '$self->{start_ts}' " : ''; # only check rows created in this run
|
||||
my $tries = 5; # try again up to five times if replication checksum don't agree.
|
||||
my $ok_to_leave = 0;
|
||||
my $tries = 5; # number of times to try again if replication checksum don't agree.
|
||||
my $diffs;
|
||||
do {
|
||||
my $sql
|
||||
@@ -5993,16 +5994,15 @@ sub find_replication_differences {
|
||||
. "WHERE (master_cnt <> this_cnt OR master_crc <> this_crc "
|
||||
. "OR ISNULL(master_crc) <> ISNULL(this_crc)) $ts_clause"
|
||||
. ($args{where} ? " AND ($args{where})" : "");
|
||||
PTDEBUG && _d($sql);
|
||||
$diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
|
||||
$tries--;
|
||||
if (@$diffs) {
|
||||
sleep 1;
|
||||
} else {
|
||||
$ok_to_leave = 1;
|
||||
}
|
||||
|
||||
} until ($ok_to_leave || !$tries);
|
||||
PTDEBUG && _d($sql);
|
||||
$diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
|
||||
$tries--;
|
||||
if (@$diffs) {
|
||||
sleep 1;
|
||||
} else {
|
||||
$ok_to_leave = 1;
|
||||
}
|
||||
} until ($ok_to_leave || !$tries);
|
||||
return $diffs;
|
||||
}
|
||||
|
||||
@@ -8978,8 +8978,9 @@ sub main {
|
||||
$print_header = 1;
|
||||
$exit_status = 0;
|
||||
|
||||
$start_ts = full_ts(); # issue 1311654
|
||||
PTDEBUG && _d("initial start_ts: [$start_ts]");
|
||||
# get start time
|
||||
$start_ts = full_ts();
|
||||
PTDEBUG && _d("initial start_ts: $start_ts");
|
||||
|
||||
# ########################################################################
|
||||
# Get configuration information.
|
||||
|
@@ -459,19 +459,32 @@ 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 $ts_clause = $self->{start_ts} ? " AND ts >= '$self->{start_ts}' " : ''; # only check rows created in this run
|
||||
my $tries = 5; # try again up to five times if replication checksum don't agree.
|
||||
my $ok_to_leave = 0;
|
||||
my $diffs;
|
||||
do {
|
||||
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)) $ts_clause"
|
||||
. ($args{where} ? " AND ($args{where})" : "");
|
||||
PTDEBUG && _d($sql);
|
||||
$diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
|
||||
$tries--;
|
||||
if (@$diffs) {
|
||||
sleep 1;
|
||||
} else {
|
||||
$ok_to_leave = 1;
|
||||
}
|
||||
} until ($ok_to_leave || !$tries);
|
||||
return $diffs;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user