From c9ace1b931a575b72e13dfceddf977c1c59c5be4 Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Mon, 11 Jun 2012 14:04:41 -0400 Subject: [PATCH 1/2] Failing test for SKIPPED if chunk # > 1. --- t/pt-table-checksum/basics.t | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/t/pt-table-checksum/basics.t b/t/pt-table-checksum/basics.t index 072245b7..067e0586 100644 --- a/t/pt-table-checksum/basics.t +++ b/t/pt-table-checksum/basics.t @@ -42,7 +42,7 @@ elsif ( !@{$master_dbh->selectall_arrayref("show databases like 'sakila'")} ) { plan skip_all => 'sakila database is not loaded'; } else { - plan tests => 36; + plan tests => 38; } # The sandbox servers run with lock_wait_timeout=3 and it's not dynamic @@ -255,6 +255,26 @@ is( "Oversize chunks are not errors" ); +# SKIPPED should be accurate if the first skipped chunk # > 1. +# https://bugs.launchpad.net/percona-toolkit/+bug/1011738 +$output = output( + sub { pt_table_checksum::main(@args, + qw(-t osc.t --chunk-size 5 --chunk-size-limit 1)) }, + stderr => 1, +); + +like( + $output, + qr/Skipping chunk 2/i, + "Skipped chunk 2" +); + +is( + PerconaTest::count_checksum_results($output, 'skipped'), + 1, + "Skipped 1 chunk (bug 1011738)" +); + # ############################################################################ # Check slave table row est. if doing doing 1=1 on master table. # ############################################################################ From 69ba6c4efd7e8656debeb69c32f4a157f9855aff Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Mon, 11 Jun 2012 14:43:18 -0400 Subject: [PATCH 2/2] Reset nibble_time for each chunk. --- bin/pt-table-checksum | 5 +++++ t/pt-table-checksum/basics.t | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index 6f052fd4..5e8d2fea 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -7009,6 +7009,11 @@ sub main { # Count every chunk, even if it's ultimately skipped, etc. $tbl->{checksum_results}->{n_chunks}++; + # Reset the nibble_time because this nibble hasn't been + # executed yet. If nibble_time is undef, then it's marked + # as skipped in after_nibble. + $tbl->{nibble_time} = undef; + # --explain level 2: print chunk,lower boundary values,upper # boundary values. if ( $o->get('explain') > 1 ) { diff --git a/t/pt-table-checksum/basics.t b/t/pt-table-checksum/basics.t index 067e0586..a8e7cd53 100644 --- a/t/pt-table-checksum/basics.t +++ b/t/pt-table-checksum/basics.t @@ -259,7 +259,7 @@ is( # https://bugs.launchpad.net/percona-toolkit/+bug/1011738 $output = output( sub { pt_table_checksum::main(@args, - qw(-t osc.t --chunk-size 5 --chunk-size-limit 1)) }, + qw(-t osc.t --chunk-size 6 --chunk-size-limit 1)) }, stderr => 1, ); @@ -273,7 +273,7 @@ is( PerconaTest::count_checksum_results($output, 'skipped'), 1, "Skipped 1 chunk (bug 1011738)" -); +) or diag($output); # ############################################################################ # Check slave table row est. if doing doing 1=1 on master table.