mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-27 07:54:58 +00:00
Convert pt-table-checksum boundaries to SQL WHERE clauses.
This commit is contained in:
@@ -41,6 +41,8 @@ my %port_for = (
|
||||
slave2 => 12347,
|
||||
master1 => 12348, # master-master
|
||||
master2 => 12349, # master-master
|
||||
master3 => 2900,
|
||||
master4 => 2901,
|
||||
);
|
||||
|
||||
sub new {
|
||||
|
@@ -470,18 +470,16 @@ sub make_checksum_query {
|
||||
sub find_replication_differences {
|
||||
my ( $self, $dbh, $table ) = @_;
|
||||
|
||||
(my $sql = <<" EOF") =~ s/\s+/ /gm;
|
||||
SELECT db, tbl, chunk, boundaries,
|
||||
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 $table
|
||||
WHERE master_cnt <> this_cnt OR master_crc <> this_crc
|
||||
OR ISNULL(master_crc) <> ISNULL(this_crc)
|
||||
EOF
|
||||
my $sql
|
||||
= "SELECT db, tbl, 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 $table "
|
||||
. "WHERE master_cnt <> this_cnt OR master_crc <> this_crc "
|
||||
. "OR ISNULL(master_crc) <> ISNULL(this_crc)";
|
||||
|
||||
MKDEBUG && _d($sql);
|
||||
my $diffs = $dbh->selectall_arrayref($sql, { Slice => {} });
|
||||
|
Reference in New Issue
Block a user