LP #1034686: pt-table-checksum --replicate-check-only prints tables with no diffs

Description

**Reported in Launchpad by Alfie John last update 13-08-2012 17:52:13

print_checksum_diffs() doesn't look at the --quiet option. When it prints the output, it just dumps the lot, including checksums with zero row differences.

I think something like this would be handy:

foreach my $diff ( @$diffs ) {
next if $o->get('quiet') and not $diff->{cnt_diff};
print join(' ', map { defined $_ ? $_ : '' } @{$diff}{@headers}), "\n";
}

The only problem here is that $o is not in scope.

Environment

None

Smart Checklist

Activity

lpjirasync January 24, 2018 at 3:50 PM

**Comment from Launchpad by: Daniel Nichter on: 13-08-2012 17:51:55

Yes, this is already tested, in pt-table-checksum/basics.t:

ok(
no_diff(
sub { pt_table_checksum::main(@args, qw(--replicate-check-only)) },
"$sample/no-recheck.txt",
),
"--no-recheck (just --replicate-check)"
);

The sample is:

Differences on h=127.0.0.1,P=12346
TABLE CHUNK CNT_DIFF CRC_DIFF CHUNK_INDEX LOWER_BOUNDARY UPPER_BOUNDARY
sakila.city 1 0 1 PRIMARY 1 100
sakila.city 6 0 1 PRIMARY 501 600

Differences on h=127.0.0.1,P=12347
TABLE CHUNK CNT_DIFF CRC_DIFF CHUNK_INDEX LOWER_BOUNDARY UPPER_BOUNDARY
sakila.city 1 0 1 PRIMARY 1 100
sakila.city 6 0 1 PRIMARY 501 600

lpjirasync January 24, 2018 at 3:50 PM

**Comment from Launchpad by: Daniel Nichter on: 13-08-2012 14:43:55

Thanks for reporting back. We'll double check it too, and also double check that there's a test in place.

lpjirasync January 24, 2018 at 3:49 PM

**Comment from Launchpad by: Alfie John on: 13-08-2012 04:13:16

Hmm. I just went to verify and I think I could have been mistaken here.

Feel free to close the bug.

lpjirasync January 24, 2018 at 3:49 PM

**Comment from Launchpad by: Daniel Nichter on: 10-08-2012 17:33:20

The docs say:

"""
If L<"--replicate-check-only"> is specified, then only tables with differences are printed.
"""

It's supposed to adhere to that:

if ( @$diffs ) {
$exit_status |= 1;
if ( $o->get('quiet') < 2 ) {
print_checksum_diffs(

So if there are diffs, and if the tool is being verbose enough, then print the tables with diffs.

We'll double check that this is actually the case. There was a change recently to how diffs are handled (bug 1030031), so maybe that has something to do with it.

lpjirasync January 24, 2018 at 3:49 PM

**Comment from Launchpad by: Alfie John on: 09-08-2012 12:27:28

Doing that before calling print_checksum_diffs() would work, but I'm talking about patching pt-table-checksum itself to do this.

Calling --quiet twice isn't what I'm after because I actually want to see the output of print_checksum_diffs(), just not with tables that have no issues with them.

Not a Bug

Details

Assignee

Reporter

Priority

Smart Checklist

Created January 24, 2018 at 3:49 PM
Updated February 4, 2018 at 12:07 AM
Resolved January 24, 2018 at 3:49 PM